Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit eb5bb45

Browse files
committed
switch to truthy and falsey
1 parent 4ff52a6 commit eb5bb45

15 files changed

+132
-132
lines changed

features/configuration/custom_settings.feature

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ Feature: custom settings
1515
end
1616
1717
it "acts false by default" do
18-
RSpec.configuration.custom_setting.should be_false
18+
RSpec.configuration.custom_setting.should be_falsey
1919
end
2020
2121
it "is exposed as a predicate" do
22-
RSpec.configuration.custom_setting?.should be_false
22+
RSpec.configuration.custom_setting?.should be_falsey
2323
end
2424
2525
it "can be overridden" do
2626
RSpec.configuration.custom_setting = true
27-
RSpec.configuration.custom_setting.should be_true
28-
RSpec.configuration.custom_setting?.should be_true
27+
RSpec.configuration.custom_setting.should be_truthy
28+
RSpec.configuration.custom_setting?.should be_truthy
2929
end
3030
end
3131
"""
@@ -41,17 +41,17 @@ Feature: custom settings
4141
4242
describe "custom setting" do
4343
it "is true by default" do
44-
RSpec.configuration.custom_setting.should be_true
44+
RSpec.configuration.custom_setting.should be_truthy
4545
end
4646
4747
it "is exposed as a predicate" do
48-
RSpec.configuration.custom_setting?.should be_true
48+
RSpec.configuration.custom_setting?.should be_truthy
4949
end
5050
5151
it "can be overridden" do
5252
RSpec.configuration.custom_setting = false
53-
RSpec.configuration.custom_setting.should be_false
54-
RSpec.configuration.custom_setting?.should be_false
53+
RSpec.configuration.custom_setting.should be_falsey
54+
RSpec.configuration.custom_setting?.should be_falsey
5555
end
5656
end
5757
"""
@@ -71,11 +71,11 @@ Feature: custom settings
7171
7272
describe "custom setting" do
7373
it "returns the value set in the last cofigure block to get eval'd" do
74-
RSpec.configuration.custom_setting.should be_true
74+
RSpec.configuration.custom_setting.should be_truthy
7575
end
7676
7777
it "is exposed as a predicate" do
78-
RSpec.configuration.custom_setting?.should be_true
78+
RSpec.configuration.custom_setting?.should be_truthy
7979
end
8080
end
8181
"""

features/configuration/read_options_from_file.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Feature: read command line configuration options from files
6666
"""ruby
6767
describe "custom options file" do
6868
it "causes .rspec to be ignored" do
69-
RSpec.configuration.color_enabled.should be_false
69+
RSpec.configuration.color_enabled.should be_falsey
7070
end
7171
end
7272
"""

features/example_groups/shared_examples.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ Feature: shared examples
5353
describe "#include?" do
5454
context "with an an item that is in the collection" do
5555
it "returns true" do
56-
collection.include?(7).should be_true
56+
collection.include?(7).should be_truthy
5757
end
5858
end
5959
6060
context "with an an item that is not in the collection" do
6161
it "returns false" do
62-
collection.include?(9).should be_false
62+
collection.include?(9).should be_falsey
6363
end
6464
end
6565
end

features/hooks/around_hooks.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Feature: around hooks
192192
end
193193
194194
it "runs the example in the correct context" do
195-
included_in_configure_block.should be_true
195+
included_in_configure_block.should be_truthy
196196
end
197197
end
198198
"""

spec/rspec/core/backtrace_cleaner_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,55 @@ module RSpec::Core
66
it "keeps all lines" do
77
lines = ["/tmp/a_file", "some_random_text", "hello\330\271!"]
88
cleaner = BacktraceCleaner.new([], [])
9-
expect(lines.all? {|line| cleaner.exclude? line}).to be_false
9+
expect(lines.all? {|line| cleaner.exclude? line}).to be_falsey
1010
end
1111

1212
it 'is considered a full backtrace' do
13-
expect(BacktraceCleaner.new([], []).full_backtrace?).to be_true
13+
expect(BacktraceCleaner.new([], []).full_backtrace?).to be_truthy
1414
end
1515
end
1616

