File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ def attributes
49
49
50
50
def attributes_match? ( actual )
51
51
attributes . stringify_keys . all? do |key , value |
52
- actual . attributes [ key ] . eql ?( value ) || ( value . respond_to? ( :expected , true ) && actual . attributes [ key ] . include? ( value . expected ) )
52
+ values_match ?( value , actual . attributes [ key ] )
53
53
end
54
54
end
55
55
56
56
def unmatched_attributes
57
57
attributes . stringify_keys . reject do |key , value |
58
- actual . attributes [ key ] . eql? ( value )
58
+ values_match? ( value , actual . attributes [ key ] )
59
59
end
60
60
end
61
61
end
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def new_record?; true; end
69
69
context "one attribute is a composable matcher" do
70
70
it "passes" do
71
71
expect ( record ) . to be_a_new ( record . class ) . with (
72
- :foo => a_string_matching ( "foo" ) )
72
+ :foo => a_string_including ( "foo" ) )
73
73
end
74
74
75
75
it "fails" do
@@ -111,8 +111,7 @@ def new_record?; true; end
111
111
:bar => a_string_matching ( "barn" )
112
112
)
113
113
} . to raise_error { |e |
114
- expect ( e . message ) . to match ( /attributes \{ .*\} were not set on #{ Regexp . escape record . inspect } / )
115
- expect ( e . message ) . to match ( /@expected="foo"/ )
114
+ expect ( e . message ) . to match ( /attribute \{ .*\} was not set on #{ Regexp . escape record . inspect } / )
116
115
expect ( e . message ) . to match ( /@expected="barn"/ )
117
116
}
118
117
end
You can’t perform that action at this time.
0 commit comments