Sha256: beec8adc355e5243e088d277ff7cf03a6f806c1f5afa5b373d3ec92df4fe41fa
Contents?: true
Size: 1.54 KB
Versions: 4
Compression:
Stored size: 1.54 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe 'Dynamoid::Dirty' do context 'changes' do it 'should be empty' do tweet = Tweet.new tweet.msg_changed?.should be_false end it 'should not be empty' do tweet = Tweet.new(:tweet_id => "1", :group => 'abc') tweet.changed?.should be_true tweet.group_was.should be_nil end it 'should be empty when loaded from database' do Tweet.create!(:tweet_id => "1", :group => 'abc') tweet = Tweet.where(:tweet_id => "1", :group => 'abc').first tweet.changed?.should be_false tweet.group = 'abc' tweet.reload tweet.changed?.should be_false end it 'should be empty after an update' do tweet = Tweet.create!(:tweet_id => "1", :group => 'abc') tweet.update! do |t| t.set(msg: "foo") end tweet.changed?.should be_false end it 'track changes after saves' do tweet = Tweet.new(:tweet_id => "1", :group => 'abc') tweet.save! tweet.changed?.should be_false tweet.user_name = 'xyz' tweet.user_name_changed?.should be_true tweet.user_name_was.should be_nil tweet.save! tweet.user_name_changed?.should be_false tweet.user_name = 'abc' tweet.user_name_was.should == 'xyz' end it 'clear changes on save' do tweet = Tweet.new(:tweet_id => "1", :group => 'abc') tweet.group = 'xyz' tweet.group_changed?.should be_true tweet.save! tweet.group_changed?.should be_false end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
dynamoid-moda-0.7.2 | spec/dynamoid/dirty_spec.rb |
dynamoid-moda-0.7.1 | spec/dynamoid/dirty_spec.rb |
dynamoid-0.7.1 | spec/dynamoid/dirty_spec.rb |
dynamoid-0.7.0 | spec/dynamoid/dirty_spec.rb |