Permalink
Browse files

Merge pull request #713 from charlietanksley/document-shared-examples…

…-with-metadata

document using metadata with shared examples
  • Loading branch information...
2 parents b765570 + aae43c7 commit 5d28318b51bf212c215ba1392fb24cc5a52dbe06 @myronmarston myronmarston committed Oct 16, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 features/example_groups/shared_examples.feature
@@ -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
@@ -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.