File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11require_relative '../../../spec_helper'
22
33describe "Encoding::Converter.asciicompat_encoding" do
4- it "accepts an encoding name as a String argument" do
5- -> { Encoding ::Converter . asciicompat_encoding ( 'UTF-8' ) } .
6- should_not raise_error
7- end
8-
94 it "coerces non-String/Encoding objects with #to_str" do
105 str = mock ( 'string' )
116 str . should_receive ( :to_str ) . at_least ( 1 ) . times . and_return ( 'string' )
127 Encoding ::Converter . asciicompat_encoding ( str )
138 end
149
1510 it "accepts an Encoding object as an argument" do
16- Encoding ::Converter .
17- asciicompat_encoding ( Encoding . find ( "ISO-2022-JP" ) ) .
18- should == Encoding ::Converter . asciicompat_encoding ( "ISO-2022-JP" )
11+ Encoding ::Converter . asciicompat_encoding ( Encoding . find ( "ISO-2022-JP" ) ) . should ==
12+ Encoding ::Converter . asciicompat_encoding ( "ISO-2022-JP" )
1913 end
2014
2115 it "returns a corresponding ASCII compatible encoding for ASCII-incompatible encodings" do
Original file line number Diff line number Diff line change 4141 touch ( filename )
4242 stat = File . stat ( filename )
4343 mode = stat . mode
44- raise_error ( Errno :: EFTYPE ) { File . chmod ( mode |01000 , filename ) }
44+ -> { File . chmod ( mode |01000 , filename ) } . should . raise ( Errno :: EFTYPE )
4545 File . sticky? ( filename ) . should == false
4646
4747 rm_r filename
Original file line number Diff line number Diff line change 109109
110110 -> {
111111 require_relative ( path )
112- } . should ( raise_error ( LoadError ) { |e |
112+ } . should . raise ( LoadError ) { |e |
113113 e . path . should == File . expand_path ( path , @abs_dir )
114- } )
114+ }
115115 end
116116
117117 it "calls #to_str on non-String objects" do
311311
312312 -> {
313313 require_relative ( path )
314- } . should ( raise_error ( LoadError ) { |e |
314+ } . should . raise ( LoadError ) { |e |
315315 e . path . should == File . expand_path ( path , @abs_dir )
316- } )
316+ }
317317 end
318318
319319 it "calls #to_str on non-String objects" do
Original file line number Diff line number Diff line change @@ -306,32 +306,21 @@ def obj.==(other)
306306describe "Redefining a singleton method" do
307307 it "does not inherit a previously set visibility" do
308308 o = Object . new
309+ sc = o . singleton_class
309310
310- class << o ; private ; def foo ; end ; end ;
311-
312- class << o ; should have_private_instance_method ( :foo ) ; end
313-
314- class << o ; def foo ; end ; end ;
315-
316- class << o ; should_not have_private_instance_method ( :foo ) ; end
317- class << o ; should have_instance_method ( :foo ) ; end
318-
319- end
320- end
321-
322- describe "Redefining a singleton method" do
323- it "does not inherit a previously set visibility" do
324- o = Object . new
325-
326- class << o ; private ; def foo ; end ; end ;
327-
328- class << o ; should have_private_instance_method ( :foo ) ; end
311+ class << o
312+ private
313+ def foo ; end
314+ end
329315
330- class << o ; def foo ; end ; end ;
316+ sc . private_instance_methods ( false ) . should . include? ( : foo)
331317
332- class << o ; should_not have_private_instance_method ( :foo ) ; end
333- class << o ; should have_instance_method ( :foo ) ; end
318+ class << o
319+ def foo ; end
320+ end
334321
322+ sc . private_instance_methods ( false ) . should_not . include? ( :foo )
323+ sc . should . method_defined? ( :foo )
335324 end
336325end
337326
Original file line number Diff line number Diff line change 3535 end
3636
3737 it "raises an error for hour fractions smaller than -24" do
38- -> { new_datetime ( hour : -24 - Rational ( 1 , 2 ) ) } . should (
39- raise_error ( ArgumentError ) )
38+ -> { new_datetime ( hour : -24 - Rational ( 1 , 2 ) ) } . should . raise ( ArgumentError )
4039 end
4140
4241 it "adds 1 to day, when 24 hours given" do
Original file line number Diff line number Diff line change 3535 end
3636
3737 it "raises an error for minute fractions smaller than -60" do
38- -> { new_datetime ( minute : -60 - Rational ( 1 , 2 ) ) } . should (
39- raise_error ( ArgumentError ) )
38+ -> { new_datetime ( minute : -60 - Rational ( 1 , 2 ) ) } . should . raise ( ArgumentError )
4039 end
4140end
Original file line number Diff line number Diff line change 3636 end
3737
3838 it "raises an error for second fractions smaller than -60" do
39- -> { new_datetime ( second : -60 - Rational ( 1 , 2 ) ) } . should (
40- raise_error ( ArgumentError ) )
39+ -> { new_datetime ( second : -60 - Rational ( 1 , 2 ) ) } . should . raise ( ArgumentError )
4140 end
4241
4342 it "takes a second fraction near 60" do
Original file line number Diff line number Diff line change 142142
143143 describe "rb_io_check_closed" do
144144 it "does not raise an exception if the IO is not closed" do
145- # The MRI function is void, so we use should_not raise_error
145+ # The MRI function is void, so we use should_not.raise
146146 -> { @o . rb_io_check_closed ( @io ) } . should_not . raise
147147 end
148148
221221
222222 describe "rb_io_check_readable" do
223223 it "does not raise an exception if the IO is opened for reading" do
224- # The MRI function is void, so we use should_not raise_error
224+ # The MRI function is void, so we use should_not.raise
225225 -> { @o . rb_io_check_readable ( @r_io ) } . should_not . raise
226226 end
227227
237237
238238 describe "rb_io_check_writable" do
239239 it "does not raise an exception if the IO is opened for writing" do
240- # The MRI function is void, so we use should_not raise_error
240+ # The MRI function is void, so we use should_not.raise
241241 -> { @o . rb_io_check_writable ( @w_io ) } . should_not . raise
242242 end
243243
You can’t perform that action at this time.
0 commit comments