Permalink
Browse files

* Wrap spec for `ascii_only` in condition so it does not run on JRuby…

… until `1.7.5`
  • Loading branch information...
1 parent a4f35e8 commit ddaca83ac75260e9532097e3ee0c45ba153323da @PikachuEXE PikachuEXE committed Sep 16, 2013
Showing with 39 additions and 37 deletions.
  1. +39 −37 spec/powerpack/string/ascii_only_spec.rb
@@ -2,42 +2,44 @@
require 'spec_helper'
-describe 'String#ascii_only' do
- it 'returns same value for string with ASCII chars only' do
- expect('abc'.ascii_only).to eq 'abc'
- end
-
- it 'returns string without non-ASCII chars' do
- expect("abc\u{6666}".force_encoding("UTF-8").ascii_only).to eq 'abc'
- end
-
- it 'returns string without non-ASCII chars and with ASCII chars' do
- expect("\u{6666}".force_encoding("UTF-8").ascii_only).to eq ''
- end
-
- it 'does not change the original string' do
- string = "abc\u{6666}".force_encoding("UTF-8")
- string.ascii_only
- expect(string).to eq "abc\u{6666}".force_encoding("UTF-8")
- end
-end
-
-describe 'String#ascii_only!' do
- it 'returns same value for string with ASCII chars only' do
- expect('abc'.ascii_only!).to eq 'abc'
- end
-
- it 'returns string without non-ASCII chars' do
- expect("abc\u{6666}".force_encoding("UTF-8").ascii_only!).to eq 'abc'
- end
-
- it 'returns string without non-ASCII chars and with ASCII chars' do
- expect("\u{6666}".force_encoding("UTF-8").ascii_only!).to eq ''
- end
-
- it 'changes the original string' do
- string = "abc\u{6666}".force_encoding("UTF-8")
- string.ascii_only!
- expect(string).to eq 'abc'
+unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
+ describe 'String#ascii_only' do
+ it 'returns same value for string with ASCII chars only' do
+ expect('abc'.ascii_only).to eq 'abc'
+ end
+
+ it 'returns string without non-ASCII chars' do
+ expect("abc\u{6666}".force_encoding("UTF-8").ascii_only).to eq 'abc'
+ end
+
+ it 'returns string without non-ASCII chars and with ASCII chars' do
+ expect("\u{6666}".force_encoding("UTF-8").ascii_only).to eq ''
+ end
+
+ it 'does not change the original string' do
+ string = "abc\u{6666}".force_encoding("UTF-8")
+ string.ascii_only
+ expect(string).to eq "abc\u{6666}".force_encoding("UTF-8")
+ end
+ end
+
+ describe 'String#ascii_only!' do
+ it 'returns same value for string with ASCII chars only' do
+ expect('abc'.ascii_only!).to eq 'abc'
+ end
+
+ it 'returns string without non-ASCII chars' do
+ expect("abc\u{6666}".force_encoding("UTF-8").ascii_only!).to eq 'abc'
+ end
+
+ it 'returns string without non-ASCII chars and with ASCII chars' do
+ expect("\u{6666}".force_encoding("UTF-8").ascii_only!).to eq ''
+ end
+
+ it 'changes the original string' do
+ string = "abc\u{6666}".force_encoding("UTF-8")
+ string.ascii_only!
+ expect(string).to eq 'abc'
+ end
end
end

0 comments on commit ddaca83

Please sign in to comment.