Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for utf 8 #152

Merged
merged 4 commits into from
May 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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