@@ -74,7 +74,13 @@ def new_record?; true; end
74
74
expect {
75
75
expect ( record ) . to be_a_new ( record . class ) . with (
76
76
foo : a_string_matching ( "bar" ) )
77
- } . to raise_error ( "attribute {\" foo\" =>(a string matching \" bar\" )} was not set on #{ record . inspect } " )
77
+ } . to raise_error { |e |
78
+ if RUBY_VERSION >= '3.4'
79
+ "attribute {\" foo\" => (a string matching \" bar\" )} was not set on #{ record . inspect } "
80
+ else
81
+ "attribute {\" foo\" =>(a string matching \" bar\" )} was not set on #{ record . inspect } "
82
+ end
83
+ }
78
84
end
79
85
80
86
context "matcher is wrong type" do
@@ -106,7 +112,13 @@ def new_record?; true; end
106
112
foo : a_string_matching ( "foo" ) ,
107
113
bar : a_string_matching ( "barn" )
108
114
)
109
- } . to raise_error ( "attribute {\" bar\" =>(a string matching \" barn\" )} was not set on #{ record . inspect } " )
115
+ } . to raise_error { |e |
116
+ if RUBY_VERSION >= '3.4'
117
+ "attribute {\" bar\" => (a string matching \" barn\" )} was not set on #{ record . inspect } "
118
+ else
119
+ "attribute {\" bar\" =>(a string matching \" barn\" )} was not set on #{ record . inspect } "
120
+ end
121
+ }
110
122
end
111
123
end
112
124
end
@@ -118,8 +130,13 @@ def new_record?; true; end
118
130
expect ( record ) . to be_a_new ( record . class ) . with ( zoo : 'zoo' , car : 'car' )
119
131
} . to raise_error { |e |
120
132
expect ( e . message ) . to match ( /attributes \{ .*\} were not set on #{ Regexp . escape record . inspect } / )
121
- expect ( e . message ) . to match ( /"zoo"=>"zoo"/ )
122
- expect ( e . message ) . to match ( /"car"=>"car"/ )
133
+ if RUBY_VERSION >= '3.4'
134
+ expect ( e . message ) . to match ( /"zoo" => "zoo"/ )
135
+ expect ( e . message ) . to match ( /"car" => "car"/ )
136
+ else
137
+ expect ( e . message ) . to match ( /"zoo"=>"zoo"/ )
138
+ expect ( e . message ) . to match ( /"car"=>"car"/ )
139
+ end
123
140
}
124
141
end
125
142
end
@@ -129,7 +146,7 @@ def new_record?; true; end
129
146
expect {
130
147
expect ( record ) . to be_a_new ( record . class ) . with ( foo : 'bar' )
131
148
} . to raise_error (
132
- %(attribute { "foo"=>"bar"} was not set on #{ record . inspect } )
149
+ %(attribute #{ { "foo" => "bar" } } was not set on #{ record . inspect } )
133
150
)
134
151
end
135
152
end
@@ -166,8 +183,13 @@ def new_record?; false; end
166
183
expect ( record ) . to be_a_new ( String ) . with ( zoo : 'zoo' , car : 'car' )
167
184
} . to raise_error { |e |
168
185
expect ( e . message ) . to match ( /expected #{ Regexp . escape record . inspect } to be a new String and attributes \{ .*\} were not set on #{ Regexp . escape record . inspect } / )
169
- expect ( e . message ) . to match ( /"zoo"=>"zoo"/ )
170
- expect ( e . message ) . to match ( /"car"=>"car"/ )
186
+ if RUBY_VERSION >= '3.4'
187
+ expect ( e . message ) . to match ( /"zoo" => "zoo"/ )
188
+ expect ( e . message ) . to match ( /"car" => "car"/ )
189
+ else
190
+ expect ( e . message ) . to match ( /"zoo"=>"zoo"/ )
191
+ expect ( e . message ) . to match ( /"car"=>"car"/ )
192
+ end
171
193
}
172
194
end
173
195
end
@@ -178,7 +200,7 @@ def new_record?; false; end
178
200
expect ( record ) . to be_a_new ( String ) . with ( foo : 'bar' )
179
201
} . to raise_error (
180
202
"expected #{ record . inspect } to be a new String and " +
181
- %(attribute { "foo"=>"bar"} was not set on #{ record . inspect } )
203
+ %(attribute #{ { "foo" => "bar" } } was not set on #{ record . inspect } )
182
204
)
183
205
end
184
206
end
0 commit comments