rspec 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/.document +4 -4
  2. data/{History.txt → History.rdoc} +27 -4
  3. data/Manifest.txt +18 -7
  4. data/{README.txt → README.rdoc} +0 -0
  5. data/Rakefile +16 -9
  6. data/{Ruby1.9.markdown → Ruby1.9.rdoc} +3 -3
  7. data/TODO.txt +0 -7
  8. data/Upgrade.rdoc +110 -0
  9. data/features/matchers/create_matcher.feature +40 -0
  10. data/features/matchers/create_matcher_outside_rspec.feature +39 -0
  11. data/features/pending/pending_examples.feature +5 -5
  12. data/features/step_definitions/running_rspec.rb +13 -0
  13. data/features/subject/explicit_subject.feature +31 -0
  14. data/features/subject/implicit_subject.feature +31 -0
  15. data/lib/spec/adapters/mock_frameworks/flexmock.rb +1 -0
  16. data/lib/spec/adapters/mock_frameworks/mocha.rb +1 -0
  17. data/lib/spec/adapters/mock_frameworks/rr.rb +1 -0
  18. data/lib/spec/adapters/mock_frameworks/rspec.rb +12 -10
  19. data/lib/spec/dsl.rb +0 -1
  20. data/lib/spec/dsl/main.rb +3 -3
  21. data/lib/spec/example.rb +4 -3
  22. data/lib/spec/example/example_group_factory.rb +1 -3
  23. data/lib/spec/example/example_group_methods.rb +22 -28
  24. data/lib/spec/example/example_group_proxy.rb +64 -0
  25. data/lib/spec/example/example_methods.rb +8 -11
  26. data/lib/spec/example/example_proxy.rb +42 -0
  27. data/lib/spec/example/shared_example_group.rb +1 -1
  28. data/lib/spec/example/subject.rb +14 -3
  29. data/lib/spec/expectations.rb +1 -1
  30. data/lib/spec/expectations/differs/default.rb +46 -49
  31. data/lib/spec/expectations/differs/load-diff-lcs.rb +12 -0
  32. data/lib/spec/interop/test/unit/testcase.rb +2 -2
  33. data/lib/spec/matchers.rb +49 -9
  34. data/lib/spec/matchers/be.rb +12 -15
  35. data/lib/spec/matchers/change.rb +1 -0
  36. data/lib/spec/matchers/dsl.rb +15 -0
  37. data/lib/spec/matchers/have.rb +9 -8
  38. data/lib/spec/matchers/include.rb +2 -16
  39. data/lib/spec/matchers/match_array.rb +2 -14
  40. data/lib/spec/matchers/matcher.rb +16 -11
  41. data/lib/spec/matchers/pretty.rb +36 -0
  42. data/lib/spec/matchers/raise_error.rb +9 -8
  43. data/lib/spec/matchers/simple_matcher.rb +1 -0
  44. data/lib/spec/matchers/throw_symbol.rb +1 -1
  45. data/lib/spec/mocks/argument_expectation.rb +2 -0
  46. data/lib/spec/mocks/message_expectation.rb +2 -0
  47. data/lib/spec/mocks/proxy.rb +9 -10
  48. data/lib/spec/runner.rb +1 -0
  49. data/lib/spec/runner/extensions/kernel.rb +9 -0
  50. data/lib/spec/runner/formatter/base_formatter.rb +22 -9
  51. data/lib/spec/runner/formatter/html_formatter.rb +2 -1
  52. data/lib/spec/runner/heckle_runner.rb +1 -0
  53. data/lib/spec/runner/option_parser.rb +4 -1
  54. data/lib/spec/runner/options.rb +11 -0
  55. data/lib/spec/runner/spec_parser.rb +15 -22
  56. data/lib/spec/version.rb +4 -6
  57. data/spec/autotest/autotest_helper.rb +6 -1
  58. data/spec/spec/dsl/main_spec.rb +3 -3
  59. data/spec/spec/example/example_group_factory_spec.rb +11 -23
  60. data/spec/spec/example/example_group_methods_spec.rb +45 -20
  61. data/spec/spec/example/example_group_proxy_spec.rb +63 -0
  62. data/spec/spec/example/example_group_spec.rb +15 -0
  63. data/spec/spec/example/example_methods_spec.rb +5 -35
  64. data/spec/spec/example/example_proxy_spec.rb +47 -0
  65. data/spec/spec/example/nested_example_group_spec.rb +3 -3
  66. data/spec/spec/example/shared_example_group_spec.rb +4 -4
  67. data/spec/spec/example/subject_spec.rb +77 -0
  68. data/spec/spec/matchers/be_close_spec.rb +10 -10
  69. data/spec/spec/matchers/be_instance_of_spec.rb +13 -8
  70. data/spec/spec/matchers/be_kind_of_spec.rb +10 -8
  71. data/spec/spec/{dsl/matchers_spec.rb → matchers/dsl_spec.rb} +4 -4
  72. data/spec/spec/matchers/matcher_spec.rb +53 -1
  73. data/spec/spec/matchers/matchers_spec.rb +2 -0
  74. data/spec/spec/package/bin_spec_spec.rb +4 -4
  75. data/spec/spec/runner/command_line_spec.rb +2 -2
  76. data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
  77. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
  78. data/spec/spec/runner/formatter/html_formatted-1.8.4.html +1 -1
  79. data/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html +1 -1
  80. data/spec/spec/runner/formatter/html_formatted-1.8.5.html +1 -1
  81. data/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +1 -1
  82. data/spec/spec/runner/formatter/html_formatted-1.8.6.html +1 -1
  83. data/spec/spec/runner/formatter/html_formatted-1.8.7.html +1 -1
  84. data/spec/spec/runner/formatter/html_formatted-1.9.1.html +1 -1
  85. data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +12 -11
  86. data/spec/spec/runner/formatter/profile_formatter_spec.rb +2 -2
  87. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +2 -2
  88. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +2 -2
  89. data/spec/spec/runner/formatter/text_mate_formatted-1.8.4.html +1 -1
  90. data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +1 -1
  91. data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +1 -1
  92. data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +1 -1
  93. data/spec/spec/runner/option_parser_spec.rb +20 -0
  94. data/spec/spec/runner/options_spec.rb +23 -1
  95. data/spec/spec/runner/reporter_spec.rb +20 -17
  96. data/spec/spec/runner/spec_parser_spec.rb +1 -1
  97. metadata +33 -15
  98. data/Upgrade.markdown +0 -63
  99. data/lib/spec/dsl/matchers.rb +0 -13
  100. data/lib/spec/example/example_description.rb +0 -15
@@ -1,5 +1,6 @@
1
1
  if Spec::Ruby.version.to_f < 1.9
2
2
  begin
3
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
3
4
  require 'heckle'
4
5
  rescue LoadError ; raise "You must gem install heckle to use --heckle" ; end
5
6
 
@@ -78,6 +78,7 @@ module Spec
78
78
  :options_file => ["-O", "--options PATH", "Read options from a file"],
79
79
  :generate_options => ["-G", "--generate-options PATH", "Generate an options file for --options"],
80
80
  :runner => ["-U", "--runner RUNNER", "Use a custom Runner."],
81
+ :debug => ["-u", "--debugger", "Enable ruby-debugging."],
81
82
  :drb => ["-X", "--drb", "Run examples via DRb. (For example against script/spec_server)"],
82
83
  :version => ["-v", "--version", "Show version"],
83
84
  :help => ["-h", "--help", "You're looking at it"]
@@ -110,6 +111,7 @@ module Spec
110
111
  on(*OPTIONS[:options_file]) {|options_file|}
111
112
  on(*OPTIONS[:generate_options]) {|options_file|}
112
113
  on(*OPTIONS[:runner]) {|runner| @options.user_input_for_runner = runner}
114
+ on(*OPTIONS[:debug]) {@options.debug = true}
113
115
  on(*OPTIONS[:drb]) {}
114
116
  on(*OPTIONS[:version]) {parse_version}
115
117
  on("--autospec") {@options.autospec = true}
@@ -135,7 +137,8 @@ module Spec
135
137
  @options
136
138
  end
137
139
 
138
- protected
140
+ protected
141
+
139
142
  def invoke_requires(requires)
140
143
  requires.split(",").each do |file|
141
144
  require file
@@ -34,6 +34,7 @@ module Spec
34
34
  :dry_run,
35
35
  :profile,
36
36
  :heckle_runner,
37
+ :debug,
37
38
  :line_number,
38
39
  :loadby,
39
40
  :reporter,
@@ -57,6 +58,7 @@ module Spec
57
58
  @colour = false
58
59
  @profile = false
59
60
  @dry_run = false
61
+ @debug = false
60
62
  @reporter = Reporter.new(self)
61
63
  @context_lines = 3
62
64
  @diff_format = :unified
@@ -67,6 +69,8 @@ module Spec
67
69
  @examples_should_be_run = nil
68
70
  @user_input_for_runner = nil
69
71
  @after_suite_parts = []
72
+ @files_loaded = false
73
+ @out_used = nil
70
74
  end
71
75
 
72
76
  def add_example_group(example_group)
@@ -77,7 +81,13 @@ module Spec
77
81
  @example_groups.delete(example_group)
78
82
  end
79
83
 
84
+ def require_ruby_debug
85
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
86
+ require 'ruby-debug'
87
+ end
88
+
80
89
  def run_examples
90
+ require_ruby_debug if debug
81
91
  return true unless examples_should_be_run?
82
92
  success = true
83
93
  begin
@@ -142,6 +152,7 @@ module Spec
142
152
  if @colour && RUBY_PLATFORM =~ /mswin|mingw/ ;\
143
153
  begin ;\
144
154
  replace_output = @output_stream.equal?($stdout) ;\
155
+ require 'rubygems' unless ENV['NO_RUBYGEMS'] ;\
145
156
  require 'Win32/Console/ANSI' ;\
146
157
  @output_stream = $stdout if replace_output ;\
147
158
  rescue LoadError ;\
@@ -33,25 +33,21 @@ module Spec
33
33
  protected
34
34
 
35
35
  def consider_example_group_for_best_match(example_group, file, line_number)
36
- parsed_backtrace = parse_backtrace(example_group.backtrace)
37
- parsed_backtrace.each do |example_file, example_line|
38
- if is_best_match?(file, line_number, example_file, example_line)
39
- best_match.clear
40
- best_match[:example_group] = example_group
41
- best_match[:line] = example_line
42
- end
36
+ example_group_file, example_group_line = parse_location(example_group.location)
37
+ if is_best_match?(file, line_number, example_group_file, example_group_line)
38
+ best_match.clear
39
+ best_match[:example_group] = example_group
40
+ best_match[:line] = example_group_line
43
41
  end
44
42
  end
45
43
 
46
44
  def consider_example_for_best_match(example, example_group, file, line_number)
47
- parsed_backtrace = parse_backtrace(example.backtrace)
48
- parsed_backtrace.each do |example_file, example_line|
49
- if is_best_match?(file, line_number, example_file, example_line)
50
- best_match.clear
51
- best_match[:example_group] = example_group
52
- best_match[:example] = example
53
- best_match[:line] = example_line
54
- end
45
+ example_file, example_line = parse_location(example.location)
46
+ if is_best_match?(file, line_number, example_file, example_line)
47
+ best_match.clear
48
+ best_match[:example_group] = example_group
49
+ best_match[:example] = example
50
+ best_match[:line] = example_line
55
51
  end
56
52
  end
57
53
 
@@ -60,13 +56,10 @@ module Spec
60
56
  example_line <= line_number &&
61
57
  example_line > best_match[:line].to_i
62
58
  end
63
-
64
- def parse_backtrace(backtrace)
65
- Array(backtrace).collect do |trace_line|
66
- trace_line =~ /(.*)\:(\d*)(\:|$)/
67
- file, number = $1, $2
68
- [file, Integer(number)]
69
- end
59
+
60
+ def parse_location(location)
61
+ location =~ /(.*)\:(\d*)(\:|$)/
62
+ return $1, Integer($2)
70
63
  end
71
64
  end
72
65
  end
@@ -1,13 +1,11 @@
1
- module Spec
2
- module VERSION
1
+ module Spec # :nodoc:
2
+ module VERSION # :nodoc:
3
3
  unless defined? MAJOR
4
4
  MAJOR = 1
5
5
  MINOR = 2
6
- TINY = 0
7
- MINESCULE = nil
6
+ TINY = 1
8
7
 
9
-
10
- STRING = [MAJOR, MINOR, TINY, MINESCULE].compact.join('.')
8
+ STRING = [MAJOR, MINOR, TINY].compact.join('.')
11
9
 
12
10
  SUMMARY = "rspec #{STRING}"
13
11
  end
@@ -1,4 +1,9 @@
1
- require 'autotest'
1
+ begin
2
+ require 'autotest'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'autotest'
6
+ end
2
7
  dir = File.dirname(__FILE__)
3
8
  require File.expand_path("#{dir}/../spec_helper")
4
9
  require File.expand_path("#{dir}/../../lib/autotest/rspec")
@@ -12,7 +12,7 @@ module Spec
12
12
  it "should delegate to Spec::Example::ExampleGroupFactory.create_example_group" do
13
13
  block = lambda {|a,b|}
14
14
  Spec::Example::ExampleGroupFactory.should_receive(:create_example_group).with(
15
- "The ExampleGroup", hash_including(:spec_path), &block
15
+ "The ExampleGroup", hash_including(:location), &block
16
16
  )
17
17
  @main.__send__ method, "The ExampleGroup", &block
18
18
  end
@@ -24,7 +24,7 @@ module Spec
24
24
  it "should create a shared ExampleGroup" do
25
25
  block = lambda {|a,b|}
26
26
  Spec::Example::ExampleGroupFactory.should_receive(:create_shared_example_group).with(
27
- "shared group", hash_including(:spec_path), &block
27
+ "shared group", hash_including(:location), &block
28
28
  )
29
29
  @main.__send__ method, "shared group", &block
30
30
  end
@@ -65,7 +65,7 @@ module Spec
65
65
  it "registers a shared ExampleGroup" do
66
66
  block = lambda {|a,b|}
67
67
  Spec::Example::ExampleGroupFactory.should_receive(:create_shared_example_group).with(
68
- group_name, hash_including(:spec_path), &block
68
+ group_name, hash_including(:location), &block
69
69
  )
70
70
  @main.share_as group_name, &block
71
71
  end
@@ -92,52 +92,46 @@ module Spec
92
92
  end
93
93
  end
94
94
 
95
- it "should create a type indicated by :spec_path" do
95
+ it "should create a type indicated by :location" do
96
96
  Spec::Example::ExampleGroupFactory.register(:something_other_than_default, parent_example_group)
97
97
  custom_example_group = Spec::Example::ExampleGroupFactory.create_example_group(
98
- "example_group", :spec_path => "./spec/something_other_than_default/some_spec.rb"
98
+ "example_group", :location => "./spec/something_other_than_default/some_spec.rb"
99
99
  ) {}
100
100
  custom_example_group.superclass.should == parent_example_group
101
101
  end
102
102
 
103
- it "should create a type indicated by :spec_path (with spec_path generated by caller on windows)" do
103
+ it "should create a type indicated by :location (with location generated by caller on windows)" do
104
104
  Spec::Example::ExampleGroupFactory.register(:something_other_than_default, parent_example_group)
105
105
  custom_example_group = Spec::Example::ExampleGroupFactory.create_example_group(
106
106
  "example_group",
107
- :spec_path => "./spec\\something_other_than_default\\some_spec.rb"
107
+ :location => "./spec\\something_other_than_default\\some_spec.rb"
108
108
  ) {}
109
109
  custom_example_group.superclass.should == parent_example_group
110
110
  end
111
111
 
112
- it "should create a type indicated by spec_path for a path-like key" do
112
+ it "should create a type indicated by location for a path-like key" do
113
113
  Spec::Example::ExampleGroupFactory.register('path/to/custom/', parent_example_group)
114
114
  custom_example_group = Spec::Example::ExampleGroupFactory.create_example_group(
115
- "example_group", :spec_path => "./spec/path/to/custom/some_spec.rb"
115
+ "example_group", :location => "./spec/path/to/custom/some_spec.rb"
116
116
  ) {}
117
117
  custom_example_group.superclass.should == parent_example_group
118
118
  end
119
119
 
120
- it "should use the longest key that matches when creating a type indicated by spec_path" do
120
+ it "should use the longest key that matches when creating a type indicated by location" do
121
121
  longer = Class.new parent_example_group
122
122
  Spec::Example::ExampleGroupFactory.register(:longer, longer)
123
123
  long = Class.new parent_example_group
124
124
  Spec::Example::ExampleGroupFactory.register(:long, long)
125
125
  custom_example_group = Spec::Example::ExampleGroupFactory.create_example_group(
126
- "example_group", :spec_path => "./spec/longer/some_spec.rb"
126
+ "example_group", :location => "./spec/longer/some_spec.rb"
127
127
  ) {}
128
128
  custom_example_group.superclass.should == longer
129
129
  end
130
130
 
131
- it "sets the spec_path from the caller" do
132
- options = {}
133
- shared_example_group = Spec::Example::ExampleGroupFactory.create_example_group("foo", options) {}
134
- options[:spec_path].should =~ /#{__FILE__}:#{__LINE__ - 1}/
135
- end
136
-
137
131
  describe "with :shared => true" do
138
132
  def shared_example_group
139
133
  @shared_example_group ||= Spec::Example::ExampleGroupFactory.create_example_group(
140
- "name", :spec_path => '/blah/spec/models/blah.rb', :type => :controller, :shared => true
134
+ "name", :location => '/blah/spec/models/blah.rb', :type => :controller, :shared => true
141
135
  ) {}
142
136
  end
143
137
 
@@ -147,10 +141,10 @@ module Spec
147
141
  end
148
142
  end
149
143
 
150
- it "should favor the :type over the :spec_path" do
144
+ it "should favor the :type over the :location" do
151
145
  Spec::Example::ExampleGroupFactory.register(:something_other_than_default, parent_example_group)
152
146
  custom_example_group = Spec::Example::ExampleGroupFactory.create_example_group(
153
- "name", :spec_path => '/blah/spec/models/blah.rb', :type => :something_other_than_default
147
+ "name", :location => '/blah/spec/models/blah.rb', :type => :something_other_than_default
154
148
  ) {}
155
149
  custom_example_group.superclass.should == parent_example_group
156
150
  end
@@ -179,12 +173,6 @@ module Spec
179
173
  shared_example_group.should be_an_instance_of(Spec::Example::SharedExampleGroup)
180
174
  SharedExampleGroup.should include(shared_example_group)
181
175
  end
182
-
183
- it "sets the spec_path from the caller" do
184
- options = {}
185
- shared_example_group = Spec::Example::ExampleGroupFactory.create_shared_example_group("foo", options) {}
186
- options[:spec_path].should =~ /#{__FILE__}:#{__LINE__ - 1}/
187
- end
188
176
  end
189
177
 
190
178
  end
@@ -44,7 +44,7 @@ module Spec
44
44
  end
45
45
 
46
46
  it "records the spec path" do
47
- @child_example_group.spec_path.should =~ /#{__FILE__}:#{__LINE__ - 15}/
47
+ @child_example_group.location.should =~ /#{__FILE__}:#{__LINE__ - 15}/
48
48
  end
49
49
  end
50
50
 
@@ -74,24 +74,49 @@ module Spec
74
74
  }.should change { @example_group.examples.length }.by(1)
75
75
  end
76
76
 
77
- describe "creates an ExampleDescription" do
78
- before(:all) do
79
- @example_group = Class.new(ExampleGroupDouble).describe("bar")
80
- @example_description = @example_group.__send__(method, "foo", {:this => :that}, "the backtrace") {}
81
- end
82
-
83
- specify "with a description" do
84
- @example_description.description.should == "foo"
85
- end
77
+ describe "with no location supplied" do
78
+ describe "creates an ExampleProxy" do
79
+ before(:all) do
80
+ @example_group = Class.new(ExampleGroupDouble).describe("bar")
81
+ @example_proxy = @example_group.__send__(method, "foo", {:this => :that}) {}
82
+ end
83
+
84
+ specify "with a description" do
85
+ @example_proxy.description.should == "foo"
86
+ end
86
87
 
87
- specify "with options" do
88
- @example_description.options.should == {:this => :that}
88
+ specify "with options" do
89
+ @example_proxy.options.should == {:this => :that}
90
+ end
91
+
92
+ specify "with a default backtrace" do
93
+ @example_proxy.backtrace.should =~ /#{__FILE__}:#{__LINE__ - 12}/
94
+ end
95
+
96
+ specify "with a default location" do
97
+ @example_proxy.location.should =~ /#{__FILE__}:#{__LINE__ - 16}/
98
+ end
89
99
  end
90
-
91
- specify "with a backtrace" do
92
- @example_description.backtrace.should == "the backtrace"
100
+ end
101
+
102
+ describe "with a location supplied" do
103
+ describe "creates an ExampleProxy" do
104
+ before(:all) do
105
+ @example_group = Class.new(ExampleGroupDouble).describe("bar")
106
+ @example_proxy = @example_group.__send__(method, "foo", {:this => :that}, "the location") {}
107
+ end
108
+
109
+ specify "with the supplied location as #backtrace" do
110
+ @example_proxy.backtrace.should == "the location"
111
+ end
112
+
113
+ specify "with the supplied location as #location" do
114
+ @example_proxy.location.should == "the location"
115
+ end
93
116
  end
94
117
  end
118
+
119
+
95
120
  end
96
121
  end
97
122
 
@@ -334,15 +359,15 @@ module Spec
334
359
 
335
360
  describe "#set_description(Hash representing options)" do
336
361
  before(:each) do
337
- example_group.set_description(:a => "b", :spec_path => "blah")
362
+ example_group.set_description(:a => "b", :location => "blah")
338
363
  end
339
364
 
340
- it ".spec_path should expand the passed in :spec_path option passed into the constructor" do
341
- example_group.spec_path.should == File.expand_path("blah")
365
+ it ".location should expand the passed in :location option passed into the constructor" do
366
+ example_group.location.should == File.expand_path("blah")
342
367
  end
343
368
 
344
369
  it ".options should return all the options passed in" do
345
- example_group.options.should == {:a => "b", :spec_path => "blah"}
370
+ example_group.options.should == {:a => "b", :location => "blah"}
346
371
  end
347
372
 
348
373
  end
@@ -665,4 +690,4 @@ module Spec
665
690
  end
666
691
  end
667
692
  end
668
- end
693
+ end
@@ -0,0 +1,63 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Spec
4
+ module Example
5
+ describe ExampleGroupProxy do
6
+ before(:each) do
7
+ @group = stub("example group").as_null_object
8
+ end
9
+
10
+ attr_reader :group
11
+ def proxy
12
+ @proxy ||= ExampleGroupProxy.new(@group)
13
+ end
14
+
15
+ describe "#description" do
16
+ it "provides the example group's description" do
17
+ group.stub!(:description => "the description")
18
+ proxy.description.should == "the description"
19
+ end
20
+ end
21
+
22
+ describe "#nested_descriptions" do
23
+ it "provides the example group's nested_descriptions" do
24
+ group.stub!(:nested_descriptions => ["the description"])
25
+ proxy.nested_descriptions.should == ["the description"]
26
+ end
27
+ end
28
+
29
+ describe "#filtered_description" do
30
+ it "builds the description from the group's nested_descriptions" do
31
+ group.stub!(:nested_descriptions => ["ignore","the","description"])
32
+ proxy.filtered_description(/ignore/).should == "the description"
33
+ end
34
+ it "filters out description parts that match the supplied regexp" do
35
+ group.stub!(:nested_descriptions => ["ignore this one","the","description"])
36
+ proxy.filtered_description(/ignore/).should == "the description"
37
+ end
38
+ end
39
+
40
+ describe "#examples" do
41
+ it "provides a collection of example group proxies" do
42
+ group.stub!(:example_proxies => ["array","of","proxies"])
43
+ proxy.examples.should == ["array","of","proxies"]
44
+ end
45
+ end
46
+
47
+ describe "#backtrace (deprecated - use #location)" do
48
+ it "provides the location of the declaration of this group" do
49
+ group.stub!(:backtrace => "path/to/location:37")
50
+ proxy.backtrace.should == "path/to/location:37"
51
+ end
52
+ end
53
+
54
+ describe "#location" do
55
+ it "provides the location of the declaration of this group" do
56
+ group.stub!(:location => "path/to/location:37")
57
+ proxy.location.should == "path/to/location:37"
58
+ end
59
+ end
60
+
61
+ end
62
+ end
63
+ end
@@ -108,6 +108,21 @@ module Spec
108
108
  reporter.should_not_receive(:add_example_group)
109
109
  example_group.run(options)
110
110
  end
111
+
112
+ it "should report the start of an example run" do
113
+ reporter.should_receive(:example_started) do |example|
114
+ example.should equal(example_group.examples[0])
115
+ end
116
+ example_group.run(options)
117
+ end
118
+
119
+ it "should report the end of an example run" do
120
+ reporter.should_receive(:example_finished) do |example, execution_error|
121
+ example.should equal(example_group.examples[0])
122
+ execution_error.should be_nil
123
+ end
124
+ example_group.run(options)
125
+ end
111
126
 
112
127
  describe "when before_each fails" do
113
128
  before(:each) do