diff --git a/features/utf-8.feature b/features/utf-8.feature new file mode 100644 index 000000000..161647cc2 --- /dev/null +++ b/features/utf-8.feature @@ -0,0 +1,14 @@ +Feature: UTF-8 + + Scenario: Write then assert on the content of a file with UTF-8 characters in + Given a file named "turning-japanese" with: + """ + フィーチャ + + """ + And I run `cat turning-japanese` + Then the output should contain exactly: + """ + フィーチャ + + """ diff --git a/lib/aruba/api.rb b/lib/aruba/api.rb index fabac597d..3826b123a 100644 --- a/lib/aruba/api.rb +++ b/lib/aruba/api.rb @@ -183,22 +183,27 @@ def all_output end def assert_exact_output(expected, actual) + actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should == unescape(expected) end def assert_partial_output(expected, actual) + actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should include(unescape(expected)) end def assert_matching_output(expected, actual) + actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should =~ /#{unescape(expected)}/m end def assert_not_matching_output(expected, actual) + actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should_not =~ /#{unescape(expected)}/m end def assert_no_partial_output(unexpected, actual) + actual.force_encoding(unexpected.encoding) if RUBY_VERSION >= "1.9" if Regexp === unexpected unescape(actual).should_not =~ unexpected else