summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/chars_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/chars_spec.rb')
-rw-r--r--spec/ruby/core/string/chars_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/ruby/core/string/chars_spec.rb b/spec/ruby/core/string/chars_spec.rb
index e4f26bc0cc..ee85430574 100644
--- a/spec/ruby/core/string/chars_spec.rb
+++ b/spec/ruby/core/string/chars_spec.rb
@@ -1,5 +1,5 @@
+require_relative "../../spec_helper"
require_relative 'shared/chars'
-require_relative 'shared/each_char_without_block'
describe "String#chars" do
it_behaves_like :string_chars, :chars
@@ -7,4 +7,10 @@ describe "String#chars" do
it "returns an array when no block given" do
"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