rspec 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/History.rdoc +31 -1
  2. data/Manifest.txt +14 -12
  3. data/Rakefile +1 -1
  4. data/Upgrade.rdoc +43 -3
  5. data/examples/failing/failing_implicit_docstrings_example.rb +5 -5
  6. data/examples/passing/implicit_docstrings_example.rb +3 -3
  7. data/features/before_and_after_blocks/before_and_after_blocks.feature +20 -21
  8. data/features/example_groups/example_group_with_should_methods.feature +20 -8
  9. data/features/example_groups/implicit_docstrings.feature +36 -20
  10. data/features/example_groups/nested_groups.feature +25 -10
  11. data/features/extensions/custom_example_group.feature +19 -0
  12. data/features/formatters/custom_formatter.feature +30 -0
  13. data/features/heckle/heckle.feature +7 -7
  14. data/features/interop/examples_and_tests_together.feature +63 -14
  15. data/features/interop/rspec_output.feature +25 -0
  16. data/features/interop/test_but_not_test_unit.feature +19 -7
  17. data/features/interop/test_case_with_should_methods.feature +37 -8
  18. data/features/matchers/{create_matcher.feature → define_matcher.feature} +54 -30
  19. data/features/matchers/{create_matcher_outside_rspec.feature → define_matcher_outside_rspec.feature} +7 -7
  20. data/features/mock_framework_integration/use_flexmock.feature +3 -3
  21. data/features/mock_framework_integration/use_mocha.feature +3 -3
  22. data/features/mock_framework_integration/use_rr.feature +3 -3
  23. data/features/mocks/mix_stubs_and_mocks.feature +4 -4
  24. data/features/pending/pending_examples.feature +18 -18
  25. data/features/runner/specify_line_number.feature +32 -0
  26. data/features/step_definitions/running_rspec_steps.rb +41 -0
  27. data/features/subject/explicit_subject.feature +4 -4
  28. data/features/subject/implicit_subject.feature +4 -4
  29. data/features/support/env.rb +64 -11
  30. data/features/support/matchers/smart_match.rb +10 -35
  31. data/lib/spec.rb +1 -0
  32. data/lib/spec/deprecation.rb +40 -0
  33. data/lib/spec/dsl/main.rb +10 -5
  34. data/lib/spec/example.rb +1 -27
  35. data/lib/spec/example/args_and_options.rb +27 -0
  36. data/lib/spec/example/before_and_after_hooks.rb +30 -21
  37. data/lib/spec/example/errors.rb +8 -18
  38. data/lib/spec/example/example_group_factory.rb +0 -4
  39. data/lib/spec/example/example_group_methods.rb +27 -41
  40. data/lib/spec/example/example_group_proxy.rb +12 -22
  41. data/lib/spec/example/example_methods.rb +8 -18
  42. data/lib/spec/example/example_proxy.rb +4 -4
  43. data/lib/spec/example/pending.rb +3 -4
  44. data/lib/spec/example/predicate_matchers.rb +1 -1
  45. data/lib/spec/example/subject.rb +2 -0
  46. data/lib/spec/expectations.rb +1 -26
  47. data/lib/spec/expectations/extensions.rb +1 -1
  48. data/lib/spec/expectations/extensions/kernel.rb +52 -0
  49. data/lib/spec/expectations/handler.rb +21 -10
  50. data/lib/spec/matchers/be.rb +3 -3
  51. data/lib/spec/matchers/be_close.rb +17 -21
  52. data/lib/spec/matchers/be_instance_of.rb +7 -26
  53. data/lib/spec/matchers/be_kind_of.rb +7 -26
  54. data/lib/spec/matchers/dsl.rb +9 -4
  55. data/lib/spec/matchers/eql.rb +24 -25
  56. data/lib/spec/matchers/equal.rb +25 -25
  57. data/lib/spec/matchers/exist.rb +5 -21
  58. data/lib/spec/matchers/include.rb +22 -44
  59. data/lib/spec/matchers/match.rb +5 -25
  60. data/lib/spec/matchers/match_array.rb +8 -4
  61. data/lib/spec/matchers/matcher.rb +13 -2
  62. data/lib/spec/matchers/pretty.rb +1 -0
  63. data/lib/spec/matchers/simple_matcher.rb +2 -2
  64. data/lib/spec/mocks/mock.rb +10 -10
  65. data/lib/spec/mocks/spec_methods.rb +1 -1
  66. data/lib/spec/runner/configuration.rb +53 -42
  67. data/lib/spec/{expectations → runner}/differs/default.rb +0 -0
  68. data/lib/spec/{expectations → runner}/differs/load-diff-lcs.rb +0 -0
  69. data/lib/spec/runner/drb_command_line.rb +1 -1
  70. data/lib/spec/runner/example_group_runner.rb +0 -12
  71. data/lib/spec/runner/formatter/base_formatter.rb +77 -30
  72. data/lib/spec/runner/formatter/base_text_formatter.rb +19 -24
  73. data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +1 -1
  74. data/lib/spec/runner/formatter/html_formatter.rb +4 -6
  75. data/lib/spec/runner/formatter/nested_text_formatter.rb +2 -2
  76. data/lib/spec/runner/formatter/no_op_method_missing.rb +21 -0
  77. data/lib/spec/runner/formatter/profile_formatter.rb +0 -4
  78. data/lib/spec/runner/formatter/progress_bar_formatter.rb +4 -5
  79. data/lib/spec/runner/formatter/silent_formatter.rb +10 -0
  80. data/lib/spec/runner/formatter/specdoc_formatter.rb +2 -2
  81. data/lib/spec/runner/option_parser.rb +14 -7
  82. data/lib/spec/runner/options.rb +17 -7
  83. data/lib/spec/runner/reporter.rb +69 -64
  84. data/lib/spec/version.rb +1 -1
  85. data/spec/spec/dsl/main_spec.rb +7 -0
  86. data/spec/spec/example/example_group_methods_spec.rb +16 -32
  87. data/spec/spec/example/example_group_proxy_spec.rb +25 -5
  88. data/spec/spec/example/example_group_spec.rb +2 -2
  89. data/spec/spec/example/example_methods_spec.rb +19 -24
  90. data/spec/spec/example/example_proxy_spec.rb +11 -1
  91. data/spec/spec/example/pending_module_spec.rb +2 -108
  92. data/spec/spec/example/predicate_matcher_spec.rb +23 -3
  93. data/spec/spec/expectations/extensions/object_spec.rb +9 -9
  94. data/spec/spec/expectations/fail_with_spec.rb +13 -13
  95. data/spec/spec/expectations/handler_spec.rb +44 -15
  96. data/spec/spec/matchers/be_close_spec.rb +9 -0
  97. data/spec/spec/matchers/be_instance_of_spec.rb +6 -4
  98. data/spec/spec/matchers/be_kind_of_spec.rb +5 -3
  99. data/spec/spec/matchers/be_spec.rb +1 -5
  100. data/spec/spec/matchers/compatibility_spec.rb +1 -1
  101. data/spec/spec/matchers/dsl_spec.rb +10 -1
  102. data/spec/spec/matchers/eql_spec.rb +8 -4
  103. data/spec/spec/matchers/equal_spec.rb +8 -4
  104. data/spec/spec/matchers/exist_spec.rb +1 -1
  105. data/spec/spec/matchers/include_spec.rb +1 -1
  106. data/spec/spec/matchers/match_array_spec.rb +26 -1
  107. data/spec/spec/matchers/match_spec.rb +2 -2
  108. data/spec/spec/matchers/matcher_methods_spec.rb +0 -3
  109. data/spec/spec/matchers/matcher_spec.rb +53 -0
  110. data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
  111. data/spec/spec/mocks/mock_spec.rb +6 -0
  112. data/spec/spec/runner/configuration_spec.rb +11 -1
  113. data/spec/spec/runner/drb_command_line_spec.rb +13 -1
  114. data/spec/spec/runner/example_group_runner_spec.rb +0 -7
  115. data/spec/spec/runner/formatter/base_formatter_spec.rb +19 -12
  116. data/spec/spec/runner/formatter/base_text_formatter_spec.rb +2 -2
  117. data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
  118. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
  119. data/spec/spec/runner/formatter/html_formatted-1.8.6.html +31 -34
  120. data/spec/spec/runner/formatter/html_formatter_spec.rb +20 -0
  121. data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -20
  122. data/spec/spec/runner/formatter/profile_formatter_spec.rb +22 -3
  123. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +24 -3
  124. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
  125. data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +25 -28
  126. data/spec/spec/runner/formatter/text_mate_formatter_spec.rb +2 -2
  127. data/spec/spec/runner/option_parser_spec.rb +108 -40
  128. data/spec/spec/runner/reporter_spec.rb +16 -17
  129. data/spec/spec_helper.rb +4 -1
  130. metadata +20 -18
  131. data/features/example_groups/output.feature +0 -20
  132. data/features/step_definitions/running_rspec.rb +0 -69
  133. data/lib/spec/expectations/extensions/object.rb +0 -63
  134. data/resources/spec/example_group_with_should_methods.rb +0 -12
  135. data/resources/spec/simple_spec.rb +0 -8
  136. data/resources/test/spec_and_test_together.rb +0 -56
  137. data/resources/test/spec_including_test_but_not_unit.rb +0 -11
  138. data/resources/test/test_case_with_should_methods.rb +0 -29
@@ -1,3 +1,4 @@
1
+ require 'spec/deprecation'
1
2
  require 'spec/ruby'
2
3
  require 'spec/matchers'
3
4
  require 'spec/expectations'
@@ -0,0 +1,40 @@
1
+ module Spec
2
+ class << self
3
+ def deprecate(method, alternate_method=nil)
4
+ message = <<-NOTICE
5
+
6
+ *****************************************************************
7
+ DEPRECATION WARNING: you are using deprecated behaviour that will
8
+ be removed from a future version of RSpec.
9
+
10
+ #{caller(0)[2]}
11
+
12
+ * #{method} is deprecated.
13
+ NOTICE
14
+ if alternate_method
15
+ message << <<-ADDITIONAL
16
+ * please use #{alternate_method} instead.
17
+ ADDITIONAL
18
+ end
19
+
20
+ message << "*****************************************************************"
21
+ warn(message)
22
+ end
23
+
24
+ def warn(message)
25
+ Kernel.warn(message)
26
+ end
27
+
28
+ end
29
+
30
+ class HashWithDeprecationNotice < Hash
31
+ def initialize(method, alternate_method=nil, &block)
32
+ @method, @alternate_method = method, alternate_method
33
+ end
34
+ def []=(k,v)
35
+ Spec.deprecate(@method, @alternate_method)
36
+ super
37
+ end
38
+ end
39
+ end
40
+
@@ -1,6 +1,8 @@
1
1
  module Spec
2
2
  module DSL
3
3
  module Main
4
+ include Spec::Example::ArgsAndOptions
5
+
4
6
  # Creates and returns a class that includes the ExampleGroupMethods
5
7
  # module. Which ExampleGroup type is created depends on the directory of the file
6
8
  # calling this method. For example, Spec::Rails will use different
@@ -13,15 +15,16 @@ module Spec
13
15
  #
14
16
  # describe "name", :type => :something_special do ...
15
17
  #
16
- # The reason for using different behaviour classes is to have different
18
+ # The reason for using different example group classes is to have different
17
19
  # matcher methods available from within the <tt>describe</tt> block.
18
20
  #
19
21
  # See Spec::Example::ExampleGroupFactory#register for details about how to
20
22
  # register special implementations.
21
23
  #
22
24
  def describe(*args, &block)
23
- Spec::Example::set_location(args, caller(0)[1])
24
- Spec::Example::ExampleGroupFactory.assign_scope(self, args)
25
+ raise Spec::Example::NoDescriptionError.new("example group", caller(0)[1]) if args.empty?
26
+ add_options(args, :scope => self)
27
+ set_location(args.options, caller(0)[1])
25
28
  Spec::Example::ExampleGroupFactory.create_example_group(*args, &block)
26
29
  end
27
30
  alias :context :describe
@@ -42,7 +45,8 @@ module Spec
42
45
  # end
43
46
  # end
44
47
  def share_examples_for(*args, &block)
45
- Spec::Example::set_location(args, caller(0)[1])
48
+ add_options(args)
49
+ set_location(args.options, caller(0)[1])
46
50
  Spec::Example::ExampleGroupFactory.create_shared_example_group(*args, &block)
47
51
  end
48
52
  alias :shared_examples_for :share_examples_for
@@ -74,7 +78,8 @@ module Spec
74
78
  def share_as(name, &block)
75
79
  begin
76
80
  args = [name]
77
- Spec::Example::set_location(args, caller(0)[1])
81
+ add_options(args)
82
+ set_location(args.options, caller(0)[1])
78
83
  Object.const_set(name, Spec::Example::ExampleGroupFactory.create_shared_example_group(*args, &block))
79
84
  rescue NameError => e
80
85
  raise NameError.new(e.message + "\nThe first argument to share_as must be a legal name for a constant\n")
@@ -142,37 +142,11 @@ module Spec
142
142
  # end
143
143
  # end
144
144
  module Example
145
- class << self
146
- def args_and_options(*args) # :nodoc:
147
- with_options_from(args) do |options|
148
- return args, options
149
- end
150
- end
151
-
152
- def scope_from(*args) # :nodoc:
153
- args[0] || :each
154
- end
155
-
156
- def scope_and_options(*args) # :nodoc:
157
- args, options = args_and_options(*args)
158
- return scope_from(*args), options
159
- end
160
-
161
- def set_location(args, location) # :nodoc:
162
- args << {} unless Hash === args.last
163
- args.last[:location] ||= location
164
- end
165
-
166
- private
167
-
168
- def with_options_from(args)
169
- yield Hash === args.last ? args.pop : {} if block_given?
170
- end
171
- end
172
145
  end
173
146
  end
174
147
 
175
148
  require 'timeout'
149
+ require 'spec/example/args_and_options'
176
150
  require 'spec/example/predicate_matchers'
177
151
  require 'spec/example/example_group_proxy'
178
152
  require 'spec/example/example_proxy'
@@ -0,0 +1,27 @@
1
+ module Spec
2
+ module Example
3
+ module ArgsAndOptions
4
+ def args_and_options(*args) # :nodoc:
5
+ options = Hash === args.last ? args.pop : {}
6
+ return args, options
7
+ end
8
+
9
+ def add_options(args, options={}) # :nodoc:
10
+ args << {} unless Hash === args.last
11
+ args.extend WithOptions
12
+ args.options.merge!(options)
13
+ args.options
14
+ end
15
+
16
+ def set_location(options, location) # :nodoc:
17
+ options[:location] ||= location
18
+ end
19
+
20
+ module WithOptions # :nodoc:
21
+ def options
22
+ last
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -2,39 +2,48 @@ module Spec
2
2
  module Example
3
3
  module BeforeAndAfterHooks
4
4
  class << self
5
- def before_suite_parts
5
+ def before_suite_parts # :nodoc:
6
6
  @before_suite_parts ||= []
7
7
  end
8
8
 
9
- def after_suite_parts
9
+ def after_suite_parts # :nodoc:
10
10
  @after_suite_parts ||= []
11
11
  end
12
12
  end
13
13
 
14
- # Registers a block to be executed before each example.
15
- # This method prepends +block+ to existing before blocks.
16
- def prepend_before(*args, &block)
17
- before_parts(*args).unshift(block)
14
+ # Registers a block to be executed before examples. <tt>scope</tt> can be
15
+ # <tt>:each</tt> (default), <tt>:all</tt>, or <tt>:suite</tt>. When
16
+ # <tt>:each</tt>, the block is executed before each example. When
17
+ # <tt>:all</tt>, the block is executed only once before any examples are
18
+ # run.
19
+ def append_before(scope = :each, &block)
20
+ before_parts(scope) << block
18
21
  end
22
+ alias_method :before, :append_before
19
23
 
20
24
  # Registers a block to be executed before each example.
21
- # This method appends +block+ to existing before blocks.
22
- def append_before(*args, &block)
23
- before_parts(*args) << block
25
+ # This method prepends +block+ to existing before blocks.
26
+ #
27
+ # See <tt>append_before</tt> for scoping semantics.
28
+ def prepend_before(scope = :each, &block)
29
+ before_parts(scope).unshift(block)
24
30
  end
25
- alias_method :before, :append_before
26
31
 
27
32
  # Registers a block to be executed after each example.
28
33
  # This method prepends +block+ to existing after blocks.
29
- def prepend_after(*args, &block)
30
- after_parts(*args).unshift(block)
34
+ #
35
+ # See <tt>append_before</tt> for scoping semantics.
36
+ def prepend_after(scope = :each, &block)
37
+ after_parts(scope).unshift(block)
31
38
  end
32
39
  alias_method :after, :prepend_after
33
40
 
34
41
  # Registers a block to be executed after each example.
35
42
  # This method appends +block+ to existing after blocks.
36
- def append_after(*args, &block)
37
- after_parts(*args) << block
43
+ #
44
+ # See <tt>append_before</tt> for scoping semantics.
45
+ def append_after(scope = :each, &block)
46
+ after_parts(scope) << block
38
47
  end
39
48
 
40
49
  def before_each_parts # :nodoc:
@@ -53,26 +62,26 @@ module Spec
53
62
  @after_all_parts ||= []
54
63
  end
55
64
 
56
- def before_suite_parts
65
+ def before_suite_parts # :nodoc:
57
66
  BeforeAndAfterHooks.before_suite_parts
58
67
  end
59
68
 
60
- def after_suite_parts
69
+ def after_suite_parts # :nodoc:
61
70
  BeforeAndAfterHooks.after_suite_parts
62
71
  end
63
72
 
64
- private
73
+ private
65
74
 
66
- def before_parts(*args)
67
- case Spec::Example.scope_from(*args)
75
+ def before_parts(scope)
76
+ case scope
68
77
  when :each; before_each_parts
69
78
  when :all; before_all_parts
70
79
  when :suite; before_suite_parts
71
80
  end
72
81
  end
73
82
 
74
- def after_parts(*args)
75
- case Spec::Example.scope_from(*args)
83
+ def after_parts(scope)
84
+ case scope
76
85
  when :each; after_each_parts
77
86
  when :all; after_all_parts
78
87
  when :suite; after_suite_parts
@@ -1,30 +1,20 @@
1
1
  module Spec
2
2
  module Example
3
- class ExamplePendingError < StandardError
4
- attr_reader :pending_caller
5
-
6
- def initialize(message=nil, pending_caller=nil)
7
- super(message)
8
- @pending_caller = pending_caller || caller[2]
9
- end
10
- end
3
+ class ExamplePendingError < StandardError; end
11
4
 
12
5
  class NotYetImplementedError < ExamplePendingError
13
6
  MESSAGE = "Not Yet Implemented"
14
- RSPEC_ROOT_LIB = File.expand_path(File.dirname(__FILE__) + "/../..")
15
-
16
- def initialize(backtrace)
7
+ def initialize
17
8
  super(MESSAGE)
18
- @pending_caller = pending_caller_from(backtrace)
19
- end
20
-
21
- private
22
-
23
- def pending_caller_from(backtrace)
24
- backtrace.detect {|line| !line.include?(RSPEC_ROOT_LIB) }
25
9
  end
26
10
  end
27
11
 
28
12
  class PendingExampleFixedError < StandardError; end
13
+
14
+ class NoDescriptionError < ArgumentError
15
+ def initialize(kind, location)
16
+ super("No description supplied for #{kind} declared on #{location}")
17
+ end
18
+ end
29
19
  end
30
20
  end
@@ -60,10 +60,6 @@ module Spec
60
60
  @example_group_types[key]
61
61
  end
62
62
 
63
- def assign_scope(scope, args)
64
- args.last[:scope] = scope
65
- end
66
-
67
63
  protected
68
64
 
69
65
  def determine_superclass(opts)
@@ -1,14 +1,23 @@
1
1
  module Spec
2
2
  module Example
3
3
 
4
- module ExampleGroupMethods
4
+ module ExampleGroupMethods
5
5
  class << self
6
6
  attr_accessor :matcher_class
7
+
8
+ def build_description_from(*args)
9
+ text = args.inject("") do |description, arg|
10
+ description << " " unless (description == "" || arg.to_s =~ /^(\s|\.|#)/)
11
+ description << arg.to_s
12
+ end
13
+ text == "" ? nil : text
14
+ end
7
15
  end
8
16
 
9
17
  include Spec::Example::BeforeAndAfterHooks
10
18
  include Spec::Example::Subject::ExampleGroupMethods
11
19
  include Spec::Example::PredicateMatchers
20
+ include Spec::Example::ArgsAndOptions
12
21
 
13
22
  attr_reader :options, :location
14
23
 
@@ -17,20 +26,6 @@ module Spec
17
26
  ExampleGroupFactory.register_example_group(klass)
18
27
  end
19
28
 
20
- # Provides the backtrace up to where this example_group was declared.
21
- def backtrace
22
- defined?(@backtrace) ? @backtrace : nil
23
- end
24
-
25
- # Deprecated - use +backtrace()+
26
- def example_group_backtrace
27
- Kernel.warn <<-WARNING
28
- ExampleGroupMethods#example_group_backtrace is deprecated and will be removed
29
- from a future version. Please use ExampleGroupMethods#backtrace instead.
30
- WARNING
31
- backtrace
32
- end
33
-
34
29
  # Makes the describe/it syntax available from a class. For example:
35
30
  #
36
31
  # class StackSpec < Spec::ExampleGroup
@@ -46,9 +41,10 @@ WARNING
46
41
  # end
47
42
  #
48
43
  def describe(*args, &example_group_block)
44
+ raise Spec::Example::NoDescriptionError.new("example group", caller(0)[1]) if args.empty?
49
45
  if example_group_block
50
- Spec::Example::set_location(args, caller(0)[1])
51
- options = args.last
46
+ options = add_options(args)
47
+ set_location(options, caller(0)[1])
52
48
  if options[:shared]
53
49
  ExampleGroupFactory.create_shared_example_group(*args, &example_group_block)
54
50
  else
@@ -77,8 +73,7 @@ WARNING
77
73
  end
78
74
 
79
75
  def pending_implementation
80
- error = Spec::Example::NotYetImplementedError.new(caller)
81
- lambda { raise(error) }
76
+ lambda { raise(Spec::Example::NotYetImplementedError) }
82
77
  end
83
78
 
84
79
  alias_method :it, :example
@@ -101,23 +96,23 @@ WARNING
101
96
  define_methods_from_predicate_matchers
102
97
 
103
98
  success, before_all_instance_variables = run_before_all(run_options)
104
- success, after_all_instance_variables = execute_examples(success, before_all_instance_variables, examples, run_options)
99
+ success, after_all_instance_variables = run_examples(success, before_all_instance_variables, examples, run_options)
105
100
  success = run_after_all(success, after_all_instance_variables, run_options)
106
101
  end
107
102
 
108
103
  def set_description(*args)
109
- @description_args, @options = Spec::Example.args_and_options(*args)
104
+ @description_args, @options = args_and_options(*args)
110
105
  @backtrace = caller(1)
111
106
  @location = File.expand_path(options[:location]) if options[:location]
112
107
  self
113
108
  end
114
109
 
115
- def notify(listener) # :nodoc:
116
- listener.add_example_group(ExampleGroupProxy.new(self))
110
+ def notify(reporter) # :nodoc:
111
+ reporter.example_group_started(ExampleGroupProxy.new(self))
117
112
  end
118
113
 
119
114
  def description
120
- @description ||= build_description_from(*description_parts) || to_s
115
+ @description ||= ExampleGroupMethods.build_description_from(*description_parts) || to_s
121
116
  end
122
117
 
123
118
  def described_type
@@ -198,7 +193,7 @@ WARNING
198
193
  end
199
194
  end
200
195
 
201
- def execute_examples(success, instance_variables, examples, run_options)
196
+ def run_examples(success, instance_variables, examples, run_options)
202
197
  return [success, instance_variables] unless success
203
198
 
204
199
  after_all_instance_variables = instance_variables
@@ -218,22 +213,22 @@ WARNING
218
213
  after_all = new(example_proxy)
219
214
  after_all.set_instance_variables_from_hash(instance_variables)
220
215
  example_group_hierarchy.run_after_all(after_all)
221
- return success
216
+ success
222
217
  rescue Exception => e
223
218
  run_options.reporter.example_failed(example_proxy, e)
224
- return false
219
+ false
225
220
  end
226
221
 
227
222
  def examples_to_run(run_options)
228
- return example_proxies unless specified_examples?(run_options)
229
- example_proxies.reject do |example|
223
+ return example_proxies unless examples_were_specified?(run_options)
224
+ example_proxies.reject do |proxy|
230
225
  matcher = ExampleGroupMethods.matcher_class.
231
- new(description.to_s, example.description)
226
+ new(description.to_s, proxy.description)
232
227
  !matcher.matches?(run_options.examples)
233
228
  end
234
229
  end
235
230
 
236
- def specified_examples?(run_options)
231
+ def examples_were_specified?(run_options)
237
232
  !run_options.examples.empty?
238
233
  end
239
234
 
@@ -256,21 +251,12 @@ WARNING
256
251
  when SharedExampleGroup
257
252
  include shared_example_group
258
253
  else
259
- example_group = SharedExampleGroup.find(shared_example_group)
260
- unless example_group
254
+ unless example_group = SharedExampleGroup.find(shared_example_group)
261
255
  raise RuntimeError.new("Shared Example Group '#{shared_example_group}' can not be found")
262
256
  end
263
257
  include(example_group)
264
258
  end
265
259
  end
266
-
267
- def build_description_from(*args)
268
- text = args.inject("") do |description, arg|
269
- description << " " unless (description == "" || arg.to_s =~ /^(\s|\.|#)/)
270
- description << arg.to_s
271
- end
272
- text == "" ? nil : text
273
- end
274
260
  end
275
261
 
276
262
  end