Sha256: 10cb2c1c44acec8267ca4f4f46dc0dbe4834e1c3d33f0b19e509f51d32ee3ed6
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe ActiveRecord::Turntable::ActiveRecordExt::LockingOptimistic do before(:all) do reload_turntable!(File.join(File.dirname(__FILE__), "../../../config/turntable.yml")) end before(:each) do establish_connection_to(:test) truncate_shard end before(:each) do ActiveRecord::Base.turntable_config.instance_variable_get(:@config)[:raise_on_not_specified_shard_update] = true end after(:each) do ActiveRecord::Base.turntable_config.instance_variable_get(:@config)[:raise_on_not_specified_shard_update] = false end let!(:user_status) do user_status = UserStatus.new(user_id: 1) user_status.id = 10 user_status.save user_status end describe "optimistic locking" do subject { user_status.update_attributes(hp: 20) } it { expect { subject }.to change(user_status, :lock_version).by(1) } end describe "Json serialized column is saved" do before do user_status.update_attributes(data: {foo: 'bar'}) user_status.reload end subject { user_status.data } it { expect { subject }.to_not raise_error } end end
Version data entries
2 entries across 2 versions & 1 rubygems