Skip to content

Commit

Permalink
Merge pull request #152 from cucumber/support-for-utf-8
Browse files Browse the repository at this point in the history
Support for utf 8
  • Loading branch information
mattwynne committed May 16, 2013
2 parents 7b4e522 + 9893e67 commit bbc899d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions features/utf-8.feature
Original file line number Diff line number Diff line change
@@ -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:
"""
フィーチャ
"""
5 changes: 5 additions & 0 deletions lib/aruba/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbc899d

Please sign in to comment.