Skip to content

Commit

Permalink
Merge pull request #713 from charlietanksley/document-shared-examples…
Browse files Browse the repository at this point in the history
…-with-metadata

document using metadata with shared examples
  • Loading branch information
myronmarston committed Oct 16, 2012
2 parents b765570 + aae43c7 commit 5d28318
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions features/example_groups/shared_examples.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Feature: shared examples
include_examples "name" # include the examples in the current context
it_behaves_like "name" # include the examples in a nested context
it_should_behave_like "name" # include the examples in a nested context
matching metadata # include the examples in the current context

WARNING: Files containing shared groups must be loaded before the files that
use them. While there are conventions to handle this, RSpec does _not_ do
Expand Down Expand Up @@ -202,3 +203,20 @@ Feature: shared examples
has behavior: sortability
responds to <=>
"""

Scenario: Sharing metadata automatically includes shared example groups
Given a file named "shared_example_metadata_spec.rb" with:
"""ruby
shared_examples "shared stuff", :a => :b do
it 'runs wherever the metadata is shared' do
end
end
describe String, :a => :b do
end
"""
When I run `rspec shared_example_metadata_spec.rb`
Then the output should contain:
"""
1 example, 0 failures
"""

0 comments on commit 5d28318

Please sign in to comment.