rspec-core 2.5.2 → 2.6.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/.travis.yml +7 -0
  2. data/Gemfile +10 -13
  3. data/README.md +4 -1
  4. data/Rakefile +29 -12
  5. data/cucumber.yml +1 -1
  6. data/features/.nav +10 -4
  7. data/features/Autotest.md +31 -7
  8. data/features/Changelog.md +36 -6
  9. data/features/command_line/configure.feature +2 -2
  10. data/features/command_line/example_name_option.feature +10 -10
  11. data/features/command_line/exit_status.feature +4 -4
  12. data/features/command_line/format_option.feature +4 -4
  13. data/features/command_line/line_number_appended_to_path.feature +11 -11
  14. data/features/command_line/line_number_option.feature +2 -2
  15. data/features/command_line/rake_task.feature +3 -3
  16. data/features/command_line/tag.feature +26 -10
  17. data/features/configuration/alias_example_to.feature +48 -0
  18. data/features/configuration/custom_settings.feature +3 -3
  19. data/features/configuration/fail_fast.feature +3 -3
  20. data/features/configuration/read_options_from_file.feature +4 -4
  21. data/features/example_groups/basic_structure.feature +11 -15
  22. data/features/example_groups/shared_context.feature +74 -0
  23. data/features/example_groups/shared_example_group.feature +21 -17
  24. data/features/expectation_framework_integration/configure_expectation_framework.feature +15 -4
  25. data/features/filtering/exclusion_filters.feature +28 -4
  26. data/features/filtering/{implicit_filters.feature → if_and_unless.feature} +9 -7
  27. data/features/filtering/inclusion_filters.feature +26 -3
  28. data/features/filtering/run_all_when_everything_filtered.feature +1 -1
  29. data/features/formatters/custom_formatter.feature +1 -1
  30. data/features/formatters/text_formatter.feature +45 -0
  31. data/features/helper_methods/arbitrary_methods.feature +2 -2
  32. data/features/helper_methods/let.feature +2 -2
  33. data/features/helper_methods/modules.feature +149 -0
  34. data/features/hooks/around_hooks.feature +11 -11
  35. data/features/hooks/before_and_after_hooks.feature +15 -19
  36. data/features/hooks/filtering.feature +160 -124
  37. data/features/metadata/current_example.feature +17 -0
  38. data/features/metadata/described_class.feature +2 -2
  39. data/features/metadata/user_defined.feature +111 -0
  40. data/features/mock_framework_integration/use_any_framework.feature +1 -1
  41. data/features/mock_framework_integration/use_flexmock.feature +83 -10
  42. data/features/mock_framework_integration/use_mocha.feature +84 -10
  43. data/features/mock_framework_integration/use_rr.feature +85 -10
  44. data/features/mock_framework_integration/use_rspec.feature +84 -10
  45. data/features/pending/pending_examples.feature +8 -8
  46. data/features/spec_files/arbitrary_file_suffix.feature +1 -1
  47. data/features/step_definitions/additional_cli_steps.rb +11 -1
  48. data/features/subject/attribute_of_subject.feature +24 -4
  49. data/features/subject/explicit_subject.feature +5 -5
  50. data/features/subject/implicit_receiver.feature +2 -2
  51. data/features/subject/implicit_subject.feature +2 -2
  52. data/features/support/env.rb +6 -1
  53. data/lib/rspec/core.rb +22 -0
  54. data/lib/rspec/core/backward_compatibility.rb +12 -2
  55. data/lib/rspec/core/command_line.rb +1 -4
  56. data/lib/rspec/core/configuration.rb +25 -17
  57. data/lib/rspec/core/configuration_options.rb +6 -23
  58. data/lib/rspec/core/drb_command_line.rb +5 -11
  59. data/lib/rspec/core/example.rb +29 -21
  60. data/lib/rspec/core/example_group.rb +36 -4
  61. data/lib/rspec/core/formatters/base_formatter.rb +6 -0
  62. data/lib/rspec/core/formatters/base_text_formatter.rb +1 -1
  63. data/lib/rspec/core/formatters/helpers.rb +0 -4
  64. data/lib/rspec/core/hooks.rb +14 -4
  65. data/lib/rspec/core/metadata.rb +1 -1
  66. data/lib/rspec/core/metadata_hash_builder.rb +93 -0
  67. data/lib/rspec/core/mocking/with_flexmock.rb +2 -0
  68. data/lib/rspec/core/mocking/with_mocha.rb +2 -0
  69. data/lib/rspec/core/mocking/with_rr.rb +2 -0
  70. data/lib/rspec/core/mocking/with_rspec.rb +3 -1
  71. data/lib/rspec/core/option_parser.rb +5 -2
  72. data/lib/rspec/core/pending.rb +10 -3
  73. data/lib/rspec/core/reporter.rb +2 -2
  74. data/lib/rspec/core/runner.rb +7 -1
  75. data/lib/rspec/core/shared_example_group.rb +18 -4
  76. data/lib/rspec/core/subject.rb +4 -6
  77. data/lib/rspec/core/version.rb +1 -1
  78. data/lib/rspec/core/world.rb +16 -4
  79. data/rspec-core.gemspec +4 -3
  80. data/spec.txt +1126 -0
  81. data/spec/autotest/failed_results_re_spec.rb +2 -2
  82. data/spec/rspec/core/command_line_spec.rb +0 -2
  83. data/spec/rspec/core/configuration_spec.rb +84 -1
  84. data/spec/rspec/core/deprecations_spec.rb +21 -0
  85. data/spec/rspec/core/drb_command_line_spec.rb +3 -11
  86. data/spec/rspec/core/example_group_spec.rb +213 -56
  87. data/spec/rspec/core/example_spec.rb +110 -0
  88. data/spec/rspec/core/formatters/base_formatter_spec.rb +23 -2
  89. data/spec/rspec/core/formatters/base_text_formatter_spec.rb +9 -0
  90. data/spec/rspec/core/formatters/helpers_spec.rb +1 -1
  91. data/spec/rspec/core/formatters/html_formatted-1.8.6.html +5 -5
  92. data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +8 -10
  93. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +5 -5
  94. data/spec/rspec/core/formatters/html_formatted-1.9.1.html +5 -5
  95. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +5 -5
  96. data/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -1
  97. data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +5 -5
  98. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +8 -10
  99. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +5 -5
  100. data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +5 -5
  101. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +5 -5
  102. data/spec/rspec/core/hooks_spec.rb +86 -0
  103. data/spec/rspec/core/metadata_spec.rb +7 -7
  104. data/spec/rspec/core/option_parser_spec.rb +8 -0
  105. data/spec/rspec/core/pending_example_spec.rb +12 -51
  106. data/spec/rspec/core/reporter_spec.rb +19 -3
  107. data/spec/rspec/core/resources/formatter_specs.rb +7 -1
  108. data/spec/rspec/core/rspec_matchers_spec.rb +45 -0
  109. data/spec/rspec/core/runner_spec.rb +35 -10
  110. data/spec/rspec/core/shared_example_group_spec.rb +57 -21
  111. data/spec/rspec/core/subject_spec.rb +32 -11
  112. data/spec/rspec/core/world_spec.rb +38 -15
  113. data/spec/rspec/core_spec.rb +28 -0
  114. data/spec/spec_helper.rb +22 -2
  115. data/spec/support/matchers.rb +44 -13
  116. data/spec/support/shared_example_groups.rb +41 -0
  117. metadata +39 -16
