Skip to content

Commit

Permalink
switch to truthy and falsey
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Jul 22, 2013
1 parent 4ff52a6 commit eb5bb45
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 132 deletions.
20 changes: 10 additions & 10 deletions features/configuration/custom_settings.feature
Expand Up @@ -15,17 +15,17 @@ Feature: custom settings
end
it "acts false by default" do
RSpec.configuration.custom_setting.should be_false
RSpec.configuration.custom_setting.should be_falsey
end
it "is exposed as a predicate" do
RSpec.configuration.custom_setting?.should be_false
RSpec.configuration.custom_setting?.should be_falsey
end
it "can be overridden" do
RSpec.configuration.custom_setting = true
RSpec.configuration.custom_setting.should be_true
RSpec.configuration.custom_setting?.should be_true
RSpec.configuration.custom_setting.should be_truthy
RSpec.configuration.custom_setting?.should be_truthy
end
end
"""
Expand All @@ -41,17 +41,17 @@ Feature: custom settings
describe "custom setting" do
it "is true by default" do
RSpec.configuration.custom_setting.should be_true
RSpec.configuration.custom_setting.should be_truthy
end
it "is exposed as a predicate" do
RSpec.configuration.custom_setting?.should be_true
RSpec.configuration.custom_setting?.should be_truthy
end
it "can be overridden" do
RSpec.configuration.custom_setting = false
RSpec.configuration.custom_setting.should be_false
RSpec.configuration.custom_setting?.should be_false
RSpec.configuration.custom_setting.should be_falsey
RSpec.configuration.custom_setting?.should be_falsey
end
end
"""
Expand All @@ -71,11 +71,11 @@ Feature: custom settings
describe "custom setting" do
it "returns the value set in the last cofigure block to get eval'd" do
RSpec.configuration.custom_setting.should be_true
RSpec.configuration.custom_setting.should be_truthy
end
it "is exposed as a predicate" do
RSpec.configuration.custom_setting?.should be_true
RSpec.configuration.custom_setting?.should be_truthy
end
end
"""
Expand Down
2 changes: 1 addition & 1 deletion features/configuration/read_options_from_file.feature
Expand Up @@ -66,7 +66,7 @@ Feature: read command line configuration options from files
"""ruby
describe "custom options file" do
it "causes .rspec to be ignored" do
RSpec.configuration.color_enabled.should be_false
RSpec.configuration.color_enabled.should be_falsey
end
end
"""
Expand Down
4 changes: 2 additions & 2 deletions features/example_groups/shared_examples.feature
Expand Up @@ -53,13 +53,13 @@ Feature: shared examples
describe "#include?" do
context "with an an item that is in the collection" do
it "returns true" do
collection.include?(7).should be_true
collection.include?(7).should be_truthy
end
end
context "with an an item that is not in the collection" do
it "returns false" do
collection.include?(9).should be_false
collection.include?(9).should be_falsey
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion features/hooks/around_hooks.feature
Expand Up @@ -192,7 +192,7 @@ Feature: around hooks
end
it "runs the example in the correct context" do
included_in_configure_block.should be_true
included_in_configure_block.should be_truthy
end
end
"""
Expand Down
20 changes: 10 additions & 10 deletions spec/rspec/core/backtrace_cleaner_spec.rb
Expand Up @@ -6,55 +6,55 @@ module RSpec::Core
it "keeps all lines" do
lines = ["/tmp/a_file", "some_random_text", "hello\330\271!"]
cleaner = BacktraceCleaner.new([], [])
expect(lines.all? {|line| cleaner.exclude? line}).to be_false
expect(lines.all? {|line| cleaner.exclude? line}).to be_falsey
end

it 'is considered a full backtrace' do
expect(BacktraceCleaner.new([], []).full_backtrace?).to be_true
expect(BacktraceCleaner.new([], []).full_backtrace?).to be_truthy
end
end

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

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

it 'is considered a partial backtrace' do
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_false
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_falsey
end
end

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

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

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

it 'is considered a partial backtrace' do
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_false
expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_falsey
end
end

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

Expand Down
12 changes: 6 additions & 6 deletions spec/rspec/core/configuration_options_spec.rb
Expand Up @@ -217,15 +217,15 @@

describe "--fail-fast" do
it "defaults to false" do
expect(parse_options[:fail_fast]).to be_false
expect(parse_options[:fail_fast]).to be_falsey
end

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

it "sets fail_fast on config" do
expect(parse_options("--no-fail-fast")[:fail_fast]).to be_false
expect(parse_options("--no-fail-fast")[:fail_fast]).to be_falsey
end
end

Expand Down Expand Up @@ -315,10 +315,10 @@
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--color"}
with_env_vars 'SPEC_OPTS' => "--example 'foo bar'" do
options = parse_options("--drb")
expect(options[:color]).to be_true
expect(options[:color]).to be_truthy
expect(options[:line_numbers]).to eq(["37"])
expect(options[:full_description]).to eq([/foo\ bar/])
expect(options[:drb]).to be_true
expect(options[:drb]).to be_truthy
expect(options[:formatters]).to eq([['global']])
end
end
Expand Down Expand Up @@ -364,7 +364,7 @@
File.open("./custom.opts", "w") {|f| f << "--color"}
options = parse_options("-O", "./custom.opts")
expect(options[:format]).to be_nil
expect(options[:color]).to be_true
expect(options[:color]).to be_truthy
end

it "parses -e 'full spec description'" do
Expand Down

0 comments on commit eb5bb45

Please sign in to comment.