Skip to content

Commit 9dbd781

Browse files
committed
Fix usages of deprecated matchers
1 parent baf5738 commit 9dbd781

8 files changed

Lines changed: 24 additions & 44 deletions

File tree

core/encoding/converter/asciicompat_encoding_spec.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
require_relative '../../../spec_helper'
22

33
describe "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

core/file/sticky_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
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

core/kernel/require_relative_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@
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
@@ -311,9 +311,9 @@
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

language/def_spec.rb

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -306,32 +306,21 @@ def obj.==(other)
306306
describe "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
336325
end
337326

library/datetime/hour_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
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

library/datetime/minute_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
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
4140
end

library/datetime/second_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
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

optional/capi/io_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
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

@@ -221,7 +221,7 @@
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

@@ -237,7 +237,7 @@
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

0 commit comments

Comments
 (0)