diff options
Diffstat (limited to 'spec/ruby/core/string/ascii_only_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/ascii_only_spec.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/ruby/core/string/ascii_only_spec.rb b/spec/ruby/core/string/ascii_only_spec.rb index 88a0559cfd..9af663beb8 100644 --- a/spec/ruby/core/string/ascii_only_spec.rb +++ b/spec/ruby/core/string/ascii_only_spec.rb @@ -12,13 +12,13 @@ describe "String#ascii_only?" do end it "returns true if the encoding is US-ASCII" do - "hello".dup.force_encoding(Encoding::US_ASCII).ascii_only?.should be_true - "hello".encode(Encoding::US_ASCII).ascii_only?.should be_true + "hello".dup.force_encoding(Encoding::US_ASCII).ascii_only?.should == true + "hello".encode(Encoding::US_ASCII).ascii_only?.should == true end it "returns true for all single-character UTF-8 Strings" do 0.upto(127) do |n| - n.chr.ascii_only?.should be_true + n.chr.ascii_only?.should == true end end end @@ -27,7 +27,7 @@ describe "String#ascii_only?" do it "returns false if the encoding is BINARY" do chr = 128.chr chr.encoding.should == Encoding::BINARY - chr.ascii_only?.should be_false + chr.ascii_only?.should == false end it "returns false if the String contains any non-ASCII characters" do @@ -46,37 +46,37 @@ describe "String#ascii_only?" do end it "returns true for the empty String with an ASCII-compatible encoding" do - "".ascii_only?.should be_true - "".encode('UTF-8').ascii_only?.should be_true + "".ascii_only?.should == true + "".encode('UTF-8').ascii_only?.should == true end it "returns false for the empty String with a non-ASCII-compatible encoding" do - "".dup.force_encoding('UTF-16LE').ascii_only?.should be_false - "".encode('UTF-16BE').ascii_only?.should be_false + "".dup.force_encoding('UTF-16LE').ascii_only?.should == false + "".encode('UTF-16BE').ascii_only?.should == false end it "returns false for a non-empty String with non-ASCII-compatible encoding" do - "\x78\x00".dup.force_encoding("UTF-16LE").ascii_only?.should be_false + "\x78\x00".dup.force_encoding("UTF-16LE").ascii_only?.should == false end it "returns false when interpolating non ascii strings" do base = "EU currency is".dup.force_encoding(Encoding::US_ASCII) euro = "\u20AC" interp = "#{base} #{euro}" - euro.ascii_only?.should be_false - base.ascii_only?.should be_true - interp.ascii_only?.should be_false + euro.ascii_only?.should == false + base.ascii_only?.should == true + interp.ascii_only?.should == false end it "returns false after appending non ASCII characters to an empty String" do - ("".dup << "λ").ascii_only?.should be_false + ("".dup << "λ").ascii_only?.should == false end it "returns false when concatenating an ASCII and non-ASCII String" do - "".dup.concat("λ").ascii_only?.should be_false + "".dup.concat("λ").ascii_only?.should == false end it "returns false when replacing an ASCII String with a non-ASCII String" do - "".dup.replace("λ").ascii_only?.should be_false + "".dup.replace("λ").ascii_only?.should == false end end |
