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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 8 additions & 8 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 5 additions & 5 deletions
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

0 commit comments

Comments
 (0)