@@ -9,6 +9,10 @@ Feature: configure expectation framework
9
9
  * minitest assertions in ruby 1.9
10
10
  * rspec/expecations _and_ stlib assertions
11
11
 
12
+ Note that when you do not use rspec-expectations, you must explicitly
13
+ provide a description to every example. You cannot rely on the generated
14
+ descriptions provided by rspec-expectations.
15
+
12
16
  Scenario: configure rspec-expectations (explicitly)
13
17
  Given a file named "example_spec.rb" with:
14
18
  """
@@ -22,7 +26,7 @@ Feature: configure expectation framework
22
26
  end
23
27
  end
24
28
  """
25
- When I run "rspec example_spec.rb"
29
+ When I run `rspec example_spec.rb`
26
30
  Then the examples should all pass
27
31
 
28
32
  Scenario: configure test/unit assertions
@@ -36,10 +40,17 @@ Feature: configure expectation framework
36
40
  it "is greater than 4" do
37
41
  assert 5 > 4, "expected 5 to be greater than 4"
38
42
  end
43
+
44
+ specify { assert 5 < 6 }
39
45
  end
40
46
  """
41
- When I run "rspec example_spec.rb"
42
- Then the examples should all pass
47
+ When I run `rspec example_spec.rb`
48
+ Then the output should contain "2 examples, 1 failure"
49
+ And the output should contain:
50
+ """
51
+ NotImplementedError:
52
+ Generated descriptions are only supported when you use rspec-expectations.
53
+ """
43
54
 
44
55
  Scenario: configure rspec/expecations AND test/unit assertions
45
56
  Given a file named "example_spec.rb" with:
@@ -58,5 +69,5 @@ Feature: configure expectation framework
58
69
  end
59
70
  end
60
71
  """
