Permalink
Browse files

Pending examples without docstring should not autogenerate descriptio…

…ns from previous examples

- Closes #186.
  • Loading branch information...
1 parent 8e550ad commit 468fe48e09e98446f7732e0ad51a58983ee4dd6b @txus txus committed with dchelimsky Oct 12, 2010
Showing with 81 additions and 5 deletions.
  1. +47 −4 features/pending/pending_examples.feature
  2. +1 −1 lib/rspec/core/example.rb
  3. +33 −0 spec/rspec/core/pending_example_spec.rb
@@ -86,12 +86,55 @@ Feature: pending examples
end
end
"""
- When I run "rspec pending_with_xit_spec.rb"
- Then the exit status should be 0
- And the output should contain "1 example, 0 failures, 1 pending"
- And the output should contain:
+ When I run "rspec pending_with_xit_spec.rb"
+ Then the exit status should be 0
+ And the output should contain "1 example, 0 failures, 1 pending"
+ And the output should contain:
"""
Pending:
an example is pending using xit
"""
+ Scenario: example with no docstring and pending method using documentation formatter
+ Given a file named "pending_with_no_docstring_spec.rb" with:
+ """
+ describe "an example" do
+ it "checks something" do
+ (3+4).should == 7
+ end
+ specify do
+ pending
+ end
+ end
+ """
+ When I run "rspec pending_with_no_docstring_spec.rb --format documentation"
+ Then the exit status should be 0
+ And the output should contain "2 examples, 0 failures, 1 pending"
+ And the output should contain:
+ """
+ an example
+ checks something
+ (PENDING: No reason given)
+ """
+
+ Scenario: pending with no docstring using documentation formatter
+ Given a file named "pending_with_no_docstring_spec.rb" with:
+ """
+ describe "an example" do
+ it "checks something" do
+ (3+4).should == 7
+ end
+ pending do
+ "string".reverse.should == "gnirts"
+ end
+ end
+ """
+ When I run "rspec pending_with_no_docstring_spec.rb --format documentation"
+ Then the exit status should be 0
+ And the output should contain "2 examples, 0 failures, 1 pending"
+ And the output should contain:
+ """
+ an example
+ checks something
+ (PENDING: Not Yet Implemented)
+ """
@@ -129,7 +129,7 @@ def run_after_each
end
def assign_auto_description
- if description.empty?
+ if description.empty? and !pending?
metadata[:description] = RSpec::Matchers.generated_description
RSpec::Matchers.clear_generated_description
end
@@ -35,6 +35,39 @@
end
end
+ context "with no docstring" do
+ context "declared with the pending method" do
+ it "does not have an auto-generated description" do
+ group = RSpec::Core::ExampleGroup.describe('group') do
+ it "checks something" do
+ (3+4).should == 7
+ end
+ pending do
+ "string".reverse.should == "gnirts"
+ end
+ end
+ example = group.examples.last
+ example.run(group.new, stub.as_null_object)
+ example.description.should be_empty
+ end
+ end
+ context "after another example with some assertion" do
+ it "does not show any message" do
+ group = RSpec::Core::ExampleGroup.describe('group') do
+ it "checks something" do
+ (3+4).should == 7
+ end
+ specify do
+ pending
+ end
+ end
+ example = group.examples.last
+ example.run(group.new, stub.as_null_object)
+ example.description.should be_empty
+ end
+ end
+ end
+
context "with a message" do
it "is listed as pending with the supplied message" do
group = RSpec::Core::ExampleGroup.describe('group') do

0 comments on commit 468fe48

Please sign in to comment.