rspec 0.9.4 → 1.0.0

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 (59) hide show
  1. data/CHANGES +24 -0
  2. data/EXAMPLES.rd +6 -2
  3. data/README +9 -9
  4. data/Rakefile +32 -29
  5. data/examples/not_yet_implemented_spec.rb +12 -0
  6. data/examples/shared_behaviours_example.rb +8 -0
  7. data/examples/stack_spec.rb +1 -0
  8. data/lib/spec/dsl/behaviour.rb +21 -6
  9. data/lib/spec/dsl/behaviour_callbacks.rb +44 -26
  10. data/lib/spec/dsl/behaviour_eval.rb +21 -12
  11. data/lib/spec/dsl/behaviour_factory.rb +23 -13
  12. data/lib/spec/dsl/configuration.rb +85 -5
  13. data/lib/spec/dsl/description.rb +14 -6
  14. data/lib/spec/dsl/example.rb +2 -2
  15. data/lib/spec/matchers.rb +5 -5
  16. data/lib/spec/matchers/be.rb +16 -0
  17. data/lib/spec/matchers/operator_matcher.rb +21 -1
  18. data/lib/spec/matchers/raise_error.rb +1 -1
  19. data/lib/spec/rake/verify_rcov.rb +5 -1
  20. data/lib/spec/runner.rb +7 -27
  21. data/lib/spec/runner/behaviour_runner.rb +1 -1
  22. data/lib/spec/runner/extensions/kernel.rb +20 -0
  23. data/lib/spec/runner/formatter/base_formatter.rb +6 -1
  24. data/lib/spec/runner/formatter/base_text_formatter.rb +10 -2
  25. data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +1 -1
  26. data/lib/spec/runner/formatter/failing_examples_formatter.rb +1 -1
  27. data/lib/spec/runner/formatter/html_formatter.rb +63 -31
  28. data/lib/spec/runner/formatter/progress_bar_formatter.rb +5 -0
  29. data/lib/spec/runner/formatter/rdoc_formatter.rb +4 -0
  30. data/lib/spec/runner/formatter/specdoc_formatter.rb +6 -1
  31. data/lib/spec/runner/option_parser.rb +1 -1
  32. data/lib/spec/runner/reporter.rb +13 -4
  33. data/lib/spec/runner/spec_parser.rb +1 -1
  34. data/lib/spec/version.rb +5 -5
  35. data/spec/spec/dsl/behaviour_spec.rb +88 -24
  36. data/spec/spec/dsl/configuration_spec.rb +8 -1
  37. data/spec/spec/dsl/example_class_spec.rb +1 -1
  38. data/spec/spec/dsl/example_instance_spec.rb +5 -5
  39. data/spec/spec/dsl/shared_behaviour_spec.rb +24 -2
  40. data/spec/spec/matchers/be_spec.rb +20 -2
  41. data/spec/spec/matchers/operator_matcher_spec.rb +158 -0
  42. data/spec/spec/runner/command_line_spec.rb +5 -4
  43. data/spec/spec/runner/drb_command_line_spec.rb +15 -8
  44. data/spec/spec/runner/formatter/html_formatter_spec.rb +22 -5
  45. data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +1 -1
  46. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +7 -2
  47. data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +1 -1
  48. data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +6 -1
  49. data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +1 -1
  50. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +15 -5
  51. data/spec/spec/runner/option_parser_spec.rb +5 -0
  52. data/spec/spec/runner/reporter_spec.rb +23 -5
  53. data/spec/spec/runner/spec_matcher_spec.rb +1 -1
  54. data/spec/spec/runner/spec_parser_spec.rb +1 -1
  55. data/spec/spec_helper.rb +38 -2
  56. metadata +41 -42
  57. data/spec/spec/matchers/should_===_spec.rb +0 -38
  58. data/spec/spec/matchers/should_==_spec.rb +0 -37
  59. data/spec/spec/matchers/should_=~_spec.rb +0 -36
data/CHANGES CHANGED
@@ -1,5 +1,29 @@
1
1
  = RSpec Changelog
2
2
 
3
+ == Version 1.0.0
4
+ The stake in the ground release. This represents a commitment to the API as it is. No significant
5
+ backwards compatibility changes in the API are expected after this release.
6
+
7
+ * Fixed [#10923] have_text matcher does not support should_not
8
+ * Fixed [#10673] should > and should >= broken
9
+ * Applied [#10921] Allow verify_rcov to accept greater than threshold coverage %'s via configuration
10
+ * Applied [#10920] Added support for not implemented examples (Patch from Chad Humphries)
11
+ * Patch to allow not implemented examples. This works by not providing a block to the example. (Patch from Chad Humphries, Ken Barker)
12
+ * Yanked support for Rails 1.1.6 in Spec::Rails
13
+ * RSpec.tmbundle uses CMD-SHIFT-R to run focused examples now.
14
+ * Spec::Rails now bundles a spec:rcov task by default (suggestion from Kurt Schrader)
15
+ * Fixed [#10814] Runner loads shared code, test cases require them again
16
+ * Fixed [#10753] Global before and after
17
+ * Fixed [#10774] Allow before and after to be specified in config II
18
+ * Refactored Spec::Ui examples to use new global before and after blocks.
19
+ * Added instructions about how to get Selenium working with Spec::Ui (spec_ui/examples/selenium/README.txt)
20
+ * Fixed [#10805] selenium.rb missing from gem?
21
+ * Added rdocs explaining how to deal with errors in Rails' controller actions
22
+ * Applied [#10770] Finer grained includes.
23
+ * Fixed [#10747] Helper methods defined in shared specs are not visible when shared spec is used
24
+ * Fixed [#10748] Shared descriptions in separate files causes 'already exists' error
25
+ * Applied [#10698] Running with --drb executes specs twice (patch from Ruy Asan)
26
+
3
27
  == Version 0.9.4
4
28
  This release introduces massive improvements to Spec::Ui - the user interface functional testing
5
29
  extension to RSpec. There are also some minor bug fixes to the RSpec core.
@@ -43,6 +43,9 @@
43
43
  # a mock
44
44
  # * should be able to mock the same message twice w/ different args
45
45
  # * should be able to mock the same message twice w/ different args in reverse order
46
+ # Stack (not implemented features)
47
+ # * should transform to xml using #to_xml [NOT IMPLEMENTED]
48
+ # * should convert from xml using #from_xml [NOT IMPLEMENTED]
46
49
  # A partial mock
47
50
  # * should work at the class level
48
51
  # * should revert to the original after each spec
@@ -52,6 +55,7 @@
52
55
  # * should be intuitive
53
56
  # SharedBehaviourExample::OneThing
54
57
  # * should do what things do
58
+ # * should have access to helper methods defined in the shared behaviour
55
59
  # SharedBehaviourExample::AnotherThing
56
60
  # * should do what things do
57
61
  # Stack (empty)
@@ -99,6 +103,6 @@
99
103
  # * RSpec should be able to access TestCase methods
100
104
  # * RSpec should be able to accept included modules
101
105
 
102
- Finished in 0.030613 seconds
106
+ Finished in 0.025956 seconds
103
107
 
104
- 74 examples, 0 failures
108
+ 77 examples, 0 failures, 2 not implemented
data/README CHANGED
@@ -49,15 +49,15 @@ In order to run RSpec's full suite of specs (rake pre_commit) you must install t
49
49
 
50
50
  Once those are all installed, you should be able to run the suite with the following steps:
51
51
 
52
- svn co svn://rubyforge.org/var/svn/rspec/trunk rspec
53
- cd rspec
54
- rake install_dependencies
55
- cd example_rails_app
56
- export RSPEC_RAILS_VERSION=1.2.3
57
- rake rspec:generate_mysql_config
58
- mysql -u root < db/mysql_setup.sql
59
- cd ..
60
- rake pre_commit
52
+ * svn co svn://rubyforge.org/var/svn/rspec/trunk rspec
53
+ * cd rspec
54
+ * rake install_dependencies
55
+ * cd example_rails_app
56
+ * export RSPEC_RAILS_VERSION=1.2.3
57
+ * rake rspec:generate_mysql_config
58
+ * mysql -u root < db/mysql_setup.sql
59
+ * cd ..
60
+ * rake pre_commit
61
61
 
62
62
 
63
63
  Note that RSpec itself - once built - doesn't have any dependencies outside the Ruby core
data/Rakefile CHANGED
@@ -5,6 +5,9 @@ require 'rake/contrib/rubyforgepublisher'
5
5
  require 'rake/clean'
6
6
  require 'rake/rdoctask'
7
7
  require 'spec/version'
8
+ dir = File.dirname(__FILE__)
9
+ $LOAD_PATH.unshift(File.expand_path("#{dir}/../pre_commit/lib"))
10
+ require "pre_commit"
8
11
 
9
12
  # Some of the tasks are in separate files since they are also part of the website documentation
10
13
  load File.dirname(__FILE__) + '/rake_tasks/examples.rake'
@@ -30,7 +33,7 @@ task :default => [:verify_rcov]
30
33
  desc "Run all specs"
31
34
  Spec::Rake::SpecTask.new do |t|
32
35
  t.spec_files = FileList[
33
- 'spec/**/*_spec.rb',
36
+ 'spec/**/*_spec.rb',
34
37
  '../RSpec.tmbundle/Support/spec/*_spec.rb'
35
38
  # TODO: get these in too - need to fix coverage
36
39
  # '../spec_ui/spec/**/*_spec.rb'
@@ -67,16 +70,7 @@ end
67
70
 
68
71
  desc 'Generate HTML documentation for website'
69
72
  task :webgen do
70
- Dir.chdir '../doc' do
71
- output = nil
72
- IO.popen('webgen 2>&1') do |io|
73
- output = io.read
74
- end
75
- raise "ERROR while running webgen: #{output}" if output =~ /ERROR/n || $? != 0
76
- end
77
- spec_page = File.expand_path(File.dirname(__FILE__) + '/../doc/output/tools/spec.html')
78
- spec_page_content = File.open(spec_page).read
79
- raise "#{'!'*400}\nIt seems like the output in the generated documentation is broken (no dots: ......)\n. Look in #{spec_page}" unless spec_page_content =~/\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\./m
73
+ core.webgen
80
74
  end
81
75
 
82
76
  desc 'Generate RDoc'
@@ -85,15 +79,19 @@ rd = Rake::RDocTask.new do |rdoc|
85
79
  rdoc.options << '--title' << 'RSpec' << '--line-numbers' << '--inline-source' << '--main' << 'README'
86
80
  rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'EXAMPLES.rd', 'UPGRADE', 'lib/**/*.rb')
87
81
  end
88
- task :rdoc => :examples_specdoc # We generate EXAMPLES.rd
82
+
83
+ desc "Generate EXAMPLES.rb"
84
+ task :rdoc do
85
+ core.rdoc
86
+ end
89
87
 
90
88
  spec = Gem::Specification.new do |s|
91
89
  s.name = PKG_NAME
92
90
  s.version = PKG_VERSION
93
91
  s.summary = Spec::VERSION::DESCRIPTION
94
92
  s.description = <<-EOF
95
- RSpec is a behaviour driven development (BDD) framework for Ruby. RSpec was
96
- created in response to Dave Astels' article _A New Look at Test Driven Development_
93
+ RSpec is a behaviour driven development (BDD) framework for Ruby. RSpec was
94
+ created in response to Dave Astels' article _A New Look at Test Driven Development_
97
95
  which can be read at: http://daveastels.com/index.php?p=5 RSpec is intended to
98
96
  provide the features discussed in Dave's article.
99
97
  EOF
@@ -104,7 +102,7 @@ spec = Gem::Specification.new do |s|
104
102
  s.has_rdoc = true
105
103
  s.rdoc_options = rd.options
106
104
  s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$|^EXAMPLES.rd$/ }.to_a
107
-
105
+
108
106
  s.autorequire = 'spec'
109
107
  s.bindir = 'bin'
110
108
  s.executables = ['spec', 'spec_translator']
@@ -140,8 +138,7 @@ task :todo do
140
138
  end
141
139
 
142
140
  task :clobber do
143
- rm_rf '../doc/output'
144
- rm_rf 'translated_specs'
141
+ core.clobber
145
142
  end
146
143
 
147
144
  task :release => [:clobber, :verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_website, :publish_news]
@@ -167,21 +164,13 @@ task :tag do
167
164
  end
168
165
 
169
166
  desc "Run this task before you commit. You should see 'OK TO COMMIT'"
170
- task :pre_commit => [
171
- :website,
172
- :examples,
173
- :translated_specs,
174
- :failing_examples_with_html
175
- ]
167
+ task(:pre_commit) {core.pre_commit}
176
168
 
177
169
  desc "Build the website, but do not publish it"
178
- task :website => [:clobber, :verify_rcov, :spec_html, :webgen, :failing_examples_with_html, :examples_specdoc, :rdoc, :rdoc_rails]
170
+ task(:website) {core.website}
179
171
 
180
172
  task :rdoc_rails do
181
- Dir.chdir '../rspec_on_rails' do
182
- rake = (PLATFORM == "i386-mswin32") ? "rake.cmd" : "rake"
183
- `#{rake} rdoc`
184
- end
173
+ core.rdoc_rails
185
174
  end
186
175
 
187
176
  task :verify_user do
@@ -202,6 +191,16 @@ task :publish_website => [:verify_user, :website] do
202
191
  end
203
192
  end
204
193
 
194
+ desc "Upload Website archive to RubyForge"
195
+ task :archive_website => [:verify_user, :website] do
196
+ publisher = Rake::SshDirPublisher.new(
197
+ "rspec-website@rubyforge.org",
198
+ "/var/www/gforge-projects/#{PKG_NAME}/#{Spec::VERSION::TAG}",
199
+ "../doc/output"
200
+ )
201
+ publisher.upload
202
+ end
203
+
205
204
  desc "Package the RSpec.tmbundle"
206
205
  task :package_tmbundle do
207
206
  mkdir 'pkg' rescue nil
@@ -255,7 +254,7 @@ task :publish_packages => [:verify_user, :package] do
255
254
  *release_files
256
255
  )
257
256
  publisher.upload
258
-
257
+
259
258
  puts "UPLADED THE FOLLOWING FILES:"
260
259
  release_files.each do |file|
261
260
  name = file.match(/pkg\/(.*)/)[1]
@@ -279,3 +278,7 @@ task :publish_news => [:verify_user] do
279
278
  puts "** Not publishing news to RubyForge - this is a prerelease"
280
279
  end
281
280
  end
281
+
282
+ def core
283
+ PreCommit::Core.new(self)
284
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.dirname(__FILE__) + "/stack"
3
+
4
+ describe Stack, ' (not implemented features)' do
5
+ before(:each) do
6
+ @stack = Stack.new
7
+ end
8
+
9
+ it "should transform to xml using #to_xml"
10
+
11
+ it "should convert from xml using #from_xml"
12
+ end
@@ -14,6 +14,10 @@ module SharedBehaviourExample
14
14
  end
15
15
 
16
16
  describe "All Things", :shared => true do
17
+ def helper_method
18
+ "helper method"
19
+ end
20
+
17
21
  it "should do what things do" do
18
22
  @thing.what_things_do.should == "stuff"
19
23
  end
@@ -22,6 +26,10 @@ module SharedBehaviourExample
22
26
  describe OneThing do
23
27
  it_should_behave_like "All Things"
24
28
  before(:each) { @thing = OneThing.new }
29
+
30
+ it "should have access to helper methods defined in the shared behaviour" do
31
+ helper_method.should == "helper method"
32
+ end
25
33
  end
26
34
 
27
35
  describe AnotherThing do
@@ -93,4 +93,5 @@ describe Stack, " (full)" do
93
93
  it "should complain on #push" do
94
94
  lambda { @stack.push Object.new }.should raise_error(StackOverflowError)
95
95
  end
96
+
96
97
  end
@@ -6,7 +6,8 @@ module Spec
6
6
 
7
7
  class << self
8
8
  def add_shared_behaviour(behaviour)
9
- raise ArgumentError.new("Shared Behaviour '#{behaviour.description}' already exists") if find_shared_behaviour(behaviour.description)
9
+ return if behaviour.equal?(found_behaviour = find_shared_behaviour(behaviour.description))
10
+ raise ArgumentError.new("Shared Behaviour '#{behaviour.description}' already exists") if found_behaviour
10
11
  shared_behaviours << behaviour
11
12
  end
12
13
 
@@ -66,12 +67,12 @@ module Spec
66
67
  if errors.empty?
67
68
  specs.each do |example|
68
69
  example_execution_context = execution_context(example)
69
- example_execution_context.copy_instance_variables_from(@before_and_after_all_context_instance) unless before_all_proc.nil?
70
- example.run(reporter, before_each_proc, after_each_proc, dry_run, example_execution_context, timeout)
70
+ example_execution_context.copy_instance_variables_from(@before_and_after_all_context_instance) unless before_all_proc(behaviour_type).nil?
71
+ example.run(reporter, before_each_proc(behaviour_type), after_each_proc(behaviour_type), dry_run, example_execution_context, timeout)
71
72
  end
72
73
  end
73
74
 
74
- @before_and_after_all_context_instance.copy_instance_variables_from(example_execution_context) unless after_all_proc.nil?
75
+ @before_and_after_all_context_instance.copy_instance_variables_from(example_execution_context) unless after_all_proc(behaviour_type).nil?
75
76
  run_after_all(reporter, dry_run)
76
77
  end
77
78
 
@@ -106,8 +107,22 @@ module Spec
106
107
  my_methods
107
108
  end
108
109
 
110
+ # Includes modules in the Behaviour (the <tt>describe</tt> block).
111
+ def include(*args)
112
+ args << {} unless Hash === args.last
113
+ modules, options = args_and_options(*args)
114
+ required_behaviour_type = options[:behaviour_type]
115
+ if required_behaviour_type.nil? || required_behaviour_type.to_sym == behaviour_type.to_sym
116
+ @eval_module.include(*modules)
117
+ end
118
+ end
119
+
109
120
  protected
110
121
 
122
+ def behaviour_type #:nodoc:
123
+ @description[:behaviour_type]
124
+ end
125
+
111
126
  # Messages that this class does not understand
112
127
  # are passed directly to the @eval_module.
113
128
  def method_missing(sym, *args, &block)
@@ -144,7 +159,7 @@ module Spec
144
159
  unless dry_run
145
160
  begin
146
161
  @before_and_after_all_context_instance = execution_context(nil)
147
- @before_and_after_all_context_instance.instance_eval(&before_all_proc)
162
+ @before_and_after_all_context_instance.instance_eval(&before_all_proc(behaviour_type))
148
163
  rescue => e
149
164
  errors << e
150
165
  location = "before(:all)"
@@ -158,7 +173,7 @@ module Spec
158
173
  unless dry_run
159
174
  begin
160
175
  @before_and_after_all_context_instance ||= execution_context(nil)
161
- @before_and_after_all_context_instance.instance_eval(&after_all_proc)
176
+ @before_and_after_all_context_instance.instance_eval(&after_all_proc(behaviour_type))
162
177
  rescue => e
163
178
  location = "after(:all)"
164
179
  reporter.example_finished(location, e, location) if reporter
@@ -1,31 +1,38 @@
1
1
  module Spec
2
2
  module DSL
3
3
  module BehaviourCallbacks
4
- def prepend_before(scope=:each, &block)
5
- case scope
6
- when :each; before_each_parts.unshift(block)
7
- when :all; before_all_parts.unshift(block)
8
- end
4
+ def prepend_before(*args, &block)
5
+ scope, options = scope_and_options(*args)
6
+ add(scope, options, :before, :unshift, &block)
9
7
  end
10
- def append_before(scope=:each, &block)
11
- case scope
12
- when :each; before_each_parts << block
13
- when :all; before_all_parts << block
14
- end
8
+ def append_before(*args, &block)
9
+ scope, options = scope_and_options(*args)
10
+ add(scope, options, :before, :<<, &block)
15
11
  end
16
12
  alias_method :before, :append_before
17
13
 
18
- def prepend_after(scope=:each, &block)
19
- case scope
20
- when :each; after_each_parts.unshift(block)
21
- when :all; after_all_parts.unshift(block)
22
- end
14
+ def prepend_after(*args, &block)
15
+ scope, options = scope_and_options(*args)
16
+ add(scope, options, :after, :unshift, &block)
23
17
  end
24
18
  alias_method :after, :prepend_after
25
- def append_after(scope=:each, &block)
19
+ def append_after(*args, &block)
20
+ scope, options = scope_and_options(*args)
21
+ add(scope, options, :after, :<<, &block)
22
+ end
23
+
24
+ def scope_and_options(*args)
25
+ args, options = args_and_options(*args)
26
+ scope = (args[0] || :each), options
27
+ end
28
+
29
+ def add(scope, options, where, how, &block)
30
+ scope ||= :each
31
+ options ||= {}
32
+ behaviour_type = options[:behaviour_type]
26
33
  case scope
27
- when :each; after_each_parts << block
28
- when :all; after_all_parts << block
34
+ when :each; self.__send__("#{where}_each_parts", behaviour_type).__send__(how, block)
35
+ when :all; self.__send__("#{where}_all_parts", behaviour_type).__send__(how, block)
29
36
  end
30
37
  end
31
38
 
@@ -39,20 +46,31 @@ module Spec
39
46
  after(:each, &block)
40
47
  end
41
48
 
42
- def before_all_parts # :nodoc:
43
- @before_all_parts ||= []
49
+ def before_all_parts(behaviour_type=nil) # :nodoc:
50
+ @before_all_parts ||= {}
51
+ @before_all_parts[behaviour_type] ||= []
52
+ end
53
+
54
+ def after_all_parts(behaviour_type=nil) # :nodoc:
55
+ @after_all_parts ||= {}
56
+ @after_all_parts[behaviour_type] ||= []
44
57
  end
45
58
 
46
- def after_all_parts # :nodoc:
47
- @after_all_parts ||= []
59
+ def before_each_parts(behaviour_type=nil) # :nodoc:
60
+ @before_each_parts ||= {}
61
+ @before_each_parts[behaviour_type] ||= []
48
62
  end
49
63
 
50
- def before_each_parts # :nodoc:
51
- @before_each_parts ||= []
64
+ def after_each_parts(behaviour_type=nil) # :nodoc:
65
+ @after_each_parts ||= {}
66
+ @after_each_parts[behaviour_type] ||= []
52
67
  end
53
68
 
54
- def after_each_parts # :nodoc:
55
- @after_each_parts ||= []
69
+ def clear_before_and_after! # :nodoc:
70
+ @before_all_parts = nil
71
+ @after_all_parts = nil
72
+ @before_each_parts = nil
73
+ @after_each_parts = nil
56
74
  end
57
75
  end
58
76
  end
@@ -35,6 +35,7 @@ module Spec
35
35
  before_all_parts.each { |p| eval_module.before_all_parts << p }
36
36
  after_all_parts.each { |p| eval_module.after_all_parts << p }
37
37
  included_modules.each { |m| eval_module.included_modules << m }
38
+ eval_module.included_modules << self
38
39
  end
39
40
 
40
41
  # :call-seq:
@@ -97,31 +98,39 @@ module Spec
97
98
  super
98
99
  end
99
100
 
100
- def before_all_proc(&error_handler)
101
+ def before_all_proc(behaviour_type, &error_handler)
101
102
  parts = []
102
- parts.push(*Behaviour.before_all_parts)
103
- parts.push(*before_all_parts)
103
+ parts.push(*Behaviour.before_all_parts(nil))
104
+ parts.push(*Behaviour.before_all_parts(behaviour_type)) unless behaviour_type.nil?
105
+ parts.push(*before_all_parts(nil))
106
+ parts.push(*before_all_parts(behaviour_type)) unless behaviour_type.nil?
104
107
  CompositeProcBuilder.new(parts).proc(&error_handler)
105
108
  end
106
109
 
107
- def after_all_proc(&error_handler)
110
+ def after_all_proc(behaviour_type, &error_handler)
108
111
  parts = []
109
- parts.push(*after_all_parts)
110
- parts.push(*Behaviour.after_all_parts)
112
+ parts.push(*after_all_parts(behaviour_type)) unless behaviour_type.nil?
113
+ parts.push(*after_all_parts(nil))
114
+ parts.push(*Behaviour.after_all_parts(behaviour_type)) unless behaviour_type.nil?
115
+ parts.push(*Behaviour.after_all_parts(nil))
111
116
  CompositeProcBuilder.new(parts).proc(&error_handler)
112
117
  end
113
118
 
114
- def before_each_proc(&error_handler)
119
+ def before_each_proc(behaviour_type, &error_handler)
115
120
  parts = []
116
- parts.push(*Behaviour.before_each_parts)
117
- parts.push(*before_each_parts)
121
+ parts.push(*Behaviour.before_each_parts(nil))
122
+ parts.push(*Behaviour.before_each_parts(behaviour_type)) unless behaviour_type.nil?
123
+ parts.push(*before_each_parts(nil))
124
+ parts.push(*before_each_parts(behaviour_type)) unless behaviour_type.nil?
118
125
  CompositeProcBuilder.new(parts).proc(&error_handler)
119
126
  end
120
127
 
121
- def after_each_proc(&error_handler)
128
+ def after_each_proc(behaviour_type, &error_handler)
122
129
  parts = []
123
- parts.push(*after_each_parts)
124
- parts.push(*Behaviour.after_each_parts)
130
+ parts.push(*after_each_parts(behaviour_type)) unless behaviour_type.nil?
131
+ parts.push(*after_each_parts(nil))
132
+ parts.push(*Behaviour.after_each_parts(behaviour_type)) unless behaviour_type.nil?
133
+ parts.push(*Behaviour.after_each_parts(nil))
125
134
  CompositeProcBuilder.new(parts).proc(&error_handler)
126
135
  end
127
136