You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RSpec::Matchers.define:has_same_attributes_asdo |expected|
ignored=%w[idupdated_atcreated_at]matchdo |actual|
actual.attributes.except(*ignored) == expected.attributes.except(*ignored)endfailure_messagedo |actual|
"Expected strength of #{expected.attributes.except(*ignored)}, but had #{actual.attributes.except(*ignored)}"enddiffableend
I just want to compare the attributes except id created_at updated_at, but when I use diffable it still returns the diff about excepted obj and actual obj instead of their attributes.
Is there any way to solve this? thx
The text was updated successfully, but these errors were encountered:
tony612
changed the title
Can I custom diffable's behaviour by compare obj's attributes?
Can I custom diffable's behaviour by just comparing obj's attributes?
Aug 15, 2014
I have a custom matcher for rails's AR like this:
I just want to compare the attributes except
id created_at updated_at
, but when I use diffable it still returns the diff aboutexcepted
obj andactual
obj instead of their attributes.Is there any way to solve this? thx
The text was updated successfully, but these errors were encountered: