File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
spec/ruby/library/stringio Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 183
183
@io . string . should == ""
184
184
end
185
185
end
186
+
187
+ describe "StringIO#initialize sets the encoding to" do
188
+ before :each do
189
+ @external = Encoding . default_external
190
+ Encoding . default_external = Encoding ::ISO_8859_2
191
+ end
192
+
193
+ after :each do
194
+ Encoding . default_external = @external
195
+ end
196
+
197
+ it "Encoding.default_external when passed no arguments" do
198
+ io = StringIO . new
199
+ io . external_encoding . should == Encoding ::ISO_8859_2
200
+ io . string . encoding . should == Encoding ::ISO_8859_2
201
+ end
202
+
203
+ it "the same as the encoding of the String when passed a String" do
204
+ s = '' . force_encoding ( Encoding ::EUC_JP )
205
+ io = StringIO . new ( s )
206
+ io . external_encoding . should == Encoding ::EUC_JP
207
+ io . string . encoding . should == Encoding ::EUC_JP
208
+ end
209
+ end
You can’t perform that action at this time.
0 commit comments