Skip to content

Commit f9b0b29

Browse files
nobueregon
authored andcommitted
Prefer should.predicate? over predicate?.should == true
1 parent d394dfd commit f9b0b29

File tree

263 files changed

+922
-922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+922
-922
lines changed

command_line/error_message_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
describe "The error message caused by an exception" do
44
it "is not printed to stdout" do
55
out = ruby_exe("this_does_not_exist", args: "2> #{File::NULL}")
6-
out.chomp.empty?.should == true
6+
out.chomp.should.empty?
77

88
out = ruby_exe("end #syntax error", args: "2> #{File::NULL}")
9-
out.chomp.empty?.should == true
9+
out.chomp.should.empty?
1010
end
1111
end

core/argf/binmode_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
it "sets the file's encoding to BINARY" do
3535
argf [@bin_file, @file1] do
3636
@argf.binmode
37-
@argf.binmode?.should == true
37+
@argf.should.binmode?
3838
@argf.gets.encoding.should == Encoding::BINARY
3939
@argf.skip
4040
@argf.read.encoding.should == Encoding::BINARY

core/array/any_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
describe 'with no block given (a default block of { |x| x } is implicit)' do
55
it "is false if the array is empty" do
66
empty_array = []
7-
empty_array.any?.should == false
7+
empty_array.should_not.any?
88
end
99

1010
it "is false if the array is not empty, but all the members of the array are falsy" do
1111
falsy_array = [false, nil, false]
12-
falsy_array.any?.should == false
12+
falsy_array.should_not.any?
1313
end
1414

1515
it "is true if the array has any truthy members" do
1616
not_empty_array = ['anything', nil]
17-
not_empty_array.any?.should == true
17+
not_empty_array.should.any?
1818
end
1919
end
2020

core/array/clear_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
it "leaves the Array empty" do
1717
a = [1]
1818
a.clear
19-
a.empty?.should == true
19+
a.should.empty?
2020
a.size.should == 0
2121
end
2222

core/array/clone_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
aa = a.clone
1313
bb = b.clone
1414

15-
aa.frozen?.should == true
16-
bb.frozen?.should == false
15+
aa.should.frozen?
16+
bb.should_not.frozen?
1717
end
1818

1919
it "copies singleton methods" do

core/array/empty_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
describe "Array#empty?" do
55
it "returns true if the array has no elements" do
6-
[].empty?.should == true
7-
[1].empty?.should == false
8-
[1, 2].empty?.should == false
6+
[].should.empty?
7+
[1].should_not.empty?
8+
[1, 2].should_not.empty?
99
end
1010
end

core/array/frozen_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
describe "Array#frozen?" do
55
it "returns true if array is frozen" do
66
a = [1, 2, 3]
7-
a.frozen?.should == false
7+
a.should_not.frozen?
88
a.freeze
9-
a.frozen?.should == true
9+
a.should.frozen?
1010
end
1111

1212
it "returns false for an array being sorted by #sort" do
1313
a = [1, 2, 3]
14-
a.sort { |x,y| a.frozen?.should == false; x <=> y }
14+
a.sort { |x,y| a.should_not.frozen?; x <=> y }
1515
end
1616
end

core/array/multiply_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -92,39 +92,39 @@ def obj.to_str() "2" end
9292
it "copies the taint status of the original array even if the passed count is 0" do
9393
ary = [1, 2, 3]
9494
ary.taint
95-
(ary * 0).tainted?.should == true
95+
(ary * 0).should.tainted?
9696
end
9797

9898
it "copies the taint status of the original array even if the array is empty" do
9999
ary = []
100100
ary.taint
101-
(ary * 3).tainted?.should == true
101+
(ary * 3).should.tainted?
102102
end
103103

104104
it "copies the taint status of the original array if the passed count is not 0" do
105105
ary = [1, 2, 3]
106106
ary.taint
107-
(ary * 1).tainted?.should == true
108-
(ary * 2).tainted?.should == true
107+
(ary * 1).should.tainted?
108+
(ary * 2).should.tainted?
109109
end
110110

111111
it "copies the untrusted status of the original array even if the passed count is 0" do
112112
ary = [1, 2, 3]
113113
ary.untrust
114-
(ary * 0).untrusted?.should == true
114+
(ary * 0).should.untrusted?
115115
end
116116

