Skip to content

Commit

Permalink
Change the expectation for predicate methods
Browse files Browse the repository at this point in the history
Predicate methods typically return true or false, and should only exist
for the uncountable and discrete, e.g. `use_transactional_fixtures?`,
but not `max_formatted_output_length?`.

This relates to changes made in rspec/rspec-core#2736
  • Loading branch information
pirj committed Jun 7, 2020
1 parent 71c4364 commit 5e0f3ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/rspec/rails/configuration_spec.rb
Expand Up @@ -23,13 +23,18 @@
opts ||= {}
default_value = opts[:default]
alias_setting = opts[:alias_with]
query_method = "#{accessor}?".to_sym
query_method = accessor
predicate_method = "#{accessor}?".to_sym
command_method = "#{accessor}=".to_sym

specify "`##{query_method}` is `#{default_value.inspect}` by default" do
expect(config.send(query_method)).to be(default_value)
end

specify "`##{predicate_method}` is `#{!!default_value}` by default" do
expect(config.send(predicate_method)).to be(!!default_value)
end

describe "`##{command_method}`" do
it "changes `#{query_method}` to the provided value" do
expect {
Expand Down

0 comments on commit 5e0f3ca

Please sign in to comment.