61
- When I run "rspec example_spec.rb"
72
+ When I run `rspec example_spec.rb`
62
73
  Then the examples should all pass
@@ -2,6 +2,9 @@ Feature: exclusion filters
2
2
 
3
3
  You can exclude examples from a run by declaring an exclusion filter and
4
4
  then tagging examples, or entire groups, with that filter.
5
+
6
+ If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
7
+ to `true`, you can specify metadata using only symbols.
5
8
 
6
9
  Scenario: exclude an example
7
10
  Given a file named "spec/sample_spec.rb" with:
@@ -20,7 +23,7 @@ Feature: exclusion filters
20
23
  end
21
24
  end
22
25
  """
23
- When I run "rspec ./spec/sample_spec.rb --format doc"
26
+ When I run `rspec ./spec/sample_spec.rb --format doc`
24
27
  Then the output should contain "does one thing"
25
28
  And the output should not contain "does another thing"
26
29
 
@@ -44,7 +47,7 @@ Feature: exclusion filters
44
47
  end
45
48
  end
46
49
  """
47
- When I run "rspec ./spec/sample_spec.rb --format doc"
50
+ When I run `rspec ./spec/sample_spec.rb --format doc`
48
51
  Then the output should contain "group 2 example 1"
49
52
  And the output should not contain "group 1 example 1"
50
53
  And the output should not contain "group 1 example 2"
@@ -77,7 +80,7 @@ Feature: exclusion filters
77
80
  end
78
81
  end
79
82
  """
80
- When I run "rspec ./spec/sample_spec.rb --format doc"
83
+ When I run `rspec ./spec/sample_spec.rb --format doc`
81
84
  Then the output should match /No examples were matched. Perhaps \{.*:broken=>true.*\} is excluding everything?/
82
85
  And the examples should all pass
83
86
  And the output should not contain "group 1"
@@ -108,8 +111,29 @@ Feature: exclusion filters
108
111
  end
109
112
  end
110
113
  """
111
- When I run "rspec ./spec/before_after_all_exclusion_filter_spec.rb"
114
+ When I run `rspec ./spec/before_after_all_exclusion_filter_spec.rb`
112
115
  Then the output should contain "before all in included group"
113
116
  And the output should contain "after all in included group"
114
117
  And the output should not contain "before all in excluded group"
115
118
  And the output should not contain "after all in excluded group"
119
+
120
+ Scenario: Use symbols as metadata
121
+ Given a file named "symbols_as_metadata_spec.rb" with:
122
+ """
123
+ RSpec.configure do |c|
124
+ c.treat_symbols_as_metadata_keys_with_true_values = true
125
+ c.filter_run_excluding :broken
126
+ end
127
+
128
+ describe "something" do
129
+ it "does one thing" do
130
+ end
131
+
132
+ # tag example for exclusion by adding metadata
133
+ it "does another thing", :broken do
134
+ end
135
+ end
136
+ """
137
+ When I run `rspec symbols_as_metadata_spec.rb --format doc`
138
+ Then the output should contain "does one thing"
139
+ And the output should not contain "does another thing"
@@ -1,4 +1,4 @@
1
- Feature: implicit filters
1
+ Feature: :if and :unless
2
2
 
3
3
  The `:if` and `:unless` metadata keys can be used to filter examples without
4
4
  needing to configure an exclusion filter.
@@ -24,7 +24,7 @@ Feature: implicit filters
24
24
  it("no :if group no :if example") { }
25
25
  end
26
26
  """
27
- When I run "rspec implicit_if_filter_spec.rb --format doc"
27
+ When I run `rspec implicit_if_filter_spec.rb --format doc`
28
28
  Then the output should contain all of these:
29
29
  | :if => true group :if => true example |
30
30
  | :if => true group no :if example |
@@ -58,7 +58,7 @@ Feature: implicit filters
58
58
  it("no :unless group no :unless example") { }
59
59
  end
60
60
  """
