spec/lib/history_spec.rb in active_metadata-0.8.7 vs spec/lib/history_spec.rb in active_metadata-0.8.7.1

- old
+ new

@@ -1,11 +1,10 @@ require "spec_helper" require "time" describe ActiveMetadata do - describe "history" do before(:each) do @document = Document.create! { |d| d.name = "John" } @document.reload @@ -26,17 +25,24 @@ it "should save the craeted_at datetime anytime an history entry is created" do @document.history_for(:name)[0].created_at.should be_a_kind_of Time end it "should not save the history and send any notification if new value and old are both nil" do - # see - # https://github.com/rails/rails/issues/8874 @user = User.create!(:email => "email@email.it", :firstname => 'John', :lastname => 'smith') ActiveMetadata::Watcher.create! :model_class => "Document", :label => :date, :owner_id => @user.id @document.date = "" @document.save @document.notifier.should be_nil @document.history_for(:date).should be_empty + end + + it "should not save the history and send any notification if changes is [nil,""]" do + @user = User.create!(:email => "email@email.it", :lastname => 'smith') + ActiveMetadata::Watcher.create! :model_class => "Document", :label => :date, :owner_id => @user.id + @document.surname = "" + @document.save + @document.notifier.should be_nil + @document.history_for(:surname).should be_empty end it "should verify that history return records only for the self document" do # fixtures @another_doc = Document.create :name => "Andrea" \ No newline at end of file