Permalink
Browse files

Make specs about messages more tolerant of inconsistent ordering char…

…acteristics of different rubies.
  • Loading branch information...
1 parent c873d34 commit e5938b8d37e00439f83a2fb3f4b8d2ceae29f7f6 @dchelimsky dchelimsky committed Feb 27, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 spec/rspec/rails/matchers/be_a_new_spec.rb
@@ -71,9 +71,11 @@ def new_record?; true; end
it "fails" do
expect {
record.should be_a_new(record.class).with(:zoo => 'zoo', :car => 'car')
- }.to raise_error(
- %Q(attributes {"zoo"=>"zoo", "car"=>"car"} were not set on #{record.inspect})
- )
+ }.to raise_error {|e|
+ e.message.should match(/attributes {.*} were not set on #{record.inspect}/)
+ e.message.should match(/"zoo"=>"zoo"/)
+ e.message.should match(/"car"=>"car"/)
+ }
end
end
@@ -117,10 +119,11 @@ def new_record?; false; end
it "fails" do
expect {
record.should be_a_new(String).with(:zoo => 'zoo', :car => 'car')
- }.to raise_error(
- "expected #{record.inspect} to be a new String and " +
- %Q(attributes {"zoo"=>"zoo", "car"=>"car"} were not set on #{record.inspect})
- )
+ }.to raise_error {|e|
+ e.message.should match(/expected #{record.inspect} to be a new String and attributes {.*} were not set on #{record.inspect}/)
+ e.message.should match(/"zoo"=>"zoo"/)
+ e.message.should match(/"car"=>"car"/)
+ }
end
end

0 comments on commit e5938b8

Please sign in to comment.