61
- When I run "rspec implicit_unless_filter_spec.rb --format doc"
61
+ When I run `rspec implicit_unless_filter_spec.rb --format doc`
62
62
  Then the output should contain all of these:
63
63
  | :unless => true group :unless => false example |
64
64
  | :unless => false group :unless => false example |
@@ -94,7 +94,7 @@ Feature: implicit filters
94
94
  it("unfocused :unless => false example", :unless => false) { }
95
95
  end
96
96
  """
97
- When I run "rspec explicit_inclusion_filter_spec.rb --format doc"
97
+ When I run `rspec explicit_inclusion_filter_spec.rb --format doc`
98
98
  Then the output should contain all of these:
99
99
  | focused example |
100
100
  | focused :if => true example |
@@ -127,7 +127,7 @@ Feature: implicit filters
127
127
  it("excluded :unless => false example", :unless => false) { }
128
128
  end
129
129
  """
130
- When I run "rspec explicit_exclusion_filter_spec.rb --format doc"
130
+ When I run `rspec explicit_exclusion_filter_spec.rb --format doc`
131
131
  Then the output should contain all of these:
132
132
  | included example |
133
133
  | included :if => true example |
@@ -156,11 +156,13 @@ Feature: implicit filters
156
156
  it(":unless => :exclude_me_for_unless example", :unless => :exclude_me_for_unless) { }
157
157
  end
158
158
  """
159
- When I run "rspec override_implicit_filters_spec.rb --format doc"
159
+ When I run `rspec override_implicit_filters_spec.rb --format doc`
160
160
  Then the output should contain all of these:
161
161
  | :if => true example |
162
162
  | :if => false example |
163
163
  | :unless => true example |
164
164
  | :unless => false example |
165
- And the output should not contain "exclude_me"
165
+ And the output should not contain any of these:
166
+ | :if => :exclude_me example |
167
+ | :unless => :exclude_me_for_unless example |
166
168
 
@@ -4,6 +4,9 @@ Feature: inclusion filters
4
4
  most common use case is to focus on a subset of examples as you're focused on
5
5
  a particular problem.
6
6
 
7
+ If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
8
+ to `true`, you can specify metadata using only symbols.
9
+
7
10
  Background:
8
11
  Given a file named "spec/spec_helper.rb" with:
9
12
  """
@@ -26,7 +29,7 @@ Feature: inclusion filters
26
29
  end
27
30
  end
28
31
  """
29
- When I run "rspec spec/sample_spec.rb --format doc"
32
+ When I run `rspec spec/sample_spec.rb --format doc`
30
33
  Then the output should contain "does another thing"
31
34
  And the output should not contain "does one thing"
32
35
 
@@ -48,7 +51,7 @@ Feature: inclusion filters
48
51
  end
49
52
  end
50
53
  """
51
- When I run "rspec spec/sample_spec.rb --format doc"
54
+ When I run `rspec spec/sample_spec.rb --format doc`
52
55
  Then the output should contain "group 1 example 1"
53
56
  And the output should contain "group 1 example 2"
54
57
  And the output should not contain "group 2 example 1"
@@ -76,8 +79,28 @@ Feature: inclusion filters
76
79
  end
77
80
  end
78
81
  """
79
- When I run "rspec ./spec/before_after_all_inclusion_filter_spec.rb"
82
+ When I run `rspec ./spec/before_after_all_inclusion_filter_spec.rb`
80
83
  Then the output should contain "before all in focused group"
81
84
  And the output should contain "after all in focused group"
82
85
  And the output should not contain "before all in unfocused group"
83
86
  And the output should not contain "after all in unfocused group"
87
+
88
+ Scenario: Use symbols as metadata
89
+ Given a file named "symbols_as_metadata_spec.rb" with:
90
+ """
91
+ RSpec.configure do |c|
92
+ c.treat_symbols_as_metadata_keys_with_true_values = true
93
+ c.filter_run :current_example
94
+ end
95
+
96
+ describe "something" do
97
+ it "does one thing" do
98
+ end
99
+
100
+ it "does another thing", :current_example do
101
+ end
102
+ end
103
+ """
104
+ When I run `rspec symbols_as_metadata_spec.rb --format doc`
105
+ Then the output should contain "does another thing"
106
+ And the output should not contain "does one thing"
@@ -31,7 +31,7 @@ Feature: run all when everything filtered
31
31
  end
32
32
  end
33
33
  """
34
- When I run "rspec spec/sample_spec.rb --format doc"
34
+ When I run `rspec spec/sample_spec.rb --format doc`
35
35
  Then the output should contain "No examples were matched by {:focus=>true}, running all"
36
36
  And the examples should all pass
37
37
  And the output should contain:
@@ -31,6 +31,6 @@ Feature: custom formatters
31
31
  end
32
32
  end
33
33
  """
34
- When I run "rspec example_spec.rb --require ./custom_formatter.rb --format CustomFormatter"
34
+ When I run `rspec example_spec.rb --require ./custom_formatter.rb --format CustomFormatter`
35
35
  Then the output should contain "example: my example"
36
36
  And the exit status should be 0
@@ -0,0 +1,45 @@
1
+ Feature: text formatter
2
+
3
+ In order to easily see the result of running my specs
4
+ As an RSpec user
5
+ I want clear, concise, well-formatted output
6
+
7
+ Scenario: Backtrace formatting for failing specs in multiple files
8
+ Given a file named "string_spec.rb" with:
9
+ """
10
+ require 'rspec/core'
11
+
12
+ describe String do
13
+ it "has a failing example" do
14
+ "foo".reverse.should == "ofo"
15
+ end
16
+ end
17
+ """
18
+ And a file named "integer_spec.rb" with:
19
+ """
20
+ require 'rspec/core'
21
+
22
+ describe Integer do
23
+ it "has a failing example" do
24
+ (7 + 5).should == 11
25
+ end
26
+ end
27
+ """
28
+ When I run `ruby ./integer_spec.rb ./string_spec.rb`
29
+ Then the backtrace-normalized output should contain:
30
+ """
31
+ Failures:
32
+
33
+ 1) Integer has a failing example
34
+ Failure/Error: (7 + 5).should == 11
35
+ expected: 11
36
+ got: 12 (using ==)
37
+ # ./integer_spec.rb:5
38
+
39
+ 2) String has a failing example
40
+ Failure/Error: "foo".reverse.should == "ofo"
41
+ expected: "ofo"
42
+ got: "oof" (using ==)
43
+ # ./string_spec.rb:5
44
+ """
45
+
@@ -18,7 +18,7 @@ Feature: arbitrary helper methods
18
18
  end
19
19
  end
20
20
  """
21
- When I run "rspec example_spec.rb"
21
+ When I run `rspec example_spec.rb`
22
22
  Then the examples should all pass
23
23
 
24
24
  Scenario: use a method defined in a parent group
@@ -36,5 +36,5 @@ Feature: arbitrary helper methods
36
36
  end
37
37
  end
38
38
  """
39
- When I run "rspec example_spec.rb"
39
+ When I run `rspec example_spec.rb`
40
40
  Then the examples should all pass
@@ -24,7 +24,7 @@ Feature: let and let!
24
24
  end
25
25
  end
26
26
  """
27
- When I run "rspec let_spec.rb"
27
+ When I run `rspec let_spec.rb`
28
28
  Then the examples should all pass
29
29
 
30
30
  Scenario: use let! to define a memoized helper method that is called in a before hook
@@ -46,5 +46,5 @@ Feature: let and let!
46
46
  end
47
47
  end