117117
it "copies the untrusted status of the original array even if the array is empty" do
118118
ary = []
119119
ary.untrust
120-
(ary * 3).untrusted?.should == true
120+
(ary * 3).should.untrusted?
121121
end
122122

123123
it "copies the untrusted status of the original array if the passed count is not 0" do
124124
ary = [1, 2, 3]
125125
ary.untrust
126-
(ary * 1).untrusted?.should == true
127-
(ary * 2).untrusted?.should == true
126+
(ary * 1).should.untrusted?
127+
(ary * 2).should.untrusted?
128128
end
129129
end
130130
end

core/array/shared/clone.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
aa = a.send @method
2727
bb = b.send @method
2828

29-
aa.tainted?.should == true
30-
bb.tainted?.should == false
29+
aa.should.tainted?
30+
bb.should_not.tainted?
3131
end
3232

3333
it "copies untrusted status from the original" do
@@ -37,8 +37,8 @@
3737
aa = a.send @method
3838
bb = b.send @method
3939

40-
aa.untrusted?.should == true
41-
bb.untrusted?.should == false
40+
aa.should.untrusted?
41+
bb.should_not.untrusted?
4242
end
4343
end
4444
end

core/array/sort_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
b = ArraySpecs::MockForCompared.new
5959
c = ArraySpecs::MockForCompared.new
6060

61-
ArraySpecs::MockForCompared.compared?.should == false
61+
ArraySpecs::MockForCompared.should_not.compared?
6262
[a, b, c].sort.should == [c, b, a]
63-
ArraySpecs::MockForCompared.compared?.should == true
63+
ArraySpecs::MockForCompared.should.compared?
6464
end
6565

6666
it "does not deal with exceptions raised by unimplemented or incorrect #<=>" do
@@ -104,7 +104,7 @@
104104

105105
it "does not freezes self during being sorted" do
106106
a = [1, 2, 3]
107-
a.sort { |x,y| a.frozen?.should == false; x <=> y }
107+
a.sort { |x,y| a.should_not.frozen?; x <=> y }
108108
end
109109

110110
it "returns the specified value when it would break in the given block" do
@@ -207,9 +207,9 @@ class Bignum
207207
b = ArraySpecs::MockForCompared.new
208208
c = ArraySpecs::MockForCompared.new
209209

210-
ArraySpecs::MockForCompared.compared?.should == false
210+
ArraySpecs::MockForCompared.should_not.compared?
211211
[a, b, c].sort!.should == [c, b, a]
212-
ArraySpecs::MockForCompared.compared?.should == true
212+
ArraySpecs::MockForCompared.should.compared?
213213
end
214214

215215
it "does not call #<=> on contained objects when invoked with a block" do

core/array/uniq_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def obj.eql?(o)
8787
end
8888

8989
a.uniq.should == a
90-
a[0].tainted?.should == true
91-
a[1].tainted?.should == true
90+
a[0].should.tainted?
91+
a[1].should.tainted?
9292

9393
a = Array.new(2) do
9494
obj = mock('0')
@@ -106,8 +106,8 @@ def obj.eql?(o)
106106
end
107107

108108
a.uniq.size.should == 1
109-
a[0].tainted?.should == true
110-
a[1].tainted?.should == true
109+
a[0].should.tainted?
110+
a[1].should.tainted?
111111
end
112112
end
113113

core/class/allocate_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def initialized?
3030
end
3131
end
3232

33-
klass.allocate.initialized?.should == false
33+
klass.allocate.should_not.initialized?
3434
end
3535

3636
it "raises TypeError for #superclass" do

core/class/new_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def initialized?
126126
end
127127
end
128128

129-
klass.new.initialized?.should == true
129+
klass.new.should.initialized?
130130
klass.new(1, 2, 3).args.should == [1, 2, 3]
131131
end
132132

core/complex/finite_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22

33
describe "Complex#finite?" do
44
it "returns true if magnitude is finite" do
5-
(1+1i).finite?.should == true
5+
(1+1i).should.finite?
66
end
77

88
it "returns false for positive infinity" do
99
value = Complex(Float::INFINITY, 42)
10-
value.finite?.should == false
10+
value.should_not.finite?
1111
end
1212

