diff options
Diffstat (limited to 'spec/ruby/core/string/ord_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/ord_spec.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/ruby/core/string/ord_spec.rb b/spec/ruby/core/string/ord_spec.rb index cfc630a124..5a17fc1d87 100644 --- a/spec/ruby/core/string/ord_spec.rb +++ b/spec/ruby/core/string/ord_spec.rb @@ -2,7 +2,7 @@ require_relative '../../spec_helper' describe "String#ord" do it "returns an Integer" do - 'a'.ord.should be_an_instance_of(Integer) + 'a'.ord.should.instance_of?(Integer) end it "returns the codepoint of the first character in the String" do @@ -23,6 +23,11 @@ describe "String#ord" do end it "raises an ArgumentError if called on an empty String" do - -> { ''.ord }.should raise_error(ArgumentError) + -> { ''.ord }.should.raise(ArgumentError) + end + + it "raises ArgumentError if the character is broken" do + s = "©".dup.force_encoding("US-ASCII") + -> { s.ord }.should.raise(ArgumentError, "invalid byte sequence in US-ASCII") end end |