48
48
  """
49
- When I run "rspec let_bang_spec.rb"
49
+ When I run `rspec let_bang_spec.rb`
50
50
  Then the examples should all pass
@@ -0,0 +1,149 @@
1
+ Feature: Define helper methods in a module
2
+
3
+ You can define helper methods in a module and include it in
4
+ your example groups using the `config.include` configuration
5
+ option. `config.extend` can be used to extend the module onto
6
+ your example groups so that the methods in the module are available
7
+ in the example groups themselves (but not in the actual examples).
8
+
9
+ You can also include or extend the module onto only certain example
10
+ groups by passing a metadata hash as the last argument. Only groups
11
+ that match the given metadata will include or extend the module.
12
+
13
+ If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
14
+ to `true`, you can specify metadata using only symbols.
15
+
16
+ Background:
17
+ Given a file named "helpers.rb" with:
18
+ """
19
+ module Helpers
20
+ def help
21
+ :available
22
+ end
23
+ end
24
+ """
25
+
26
+ Scenario: include a module in all example groups
27
+ Given a file named "include_module_spec.rb" with:
28
+ """
29
+ require './helpers'
30
+
31
+ RSpec.configure do |c|
32
+ c.include Helpers
33
+ end
34
+
35
+ describe "an example group" do
36
+ it "has access the helper methods defined in the module" do
37
+ help.should be(:available)
38
+ end
39
+ end
40
+ """
41
+ When I run `rspec include_module_spec.rb`
42
+ Then the examples should all pass
43
+
44
+ Scenario: extend a module in all example groups
45
+ Given a file named "extend_module_spec.rb" with:
46
+ """
47
+ require './helpers'
48
+
49
+ RSpec.configure do |c|
50
+ c.extend Helpers
51
+ end
52
+
53
+ describe "an example group" do
54
+ puts "Help is #{help}"
55
+
56
+ it "does not have access to the helper methods defined in the module" do
57
+ expect { help }.to raise_error(NameError)
58
+ end
59
+ end
60
+ """
61
+ When I run `rspec extend_module_spec.rb`
62
+ Then the examples should all pass
63
+ And the output should contain "Help is available"
64
+
65
+ Scenario: include a module in only some example groups
66
+ Given a file named "include_module_in_some_groups_spec.rb" with:
67
+ """
68
+ require './helpers'
69
+
70
+ RSpec.configure do |c|
71
+ c.include Helpers, :foo => :bar
72
+ end
73
+
74
+ describe "an example group with matching metadata", :foo => :bar do
75
+ it "has access the helper methods defined in the module" do
76
+ help.should be(:available)
77
+ end
78
+ end
79
+
80
+ describe "an example group without matching metadata" do
81
+ it "does not have access to the helper methods defined in the module" do
82
+ expect { help }.to raise_error(NameError)
83
+ end
84
+ end
85
+ """
86
+ When I run `rspec include_module_in_some_groups_spec.rb`
87
+ Then the examples should all pass
88
+
89
+ Scenario: extend a module in only some example groups
90
+ Given a file named "extend_module_in_only_some_groups_spec.rb" with:
91
+ """
92
+ require './helpers'
93
+
94
+ RSpec.configure do |c|
95
+ c.extend Helpers, :foo => :bar
96
+ end
97
+
98
+ describe "an example group with matching metadata", :foo => :bar do
99
+ puts "In a matching group, help is #{help}"
100
+
101
+ it "does not have access to the helper methods defined in the module" do
102
+ expect { help }.to raise_error(NameError)
103
+ end
104
+ end
105
+
106
+ describe "an example group without matching metadata" do
107
+ puts "In a non-matching group, help is #{help rescue 'not available'}"
108
+
109
+ it "does not have access to the helper methods defined in the module" do
110
+ expect { help }.to raise_error(NameError)
111
+ end
112
+ end
113
+ """
114
+ When I run `rspec extend_module_in_only_some_groups_spec.rb`
115
+ Then the examples should all pass
116
+ And the output should contain "In a matching group, help is available"
117
+ And the output should contain "In a non-matching group, help is not available"
118
+
119
+ Scenario: use symbols as metadata
120
+ Given a file named "symbols_as_metadata_spec.rb" with:
121
+ """
122
+ require './helpers'
123
+
124
+ RSpec.configure do |c|
125
+ c.treat_symbols_as_metadata_keys_with_true_values = true
126
+ c.include Helpers, :include_helpers
127
+ c.extend Helpers, :extend_helpers
128
+ end
129
+
130
+ describe "an example group with matching include metadata", :include_helpers do
131
+ puts "In a group not matching the extend filter, help is #{help rescue 'not available'}"
132
+
133
+ it "has access the helper methods defined in the module" do
134
+ help.should be(:available)
135
+ end
136
+ end
137
+
138
+ describe "an example group with matching extend metadata", :extend_helpers do
139
+ puts "In a group matching the extend filter, help is #{help}"
140
+
141
+ it "does not have access to the helper methods defined in the module" do
142
+ expect { help }.to raise_error(NameError)
143
+ end
144
+ end
145
+ """
146
+ When I run `rspec symbols_as_metadata_spec.rb`
147
+ Then the examples should all pass
148
+ And the output should contain "In a group not matching the extend filter, help is not available"
149
+ And the output should contain "In a group matching the extend filter, help is available"