Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make indicative docstrings conditional on setting

  • Loading branch information...
commit 70721997a4e622c8573f35facd0be347e4cdf411 1 parent 324de00
@rentalcustard authored
View
4 features/custom_matchers/define_matcher.feature
@@ -8,6 +8,7 @@ Feature: define matcher
Given a file named "matcher_with_default_message_spec.rb" with:
"""
require 'rspec/expectations'
+ RSpec.configuration.generated_docstring_format = :indicative
RSpec::Matchers.define :be_a_multiple_of do |expected|
match do |actual|
@@ -98,6 +99,7 @@ Feature: define matcher
Given a file named "matcher_overriding_description_spec.rb" with:
"""
require 'rspec/expectations'
+ RSpec.configuration.generated_docstring_format = :indicative
RSpec::Matchers.define :be_a_multiple_of do |expected|
match do |actual|
@@ -129,6 +131,7 @@ Feature: define matcher
Given a file named "matcher_with_no_args_spec.rb" with:
"""
require 'rspec/expectations'
+ RSpec.configuration.generated_docstring_format = :indicative
RSpec::Matchers.define :have_7_fingers do
match do |thing|
@@ -153,6 +156,7 @@ Feature: define matcher
Given a file named "matcher_with_multiple_args_spec.rb" with:
"""
require 'rspec/expectations'
+ RSpec.configuration.generated_docstring_format = :indicative
RSpec::Matchers.define :be_the_sum_of do |a,b,c,d|
match do |sum|
View
4 features/custom_matchers/define_matcher_with_fluent_interface.feature
@@ -5,6 +5,10 @@ Feature: define matcher with fluent interface
Scenario: chained method with argumetn
Given a file named "between_spec.rb" with:
"""
+ require 'rspec/expectations'
+
+ RSpec.configuration.generated_docstring_format = :indicative
+
RSpec::Matchers.define :be_bigger_than do |first|
match do |actual|
(actual > first) && (actual < @second)
View
2  features/implicit_docstrings.feature
@@ -21,7 +21,7 @@ Feature: implicit docstrings
When I run `rspec ./implicit_docstrings_spec.rb -fdoc`
Then the output should contain "should be < 5"
- And the output should contain "should be 2"
+ And the output should contain "should include 2"
And the output should contain "should respond to #size"
Scenario: run failing examples
View
2  lib/rspec/matchers/generated_descriptions.rb
@@ -28,7 +28,7 @@ def self.docstring(negative=false)
end
def self.last_description(negative=false)
- if doc = docstring(negative)
+ if RSpec.configuration.generated_docstring_format == :indicative && doc = docstring(negative)
doc
else
last_matcher.respond_to?(:description) ? "#{last_should.to_s.sub("_", " ")} #{last_matcher.description}" : <<-MESSAGE
Please sign in to comment.
Something went wrong with that request. Please try again.