1717
context "with an exclusion pattern but no inclusion patterns" do
1818
it "excludes lines that match the exclusion pattern" do
1919
cleaner = BacktraceCleaner.new([], [/remove/])
20-
expect(cleaner.exclude? "remove me").to be_true
20+
expect(cleaner.exclude? "remove me").to be_truthy
2121
end
2222

2323
it "keeps lines that do not match the exclusion pattern" do
2424
cleaner = BacktraceCleaner.new([], [/remove/])
25-
expect(cleaner.exclude? "apple").to be_false
25+
expect(cleaner.exclude? "apple").to be_falsey
2626
end
2727

2828
it 'is considered a partial backtrace' do
29-
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_false
29+
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_falsey
3030
end
3131
end
3232

3333
context "with an exclusion pattern and an inclusion pattern" do
3434
it "excludes lines that match the exclusion pattern but not the inclusion pattern" do
3535
cleaner = BacktraceCleaner.new([/keep/], [/discard/])
36-
expect(cleaner.exclude? "discard").to be_true
36+
expect(cleaner.exclude? "discard").to be_truthy
3737
end
3838

3939
it "keeps lines that match the inclusion pattern and the exclusion pattern" do
4040
cleaner = BacktraceCleaner.new([/hi/], [/.*/])
41-
expect(cleaner.exclude? "hi").to be_false
41+
expect(cleaner.exclude? "hi").to be_falsey
4242
end
4343

4444
it "keeps lines that match neither pattern" do
4545
cleaner = BacktraceCleaner.new([/hi/], [/delete/])
46-
expect(cleaner.exclude? "fish").to be_false
46+
expect(cleaner.exclude? "fish").to be_falsey
4747
end
4848

4949
it 'is considered a partial backtrace' do
50-
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_false
50+
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_falsey
5151
end
5252
end
5353

5454
context "with an exclusion pattern that matches the current working directory" do
5555
it "defaults to having one inclusion pattern, the current working directory" do
5656
cleaner = BacktraceCleaner.new(nil, [/.*/])
57-
expect(Dir.getwd =~ cleaner.inclusion_patterns.first).to be_true
57+
expect(Dir.getwd =~ cleaner.inclusion_patterns.first).to be_truthy
5858
end
5959
end
6060

spec/rspec/core/configuration_options_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,15 @@
217217

218218
describe "--fail-fast" do
219219
it "defaults to false" do
220-
expect(parse_options[:fail_fast]).to be_false
220+
expect(parse_options[:fail_fast]).to be_falsey
221221
end
222222

223223
it "sets fail_fast on config" do
224-
expect(parse_options("--fail-fast")[:fail_fast]).to be_true
224+
expect(parse_options("--fail-fast")[:fail_fast]).to be_truthy
225225
end
226226

227227
it "sets fail_fast on config" do
228-
expect(parse_options("--no-fail-fast")[:fail_fast]).to be_false
228+
expect(parse_options("--no-fail-fast")[:fail_fast]).to be_falsey
229229
end
230230
end
231231

@@ -315,10 +315,10 @@
315315
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--color"}
316316
with_env_vars 'SPEC_OPTS' => "--example 'foo bar'" do
317317
options = parse_options("--drb")
318-
expect(options[:color]).to be_true
318+
expect(options[:color]).to be_truthy
319319
expect(options[:line_numbers]).to eq(["37"])
320320
expect(options[:full_description]).to eq([/foo\ bar/])
321-
expect(options[:drb]).to be_true
321+
expect(options[:drb]).to be_truthy
322322
expect(options[:formatters]).to eq([['global']])
323323
end
324324
end
@@ -364,7 +364,7 @@
364364
File.open("./custom.opts", "w") {|f| f << "--color"}
365365
options = parse_options("-O", "./custom.opts")
366366
expect(options[:format]).to be_nil
367-
expect(options[:color]).to be_true
367+
expect(options[:color]).to be_truthy
368368
end
369369

370370
it "parses -e 'full spec description'" do

0 commit comments

Comments
 (0)