test/unit/version_test.rb in paper_trail-4.2.0 vs test/unit/version_test.rb in paper_trail-5.0.0
- old
+ new
@@ -1,6 +1,6 @@
-require 'test_helper'
+require "test_helper"
module PaperTrail
class VersionTest < ActiveSupport::TestCase
setup do
change_schema
@@ -22,11 +22,11 @@
end
end
context ".updates" do
setup {
- @animal.update_attributes(:name => 'Animal')
+ @animal.update_attributes(name: "Animal")
assert Version.updates.present?
}
should "return only update events" do
Version.updates.each do |version|
@@ -48,11 +48,11 @@
end
end
context ".not_creates" do
setup {
- @animal.update_attributes(:name => 'Animal')
+ @animal.update_attributes(name: "Animal")
@animal.destroy
assert Version.not_creates.present?
}
should "return all versions except create events" do
@@ -63,11 +63,11 @@
end
context ".subsequent" do
setup do
2.times do
- @animal.update_attributes(:name => Faker::Lorem.word)
+ @animal.update_attributes(name: FFaker::Lorem.word)
end
end
context "given a timestamp" do
should "return all versions that were created after the timestamp" do
@@ -80,21 +80,21 @@
end
end
context "given a Version" do
should "grab the timestamp from the version and use that as the value" do
- expected = @animal.versions.to_a.tap { |assoc| assoc.shift }
+ expected = @animal.versions.to_a.tap(&:shift)
actual = Version.subsequent(@animal.versions.first)
assert_equal expected, actual
end
end
end
context ".preceding" do
setup do
2.times do
- @animal.update_attributes(:name => Faker::Lorem.word)
+ @animal.update_attributes(name: FFaker::Lorem.word)
end
end
context "given a timestamp" do
should "return all versions that were created before the timestamp" do
@@ -107,10 +107,10 @@
end
end
context "given a Version" do
should "grab the timestamp from the version and use that as the value" do
- expected = @animal.versions.to_a.tap { |assoc| assoc.pop }.reverse
+ expected = @animal.versions.to_a.tap(&:pop).reverse
actual = Version.preceding(@animal.versions.last)
assert_equal expected, actual
end
end
end