Convert test/unit/model_test.rb to rspec
- Test against ruby 2.3.4 (was 2.3.1) - Troubleshooting time comparison in test - Test should not care about array order
This commit is contained in:
parent
6f266dce9a
commit
f099b61540
|
@ -24,6 +24,7 @@ RSpec/FilePath:
|
|||
RSpec/InstanceVariable:
|
||||
Exclude:
|
||||
- spec/paper_trail/associations_spec.rb
|
||||
- spec/paper_trail/model_spec.rb
|
||||
|
||||
RSpec/MessageSpies:
|
||||
Enabled: false
|
||||
|
@ -34,6 +35,7 @@ RSpec/NamedSubject:
|
|||
RSpec/NestedGroups:
|
||||
Exclude:
|
||||
- spec/paper_trail/associations_spec.rb
|
||||
- spec/paper_trail/model_spec.rb
|
||||
|
||||
Security/YAMLLoad:
|
||||
Enabled: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
language: ruby
|
||||
cache: bundler
|
||||
rvm:
|
||||
- 2.3.1
|
||||
- 2.3.4
|
||||
- 2.1.10
|
||||
env:
|
||||
global:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,9 @@ module PaperTrail
|
|||
animal = Animal.create
|
||||
animal.update_attributes(name: "Animal")
|
||||
animal.destroy
|
||||
expect(described_class.not_creates.pluck(:event)).to eq(%w[update destroy])
|
||||
expect(
|
||||
described_class.not_creates.pluck(:event)
|
||||
).to match_array(%w[update destroy])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -53,38 +53,6 @@ module ActiveSupport
|
|||
DatabaseCleaner.clean if using_mysql?
|
||||
Thread.current[:paper_trail] = nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assert_attributes_equal(expected, actual)
|
||||
if using_mysql?
|
||||
expected = expected.dup
|
||||
actual = actual.dup
|
||||
|
||||
# Adjust timestamps for missing fractional seconds precision.
|
||||
%w[created_at updated_at].each do |timestamp|
|
||||
expected[timestamp] = expected[timestamp].change(usec: 0)
|
||||
actual[timestamp] = actual[timestamp].change(usec: 0)
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal expected, actual
|
||||
end
|
||||
|
||||
def assert_changes_equal(expected, actual)
|
||||
if using_mysql?
|
||||
expected = expected.dup
|
||||
actual = actual.dup
|
||||
|
||||
# Adjust timestamps for missing fractional seconds precision.
|
||||
%w[created_at updated_at].each do |timestamp|
|
||||
expected[timestamp][1] = expected[timestamp][1].change(usec: 0)
|
||||
actual[timestamp][1] = actual[timestamp][1].change(usec: 0)
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal expected, actual
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
require "timecop"
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue