rspec-core 2.5.2 → 2.6.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -21,7 +21,7 @@ Feature: --line_number option
21
21
 
22
22
  end
23
23
  """
24
- When I run "rspec example_spec.rb --line_number 5 --format doc"
24
+ When I run `rspec example_spec.rb --line_number 5 --format doc`
25
25
  Then the examples should all pass
26
26
  Then the output should contain "should be > 8"
27
27
  But the output should not contain "should be < 10"
@@ -39,7 +39,7 @@ Feature: --line_number option
39
39
 
40
40
  end
41
41
  """
42
- When I run "rspec example_spec.rb --line_number 5 --format doc"
42
+ When I run `rspec example_spec.rb --line_number 5 --format doc`
43
43
  Then the examples should all pass
44
44
  Then the output should contain "should be > 8"
45
45
  But the output should not contain "should be < 10"
@@ -19,7 +19,7 @@ Feature: rake task
19
19
  end
20
20
  end
21
21
  """
22
- When I run "rake"
22
+ When I run `rake`
23
23
  Then the stderr should contain "ruby -S rspec"
24
24
  Then the exit status should be 0
25
25
 
@@ -40,7 +40,7 @@ Feature: rake task
40
40
  end
41
41
  end
42
42
  """
43
- When I run "rake"
43
+ When I run `rake`
44
44
  Then the exit status should be 1
45
45
 
46
46
  Scenario: fail_on_error = false with failing spec (exit status is 0)
@@ -62,7 +62,7 @@ Feature: rake task
62
62
  end
63
63
  end
64
64
  """
65
- When I run "rake"
65
+ When I run `rake`
66
66
  Then the exit status should be 0
67
67
 
68
68
 
@@ -19,7 +19,8 @@ Feature: --tag option
19
19
  """
20
20
  describe "group with tagged specs" do
21
21
  it "example I'm working now", :focus => true do; end
22
- it "special example", :type => 'special' do; end
22
+ it "special example with string", :type => 'special' do; end
23
+ it "special example with symbol", :type => :special do; end
23
24
  it "slow example", :skip => true do; end
24
25
  it "ordinary example", :speed => 'slow' do; end
25
26
  it "untagged example" do; end
@@ -27,29 +28,30 @@ Feature: --tag option
27
28
  """
28
29
 
29
30
  Scenario: filter examples with non-existent tag
30
- When I run "rspec . --tag mytag"
31
+ When I run `rspec . --tag mytag`
31
32
  And the examples should all pass
32
33
 
33
34
  Scenario: filter examples with a simple tag
34
- When I run "rspec . --tag focus"
35
+ When I run `rspec . --tag focus`
35
36
  Then the output should contain "Run filtered using {:focus=>true}"
36
37
  And the examples should all pass
37
38
 
38
39
  Scenario: filter examples with a simple tag and @
39
- When I run "rspec . --tag @focus"
40
+ When I run `rspec . --tag @focus`
40
41
  Then the output should contain "Run filtered using {:focus=>true}"
41
42
  Then the examples should all pass
42
43
 
43
44
  Scenario: filter examples with a name:value tag
44
- When I run "rspec . --tag type:special"
45
+ When I run `rspec . --tag type:special`
45
46
  Then the output should contain:
46
47
  """
47
48
  Run filtered using {:type=>"special"}
48
49
  """
50
+ And the output should contain "2 examples"
49
51
  And the examples should all pass
50
52
 
51
53
  Scenario: filter examples with a name:value tag and @
52
- When I run "rspec . --tag @type:special"
54
+ When I run `rspec . --tag @type:special`
53
55
  Then the output should contain:
54
56
  """
55
57
  Run filtered using {:type=>"special"}
@@ -57,18 +59,32 @@ Feature: --tag option
57
59
  And the examples should all pass
58
60
 
59
61
  Scenario: exclude examples with a simple tag
60
- When I run "rspec . --tag ~skip"
62
+ When I run `rspec . --tag ~skip`
63
+ Then the output should contain "Run filtered excluding {:skip=>true}"
61
64
  Then the examples should all pass
62
65
 
63
66
  Scenario: exclude examples with a simple tag and @
64
- When I run "rspec . --tag ~@skip"
67
+ When I run `rspec . --tag ~@skip`
68
+ Then the output should contain "Run filtered excluding {:skip=>true}"
65
69
  Then the examples should all pass
66
70
 
67
71
  Scenario: exclude examples with a name:value tag
68
- When I run "rspec . --tag ~speed:slow"
72
+ When I run `rspec . --tag ~speed:slow`
73
+ Then the output should contain:
74
+ """
75
+ Run filtered excluding {:speed=>"slow"}
76
+ """
69
77
  Then the examples should all pass
70
78
 
71
79
  Scenario: exclude examples with a name:value tag and @
72
- When I run "rspec . --tag ~@speed:slow"
80
+ When I run `rspec . --tag ~@speed:slow`
81
+ Then the output should contain:
82
+ """
83
+ Run filtered excluding {:speed=>"slow"}
84
+ """
73
85
  Then the examples should all pass
74
86
 
87
+ Scenario: filter examples with a simple tag, exclude examples with another tag
88
+ When I run `rspec . --tag focus --tag ~skip`
89
+ Then the output should contain "Run filtered using {:focus=>true}, excluding {:skip=>true}"
90
+ And the examples should all pass
@@ -0,0 +1,48 @@
1
+ Feature: alias_example_to
2
+
3
+ Use `config.alias_example_to` to create new example group methods
4
+ that define examples with the configured metadata.
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.
8
+
9
+ Scenario: Use alias_example_to to define focused example
10
+ Given a file named "alias_example_to_spec.rb" with:
11
+ """
12
+ RSpec.configure do |c|
13
+ c.alias_example_to :fit, :focused => true
14
+ c.filter_run :focused => true
15
+ end
16
+
17
+ describe "an example group" do
18
+ it "does one thing" do
19
+ end
20
+
21
+ fit "does another thing" do
22
+ end
23
+ end
24
+ """
25
+ When I run `rspec alias_example_to_spec.rb --format doc`
26
+ Then the output should contain "does another thing"
27
+ And the output should not contain "does one thing"
28
+
29
+ Scenario: use symbols as metadata
30
+ Given a file named "use_symbols_as_metadata_spec.rb" with:
31
+ """
32
+ RSpec.configure do |c|
33
+ c.treat_symbols_as_metadata_keys_with_true_values = true
34
+ c.alias_example_to :fit, :focused
35
+ c.filter_run :focused
36
+ end
37
+
38
+ describe "an example group" do
39
+ it "does one thing" do
40
+ end
41
+
42
+ fit "does another thing" do
43
+ end
44
+ end
45
+ """
46
+ When I run `rspec use_symbols_as_metadata_spec.rb --format doc`
47
+ Then the output should contain "does another thing"
48
+ And the output should not contain "does one thing"
@@ -29,7 +29,7 @@ Feature: custom settings
29
29
  end
30
30
  end
31
31
  """
32
- When I run "rspec ./additional_setting_spec.rb"
32
+ When I run `rspec ./additional_setting_spec.rb`
33
33
  Then the examples should all pass
34
34
 
35
35
  Scenario: default to true
@@ -55,7 +55,7 @@ Feature: custom settings
55
55
  end
56
56
  end
57
57
  """
58
- When I run "rspec ./additional_setting_spec.rb"
58
+ When I run `rspec ./additional_setting_spec.rb`
59
59
  Then the examples should all pass
60
60
 
61
61
  Scenario: overridden in a subsequent RSpec.configure block
@@ -79,6 +79,6 @@ Feature: custom settings
79
79
  end
80
80
  end
81
81
  """
82
- When I run "rspec ./additional_setting_spec.rb"
82
+ When I run `rspec ./additional_setting_spec.rb`
83
83
  Then the examples should all pass
84
84
 
@@ -21,7 +21,7 @@ Feature: fail fast
21
21
  end
22
22
  end
23
23
  """
24
- When I run "rspec spec/example_spec.rb"
24
+ When I run `rspec spec/example_spec.rb`
25
25
  Then the examples should all pass
26
26
 
27
27
  Scenario: fail_fast with first example failing (only runs the one example)
@@ -37,7 +37,7 @@ Feature: fail fast
37
37
  end
38
38
  end
39
39
  """
40
- When I run "rspec spec/example_spec.rb -fd"
40
+ When I run `rspec spec/example_spec.rb -fd`
41
41
  Then the output should contain "1 example, 1 failure"
42
42
 
43
43
  Scenario: fail_fast with multiple files, second example failing (only runs the first two examples)
@@ -73,5 +73,5 @@ Feature: fail fast
73
73
  end
74
74
  end
75
75
  """
76
- When I run "rspec spec"
76
+ When I run `rspec spec`
77
77
  Then the output should contain "2 examples, 1 failure"
@@ -30,7 +30,7 @@ Feature: read command line configuration options from files
30
30
  end
31
31
  end
32
32
  """
33
- When I run "rspec ./spec/example_spec.rb"
33
+ When I run `rspec ./spec/example_spec.rb`
34
34
  Then the examples should all pass
35
35
 
36
36
  Scenario: custom options file
@@ -47,7 +47,7 @@ Feature: read command line configuration options from files
47
47
  end
48
48
  end
49
49
  """
50
- When I run "rspec spec/example_spec.rb --options my.options"
50
+ When I run `rspec spec/example_spec.rb --options my.options`
51
51
  Then the examples should all pass
52
52
 
53
53
  Scenario: RSpec ignores ./.rspec when custom options file is used
@@ -67,7 +67,7 @@ Feature: read command line configuration options from files
67
67
  end
68
68
  end
69
69
  """
70
- When I run "rspec spec/example_spec.rb --options my.options"
70
+ When I run `rspec spec/example_spec.rb --options my.options`
71
71
  Then the examples should all pass
72
72
 
73
73
  Scenario: using ERB in .rspec
@@ -83,5 +83,5 @@ Feature: read command line configuration options from files
83
83
  end
84
84
  end
85
85
  """
86
- When I run "rspec ./spec/example_spec.rb"
86
+ When I run `rspec ./spec/example_spec.rb`
87
87
  Then the examples should all pass
@@ -4,21 +4,17 @@ Feature: basic structure (describe/it)
4
4
  behave, organized in groups. It uses the words "describe" and "it" so we can
5
5
  express concepts like a conversation:
6
6
 
7
- "Describe an account when it is first opened."
8
- "It has a balance of zero."
7
+ "Describe an account when it is first opened."
8
+ "It has a balance of zero."
9
9
 
10
- The describe() method creates a subclass of RSpec::Core::ExampleGroup. The
11
- block passed to describe() is evaluated in the context of that class, so any
12
- class methods of ExampleGroup are at your disposal within that block.
13
-
14
- Within a group, you can declare nested groups using the describe() or
15
- context() methods. A nested group is actually a subclass of the outer group,
16
- so it has access to same methods as the outer group, as well as any class
17
- methods defined in the outer group.
18
-
19
- The it() method accepts a block, which is later executed in the context of
20
- an instance of the group in which it is declared.
10
+ The `describe` method creates an example group. Within the block passed to
11
+ `describe` you can declare nested groups using the `describe` or `context`
12
+ methods, or you can declare examples using the `it` or `specify` methods.
21
13
 
14
+ Under the hood, an example group is a class in which the block passed to
15
+ `describe` or `context` is evaluated. The blocks passed to `it` are evaluated
16
+ in the context of an _instance_ of that class.
17
+
22
18
  Scenario: one group, one example