1313
it "returns false for positive complex with infinite imaginary" do
1414
value = Complex(1, Float::INFINITY)
15-
value.finite?.should == false
15+
value.should_not.finite?
1616
end
1717

1818
it "returns false for negative infinity" do
1919
value = -Complex(Float::INFINITY, 42)
20-
value.finite?.should == false
20+
value.should_not.finite?
2121
end
2222

2323
it "returns false for negative complex with infinite imaginary" do
2424
value = -Complex(1, Float::INFINITY)
25-
value.finite?.should == false
25+
value.should_not.finite?
2626
end
2727

2828
it "returns false for NaN" do
2929
value = Complex(Float::NAN, Float::NAN)
30-
value.finite?.should == false
30+
value.should_not.finite?
3131
end
3232
end

core/dir/glob_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
end
120120

121121
it "handles infinite directory wildcards" do
122-
Dir.glob('**/**/**').empty?.should == false
122+
Dir.glob('**/**/**').should_not.empty?
123123
end
124124

125125
it "handles simple filename patterns" do

core/dir/home_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
end
1818

1919
it "returns a non-frozen string" do
20-
Dir.home.frozen?.should == false
20+
Dir.home.should_not.frozen?
2121
end
2222
end
2323

@@ -35,7 +35,7 @@
3535
end
3636

3737
it "returns a non-frozen string" do
38-
Dir.home(ENV['USER']).frozen?.should == false
38+
Dir.home(ENV['USER']).should_not.frozen?
3939
end
4040
end
4141

core/dir/shared/open.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
Dir.send(@method, DirSpecs.mock_dir) do |dir|
6767
io = IO.for_fd(dir.fileno)
6868
io.autoclose = false
69-
io.close_on_exec?.should == true
69+
io.should.close_on_exec?
7070
end
7171
end
7272
end

core/enumerable/all_spec.rb

+15-15
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
end
1111

1212
it "always returns true on empty enumeration" do
13-
@empty.all?.should == true
13+
@empty.should.all?
1414
@empty.all? { nil }.should == true
1515

16-
[].all?.should == true
16+
[].should.all?
1717
[].all? { false }.should == true
1818

19-
{}.all?.should == true
19+
{}.should.all?
2020
{}.all? { nil }.should == true
2121
end
2222

@@ -38,24 +38,24 @@
3838

3939
describe "with no block" do
4040
it "returns true if no elements are false or nil" do
41-
@enum.all?.should == true
42-
@enum1.all?.should == true
43-
@enum2.all?.should == false
41+
@enum.should.all?
42+
@enum1.should.all?
43+
@enum2.should_not.all?
4444

45-
EnumerableSpecs::Numerous.new('a','b','c').all?.should == true
46-
EnumerableSpecs::Numerous.new(0, "x", true).all?.should == true
45+
EnumerableSpecs::Numerous.new('a','b','c').should.all?
46+
EnumerableSpecs::Numerous.new(0, "x", true).should.all?
4747
end
4848

4949
it "returns false if there are false or nil elements" do
50-
EnumerableSpecs::Numerous.new(false).all?.should == false
51-
EnumerableSpecs::Numerous.new(false, false).all?.should == false
50+
EnumerableSpecs::Numerous.new(false).should_not.all?
51+
EnumerableSpecs::Numerous.new(false, false).should_not.all?
5252

53-
EnumerableSpecs::Numerous.new(nil).all?.should == false
54-
EnumerableSpecs::Numerous.new(nil, nil).all?.should == false
53+
EnumerableSpecs::Numerous.new(nil).should_not.all?
54+
EnumerableSpecs::Numerous.new(nil, nil).should_not.all?
5555

56-
EnumerableSpecs::Numerous.new(1, nil, 2).all?.should == false
57-
EnumerableSpecs::Numerous.new(0, "x", false, true).all?.should == false
58-
@enum2.all?.should == false
56+
EnumerableSpecs::Numerous.new(1, nil, 2).should_not.all?
57+
EnumerableSpecs::Numerous.new(0, "x", false, true).should_not.all?
58+
@enum2.should_not.all?
5959
end
6060

6161
it "gathers whole arrays as elements when each yields multiple" do

0 commit comments

Comments
 (0)