Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #325 from rspec/fix_encoding_comparison_of_objects
Browse files Browse the repository at this point in the history
Force generated object strings to have matching encoding.
  • Loading branch information
JonRowe committed Nov 6, 2013
1 parent 779d5b3 commit 6a1ab3e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion spec/rspec/expectations/differ_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def inspect
expect(diff).to eq expected_diff
end

it 'outputs unified diff messaoge of two hashes with differing encoding' do
it 'outputs unified diff message of two hashes with differing encoding' do
expected_diff = %Q{
@@ -1,2 +1,2 @@
-"a" => "a"
Expand All @@ -153,6 +153,17 @@ def inspect
expect(diff).to eq expected_diff
end

it 'outputs unified diff message of two hashes with encoding different to key encoding' do
expected_diff = %Q{
@@ -1,2 +1,2 @@
-:a => "a"
#{ (RUBY_VERSION.to_f > 1.8) ? %Q{+\"한글\" => \"한글2\"} : '+"\355\225\234\352\270\200" => "\355\225\234\352\270\2002"' }
}

diff = differ.diff_as_object({ "한글" => "한글2"}, { :a => "a"})
expect(diff).to eq expected_diff
end

it "outputs unified diff message of two hashes with object keys" do
expected_diff = %Q{
@@ -1,2 +1,2 @@
Expand Down

0 comments on commit 6a1ab3e

Please sign in to comment.