Sha256: 7d88a28e95fab1e2b3d9be04717c2fcce3e4645ce9bc96d377a0e402c089545c

Contents?: true

Size: 794 Bytes

Versions: 23

Compression:

Stored size: 794 Bytes

Contents

require 'spec_helper'

describe "ActiveRecord::FinderMethods" do
  before(:all) do
    reload_turntable!(File.join(File.dirname(__FILE__), "../../config/turntable.yml"))
  end

  context "User insert with id" do
    before do
      establish_connection_to(:test)
      truncate_shard
      user
    end

    let(:user) {
      u = User.new
      u.id = 1
      u.save
      u
    }

    describe "User#find" do
      context "With existing users.id" do
        subject { User.find(1) }

        it "#find should be returns user" do
          is_expected.to eq(user)
        end
      end

      context "With users.id not existing" do
        subject { User.find(2) }

        it "#find should raise error" do
          expect { subject }.to raise_error
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
activerecord-turntable-2.5.0 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.4.0 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.3.3 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.3.2 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.3.1 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.3.0 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.2.2 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.2.1 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.2.0 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.1.1 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.1.0 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.1.0.rc2 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.1.0.rc1 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.1.0.beta2 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.1.0.beta1 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.0.6 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.0.5 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.0.4 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.0.3 spec/active_record/turntable/finder_spec.rb
activerecord-turntable-2.0.2 spec/active_record/turntable/finder_spec.rb