Sha256: 0f58c343c2681ccc47a5156e2f9c1b93b96adee372534e5def01234812e539ba

Contents?: true

Size: 1.33 KB

Versions: 29

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe NinjaModel::Adapters::AbstractAdapter do
  subject { NinjaModel::Adapters::AbstractAdapter.new({}) }
  it { should respond_to(:reconnect!) }
  it { should respond_to(:disconnect!) }
  it { should respond_to(:reset!) }
  it { should respond_to(:verify!) }
  it { should respond_to(:create) }
  it { should respond_to(:read) }
  it { should respond_to(:update) }
  it { should respond_to(:destroy) }
  its(:adapter_name) { should eql('Abstract') }
  its(:persistent_connection?) { should be_true }
  its(:active?) { should be_false }
  specify { subject.create({}).should be_false }
  specify { subject.read({}).should be_nil }
  specify { subject.update({}).should be_false }
  specify { subject.destroy({}).should be_false }

  it 'should be active after reconnect' do
    subject.reconnect!
    subject.active?.should be_true
  end

  describe 'verify!' do
    it 'should call reconnect! when inactive' do
      subject.stubs(:active?).returns(false)
      subject.expects(:reconnect!)
      subject.verify!
    end

    it 'should not call reconnect! when active' do
      subject.stubs(:active?).returns(true)
      subject.expects(:reconnect!).never
      subject.verify!
    end
  end

  it 'should be inactive after disconnect' do
    subject.reconnect!
    subject.disconnect!
    subject.active?.should be_false
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
ninja-model-1.0.5 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-1.0.4 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-1.0.3 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-1.0.2 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-1.0.1 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-1.0.0 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.6 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.5 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.4 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.3 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.2 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.1 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.9.0 spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.8.1 spec/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.8.0 spec/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.7.3 spec/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.7.2 spec/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.7.1 spec/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.7.0 spec/ninja_model/adapters/abstract_adapter_spec.rb
ninja-model-0.6.2 spec/ninja_model/adapters/abstract_adapter_spec.rb