spec/integration/integration_spec.rb in mongoid-history-0.1.4 vs spec/integration/integration_spec.rb in mongoid-history-0.1.5
- old
+ new
@@ -69,19 +69,19 @@
it "should assign version" do
@comment.history_tracks.first.version.should == 1
end
it "should assign scope" do
- @comment.history_tracks.first.scope == "Post"
+ @comment.history_tracks.first.scope.should == "post"
end
it "should assign method" do
- @comment.history_tracks.first.action == "create"
+ @comment.history_tracks.first.action.should == "create"
end
it "should assign association_chain" do
- @comment.history_tracks.first.association_chain = [{:id => @post.id, :name => "Post"}, {:id => @comment.id, :name => "Comment"}]
+ @comment.history_tracks.first.association_chain.should == [{'id' => @post.id, 'name' => "Post"}, {'id' => @comment.id, 'name' => "Comment"}]
end
end
describe "on destruction" do
it "should have two history track records in post" do
@@ -90,16 +90,16 @@
}.should change(HistoryTracker, :count).by(1)
end
it "should assign destroy on track record" do
@post.destroy
- @post.history_tracks.last.action == "destroy"
+ @post.history_tracks.last.action.should == "destroy"
end
it "should return affected attributes from track record" do
@post.destroy
- @post.history_tracks.last.affected["title"] == "Test"
+ @post.history_tracks.last.affected["title"].should == "Test"
end
end
describe "on update non-embedded" do
@@ -149,16 +149,16 @@
@post.version.should == 1
end
it "should assign scope" do
@post.update_attributes(:title => "Another Test")
- @post.history_tracks.first.scope == "Post"
+ @post.history_tracks.first.scope.should == "post"
end
it "should assign association_chain" do
@post.update_attributes(:title => "Another Test")
- @post.history_tracks.first.association_chain = [{:id => @post.id, :name => "Post"}]
+ @post.history_tracks.first.association_chain.should == [{'id' => @post.id, 'name' => "Post"}]
end
it "should exclude defined options" do
@user.update_attributes(:name => "Aaron2", :email => "aaronsnewemail@randomemail.com")
@user.history_tracks.first.modified.should == {
@@ -282,10 +282,10 @@
it "should be destroyed after undo and redo" do
@post.destroy
@track = @post.history_tracks.where(:version => 1).first
@track.undo!(@user)
@track.redo!(@user)
- Post.where(:_id => @post.id).first == nil
+ Post.where(:_id => @post.id).first.should == nil
end
end
describe "embedded" do
it "should undo changes" do