1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

Use spies to hide expected deprecation warnings

This commit is contained in:
Jared Beck 2017-11-30 22:30:59 -05:00
parent 987059865d
commit 29dd86c3e4
2 changed files with 6 additions and 0 deletions

View file

@ -13,7 +13,10 @@ RSpec.describe Document, type: :model, versioning: true do
it "works with custom versions association" do
document = Document.create!(name: "Foo")
document.update_attributes!(name: "Bar")
allow(ActiveSupport::Deprecation).to receive(:warn)
expect(document).to have_a_version_with_changes(name: "Bar")
expect(ActiveSupport::Deprecation).to have_received(:warn).
once.with(/^where_object_changes/)
end
end

View file

@ -29,10 +29,13 @@ RSpec.describe Widget, type: :model do
end
it "is possible to do assertions on version changes" do
allow(ActiveSupport::Deprecation).to receive(:warn)
expect(widget).to have_a_version_with_changes name: "Leonard", an_integer: 2
expect(widget).to have_a_version_with_changes an_integer: 2
expect(widget).to have_a_version_with_changes name: "Tom"
expect(widget).to have_a_version_with_changes name: "Bob"
expect(ActiveSupport::Deprecation).to have_received(:warn).
exactly(5).times.with(/^where_object_changes/)
end
end