Sha256: e79ed2fd17cb95de69fe9b911b7a723ba650713d83165c6c7354310e7f029d8e
Contents?: true
Size: 1.33 KB
Versions: 7
Compression:
Stored size: 1.33 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 '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
7 entries across 7 versions & 2 rubygems