test/unit/model_test.rb in paper_trail-2.1.1 vs test/unit/model_test.rb in paper_trail-2.2.0
- old
+ new
@@ -12,21 +12,21 @@
context 'which updates an ignored column and a selected column' do
setup { @article.update_attributes :title => 'My first title', :content => 'Some text here.' }
should_change('the number of versions', :by => 1) { Version.count }
end
-
+
context 'which updates a selected column' do
setup { @article.update_attributes :content => 'Some text here.' }
should_change('the number of versions', :by => 1) { Version.count }
end
context 'which updates a non-ignored and non-selected column' do
setup { @article.update_attributes :abstract => 'Other abstract'}
should_not_change('the number of versions') { Version.count }
end
-
+
end
context 'A new record' do
setup { @widget = Widget.new }
@@ -710,39 +710,39 @@
end
end
context 'A new model instance which uses a custom Version class' do
setup { @post = Post.new }
-
+
context 'which is then saved' do
setup { @post.save }
should_change('the number of post versions') { PostVersion.count }
should_not_change('the number of versions') { Version.count }
end
end
-
+
context 'An existing model instance which uses a custom Version class' do
setup { @post = Post.create }
-
+
context 'on the first version' do
setup { @version = @post.versions.first }
-
+
should 'have the correct index' do
assert_equal 0, @version.index
end
end
-
+
should 'should have versions of the custom class' do
assert_equal "PostVersion", @post.versions.first.class.name
end
-
+
context 'which is modified' do
setup { @post.update_attributes({ :content => "Some new content" }) }
should_change('the number of post versions') { PostVersion.count }
should_not_change('the number of versions') { Version.count }
end
end
-
+
context 'An overwritten default accessor' do
setup do
@song = Song.create :length => 4
@song.update_attributes :length => 5