diff options
Diffstat (limited to 'spec/ruby/core/string/chars_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/chars_spec.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/spec/ruby/core/string/chars_spec.rb b/spec/ruby/core/string/chars_spec.rb index 75cef89be1..ee85430574 100644 --- a/spec/ruby/core/string/chars_spec.rb +++ b/spec/ruby/core/string/chars_spec.rb @@ -1,11 +1,16 @@ -require File.expand_path('../shared/chars', __FILE__) -require File.expand_path('../shared/each_char_without_block', __FILE__) +require_relative "../../spec_helper" +require_relative 'shared/chars' describe "String#chars" do - it_behaves_like(:string_chars, :chars) + it_behaves_like :string_chars, :chars it "returns an array when no block given" do - ary = "hello".send(@method) - ary.should == ['h', 'e', 'l', 'l', 'o'] + "hello".chars.should == ['h', 'e', 'l', 'l', 'o'] + end + + it "returns Strings in the same encoding as self" do + "hello".encode("US-ASCII").chars.each do |c| + c.encoding.should == Encoding::US_ASCII + end end end |