23
19
  Given a file named "sample_spec.rb" with:
24
20
  """
@@ -27,7 +23,7 @@ Feature: basic structure (describe/it)
27
23
  end
28
24
  end
29
25
  """
30
- When I run "rspec sample_spec.rb -fn"
26
+ When I run `rspec sample_spec.rb -fn`
31
27
  Then the output should contain:
32
28
  """
33
29
  something
@@ -48,7 +44,7 @@ Feature: basic structure (describe/it)
48
44
  end
49
45
  end
50
46
  """
51
- When I run "rspec nested_example_groups_spec.rb -fdoc"
47
+ When I run `rspec nested_example_groups_spec.rb -fdoc`
52
48
  Then the output should contain:
53
49
  """
54
50
  something
@@ -0,0 +1,74 @@
1
+ Feature: shared context
2
+
3
+ Use `shared_context` to define a block that will be evaluated in the context
4
+ of example groups either explicitly, using `include_context`, or implicitly by
5
+ matching metdata.
6
+
7
+ Background:
8
+ Given a file named "shared_stuff.rb" with:
9
+ """
10
+ shared_context "shared stuff", :a => :b do
11
+ before { @some_var = :some_value }
12
+ def shared_method
13
+ "it works"
14
+ end
15
+ let(:shared_let) { {'arbitrary' => 'object'} }
16
+ subject do
17
+ 'this is the subject'
18
+ end
19
+ end
20
+ """
21
+
22
+ Scenario: declare shared context and include it with include_context
23
+ Given a file named "shared_context_example.rb" with:
24
+ """
25
+ require "./shared_stuff.rb"
26
+
27
+ describe "group that includes a shared context using 'include_context'" do
28
+ include_context "shared stuff"
29
+
30
+ it "has access to methods defined in shared context" do
31
+ shared_method.should eq("it works")
32
+ end
33
+
34
+ it "has access to methods defined with let in shared context" do
35
+ shared_let['arbitrary'].should eq('object')
36
+ end
37
+
38
+ it "runs the before hooks defined in the shared context" do
39
+ @some_var.should be(:some_value)
40
+ end
41
+
42
+ it "accesses the subject defined in the shared context" do
43
+ subject.should eq('this is the subject')
44
+ end
45
+ end
46
+ """
47
+ When I run `rspec shared_context_example.rb`
48
+ Then the examples should all pass
49
+
50
+ Scenario: declare shared context and include it with metadata
51
+ Given a file named "shared_context_example.rb" with:
52
+ """
53
+ require "./shared_stuff.rb"
54
+
55
+ describe "group that includes a shared context using metadata", :a => :b do
56
+ it "has access to methods defined in shared context" do
57
+ shared_method.should eq("it works")
58
+ end
59
+
60
+ it "has access to methods defined with let in shared context" do
61
+ shared_let['arbitrary'].should eq('object')
62
+ end
63
+
64
+ it "runs the before hooks defined in the shared context" do
65
+ @some_var.should be(:some_value)
66
+ end
67
+
68
+ it "accesses the subject defined in the shared context" do
69
+ subject.should eq('this is the subject')
70
+ end
71
+ end
72
+ """
73
+ When I run `rspec shared_context_example.rb`
74
+ Then the examples should all pass
@@ -1,19 +1,23 @@
1
- Feature: shared example group
1
+ Feature: shared examples
2
2
 
3
- Shared example groups let you describe behaviour of types or modules. When
3
+ Shared examples let you describe behaviour of types or modules. When
4
4
  declared, a shared group's content is stored. It is only realized in the
5
5
  context of another example group, which provides any context the shared group
6
6
  needs to run.
7
7
 
8
- A shared group is included in another group using the it_behaves_like() or
9
- it_should_behave_like() methods.
8
+ A shared group is included in another group using any of:
9
+
10
+ include_examples "name" # include the examples in the current context
10
11
 
11
- Scenario: shared example group applied to two groups
12
+ it_behaves_like "name" # include the examples in a nested context
13
+ it_should_behave_like "name" # include the examples in a nested context
14
+
15
+ Scenario: shared examples group included in two groups
12
16
  Given a file named "collection_spec.rb" with:
13
17
  """
