Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #778 from rspec/rename_config_for_false_positives

Rename config for false positives to `warn_about_potential_false_positives`
  • Loading branch information...
commit 1c191a0984e6502276bcd5e2d1d62069c9759226 2 parents b574ab2 + 4c14be5
@myronmarston myronmarston authored
View
8 lib/rspec/expectations/configuration.rb
@@ -19,7 +19,7 @@ module Expectations
# RSpec::Expectations.configuration
class Configuration
def initialize
- @warn_about_false_positives = true
+ @warn_about_potential_false_positives = true
end
# Configures the supported syntax.
@@ -142,13 +142,13 @@ def self.format_backtrace(backtrace)
# potentially cause false positives in tests.
#
# @param value [Boolean]
- attr_writer :warn_about_false_positives
+ attr_writer :warn_about_potential_false_positives
# Indicates whether RSpec will warn about matcher use which will
# potentially cause false positives in tests, generally you want to
# avoid such scenarios so this defaults to `true`.
- def warn_about_false_positives?
- @warn_about_false_positives
+ def warn_about_potential_false_positives?
+ @warn_about_potential_false_positives
end
end
View
4 lib/rspec/matchers/built_in/raise_error.rb
@@ -12,7 +12,7 @@ def initialize(expected_error_or_message=nil, expected_message=nil, &block)
@block = block
@actual_error = nil
@warn_about_bare_error =
- RSpec::Expectations.configuration.warn_about_false_positives? &&
+ RSpec::Expectations.configuration.warn_about_potential_false_positives? &&
expected_error_or_message.nil?
case expected_error_or_message
@@ -155,7 +155,7 @@ def warn_about_bare_error
"without even executing the method you are intending to call. " \
"Instead consider providing a specific error class or message. " \
"This message can be supressed by setting: " \
- "`RSpec::Expectations.configuration.warn_about_false_positives = false`")
+ "`RSpec::Expectations.configuration.warn_about_potential_false_positives = false`")
end
def expected_error
View
14 spec/rspec/expectations/configuration_spec.rb
@@ -87,20 +87,20 @@ def delegated?; true; end
end
end
- describe "#warn_about_false_positives?" do
+ describe "#warn_about_potential_false_positives?" do
it "is true by default" do
- expect(config.warn_about_false_positives?).to be true
+ expect(config.warn_about_potential_false_positives?).to be true
end
it "can be set to false" do
- config.warn_about_false_positives = false
- expect(config.warn_about_false_positives?).to be false
+ config.warn_about_potential_false_positives = false
+ expect(config.warn_about_potential_false_positives?).to be false
end
it "can be set back to true" do
- config.warn_about_false_positives = false
- config.warn_about_false_positives = true
- expect(config.warn_about_false_positives?).to be true
+ config.warn_about_potential_false_positives = false
+ config.warn_about_potential_false_positives = true
+ expect(config.warn_about_potential_false_positives?).to be true
end
end
View
4 spec/rspec/matchers/built_in/raise_error_spec.rb
@@ -13,8 +13,8 @@
expect { raise }.to raise_error
end
- it "can supresses the warning when configured to do so", :warn_about_false_positives do
- RSpec::Expectations.configuration.warn_about_false_positives = false
+ it "can supresses the warning when configured to do so", :warn_about_potential_false_positives do
+ RSpec::Expectations.configuration.warn_about_potential_false_positives = false
expect_no_warnings
expect { raise }.to raise_error
end
View
6 spec/spec_helper.rb
@@ -98,10 +98,10 @@ def hash_inspect(hash)
end
end
-RSpec.shared_context "with warn_about_false_positives set to false", :warn_about_false_positives do
- original_value = RSpec::Expectations.configuration.warn_about_false_positives?
+RSpec.shared_context "with warn_about_potential_false_positives set to false", :warn_about_potential_false_positives do
+ original_value = RSpec::Expectations.configuration.warn_about_potential_false_positives?
- after(:context) { RSpec::Expectations.configuration.warn_about_false_positives = original_value }
+ after(:context) { RSpec::Expectations.configuration.warn_about_potential_false_positives = original_value }
end
module MinitestIntegration
Please sign in to comment.
Something went wrong with that request. Please try again.