14
18
  require "set"
15
19
 
16
- shared_examples_for "a collection" do
20
+ shared_examples "a collection" do
17
21
  let(:collection) { described_class.new([7, 2, 4]) }
18
22
 
19
23
  context "initialized with 3 items" do
@@ -45,7 +49,7 @@ Feature: shared example group
45
49
  it_behaves_like "a collection"
46
50
  end
47
51
  """
48
- When I run "rspec collection_spec.rb --format documentation"
52
+ When I run `rspec collection_spec.rb --format documentation`
49
53
  Then the examples should all pass
50
54
  And the output should contain:
51
55
  """
@@ -75,7 +79,7 @@ Feature: shared example group
75
79
  """
76
80
  require "set"
77
81
 
78
- shared_examples_for "a collection object" do
82
+ shared_examples "a collection object" do
79
83
  describe "<<" do
80
84
  it "adds objects to the end of the collection" do
81
85
  collection << 1
@@ -86,28 +90,28 @@ Feature: shared example group
86
90
  end
87
91
 
88
92
  describe Array do
89
- it_should_behave_like "a collection object" do
93
+ it_behaves_like "a collection object" do
90
94
  let(:collection) { Array.new }
91
95
  end
92
96
  end
93
97
 
94
98
  describe Set do
95
- it_should_behave_like "a collection object" do
99
+ it_behaves_like "a collection object" do
96
100
  let(:collection) { Set.new }
97
101
  end
98
102
  end
99
103
  """
100
- When I run "rspec shared_example_group_spec.rb --format documentation"
104
+ When I run `rspec shared_example_group_spec.rb --format documentation`
101
105
  Then the examples should all pass
102
106
  And the output should contain:
103
107
  """
104
108
  Array
105
- it should behave like a collection object
109
+ behaves like a collection object
106
110
  <<
107
111
  adds objects to the end of the collection
108
112
 
109
113
  Set
110
- it should behave like a collection object
114
+ behaves like a collection object
111
115
  <<
112
116
  adds objects to the end of the collection
113
117
  """
@@ -115,7 +119,7 @@ Feature: shared example group
115
119
  Scenario: Passing parameters to a shared example group
116
120
  Given a file named "shared_example_group_params_spec.rb" with:
117
121
  """
118
- shared_examples_for "a measurable object" do |measurement, measurement_methods|
122
+ shared_examples "a measurable object" do |measurement, measurement_methods|
119
123
  measurement_methods.each do |measurement_method|
120
124
  it "should return #{measurement} from ##{measurement_method}" do
121
125
  subject.send(measurement_method).should == measurement
@@ -133,7 +137,7 @@ Feature: shared example group
133
137
  it_should_behave_like "a measurable object", 6, [:size, :length]
134
138
  end
135
139
  """
136
- When I run "rspec shared_example_group_params_spec.rb --format documentation"
140
+ When I run `rspec shared_example_group_params_spec.rb --format documentation`
137
141
  Then the examples should all pass
138
142
  And the output should contain:
139
143
  """
@@ -155,7 +159,7 @@ Feature: shared example group
155
159
  c.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
156
160
  end
157
161
 
158
- shared_examples_for 'sortability' do
162
+ shared_examples 'sortability' do
159
163
  it 'responds to <=>' do
160
164
  sortable.should respond_to(:<=>)
161
165
  end
@@ -167,7 +171,7 @@ Feature: shared example group
167
171
  end
168
172
  end
169
173
  """
170
- When I run "rspec shared_example_group_spec.rb --format documentation"
174
+ When I run `rspec shared_example_group_spec.rb --format documentation`
171
175
  Then the examples should all pass
172
176
  And the output should contain:
173
177
  """