rspec 1.1.4 → 1.1.5
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.
- data/{CHANGES → History.txt} +116 -64
- data/Manifest.txt +403 -0
- data/{MIT-LICENSE → README.txt} +43 -0
- data/Rakefile +39 -212
- data/{TODO → TODO.txt} +0 -0
- data/bin/autospec +4 -0
- data/bin/spec +1 -1
- data/examples/pure/yielding_example.rb +33 -0
- data/examples/stories/game-of-life/.loadpath +5 -0
- data/examples/stories/game-of-life/behaviour/everything.rb +1 -1
- data/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story +17 -17
- data/init.rb +9 -0
- data/lib/autotest/discover.rb +1 -1
- data/lib/autotest/rspec.rb +3 -29
- data/lib/spec.rb +10 -12
- data/lib/spec/adapters.rb +1 -0
- data/lib/spec/adapters/ruby_engine.rb +26 -0
- data/lib/spec/adapters/ruby_engine/mri.rb +8 -0
- data/lib/spec/adapters/ruby_engine/rubinius.rb +8 -0
- data/lib/spec/example/errors.rb +6 -0
- data/lib/spec/example/example_group_methods.rb +17 -14
- data/lib/spec/example/example_matcher.rb +2 -0
- data/lib/spec/example/example_methods.rb +4 -9
- data/lib/spec/example/module_inclusion_warnings.rb +2 -1
- data/lib/spec/expectations/extensions/object.rb +2 -2
- data/lib/spec/expectations/handler.rb +8 -16
- data/lib/spec/extensions/main.rb +2 -17
- data/lib/spec/matchers.rb +8 -2
- data/lib/spec/matchers/be.rb +0 -3
- data/lib/spec/matchers/change.rb +44 -40
- data/lib/spec/matchers/has.rb +1 -1
- data/lib/spec/matchers/have.rb +17 -12
- data/lib/spec/matchers/operator_matcher.rb +10 -4
- data/lib/spec/matchers/simple_matcher.rb +113 -10
- data/lib/spec/mocks.rb +1 -1
- data/lib/spec/mocks/argument_constraints.rb +185 -0
- data/lib/spec/mocks/argument_expectation.rb +35 -173
- data/lib/spec/mocks/framework.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +30 -5
- data/lib/spec/mocks/methods.rb +14 -2
- data/lib/spec/mocks/mock.rb +4 -0
- data/lib/spec/mocks/proxy.rb +46 -5
- data/lib/spec/mocks/spec_methods.rb +9 -1
- data/lib/spec/rake/spectask.rb +14 -22
- data/lib/spec/rake/verify_rcov.rb +3 -3
- data/lib/spec/runner.rb +18 -6
- data/lib/spec/runner/backtrace_tweaker.rb +6 -7
- data/lib/spec/runner/command_line.rb +6 -17
- data/lib/spec/runner/drb_command_line.rb +1 -1
- data/lib/spec/runner/formatter/base_formatter.rb +3 -1
- data/lib/spec/runner/formatter/base_text_formatter.rb +5 -9
- data/lib/spec/runner/formatter/html_formatter.rb +1 -1
- data/lib/spec/runner/formatter/nested_text_formatter.rb +1 -1
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +2 -2
- data/lib/spec/runner/formatter/specdoc_formatter.rb +1 -1
- data/lib/spec/runner/formatter/story/html_formatter.rb +62 -16
- data/lib/spec/runner/formatter/story/plain_text_formatter.rb +68 -16
- data/lib/spec/runner/formatter/story/progress_bar_formatter.rb +42 -0
- data/lib/spec/runner/heckle_runner.rb +2 -2
- data/lib/spec/runner/option_parser.rb +2 -1
- data/lib/spec/runner/options.rb +18 -9
- data/lib/spec/runner/reporter.rb +24 -4
- data/lib/spec/runner/spec_parser.rb +1 -1
- data/lib/spec/story/runner.rb +1 -2
- data/lib/spec/story/runner/story_mediator.rb +14 -0
- data/lib/spec/story/runner/story_parser.rb +20 -0
- data/lib/spec/story/step.rb +40 -28
- data/lib/spec/story/step_mother.rb +2 -1
- data/lib/spec/story/world.rb +6 -2
- data/lib/spec/version.rb +13 -22
- data/rake_tasks/failing_examples_with_html.rake +1 -1
- data/rake_tasks/verify_rcov.rake +2 -2
- data/rspec.gemspec +33 -0
- data/spec/autotest/rspec_spec.rb +90 -141
- data/spec/spec/adapters/ruby_engine_spec.rb +16 -0
- data/spec/spec/example/base_formatter_spec.rb +112 -0
- data/spec/spec/example/example_group_factory_spec.rb +2 -2
- data/spec/spec/example/example_group_methods_spec.rb +55 -4
- data/spec/spec/example/example_group_spec.rb +4 -3
- data/spec/spec/example/example_methods_spec.rb +18 -14
- data/spec/spec/example/pending_module_spec.rb +38 -0
- data/spec/spec/example/shared_example_group_spec.rb +1 -1
- data/spec/spec/expectations/extensions/object_spec.rb +0 -12
- data/spec/spec/extensions/main_spec.rb +3 -8
- data/spec/spec/matchers/change_spec.rb +16 -6
- data/spec/spec/matchers/handler_spec.rb +58 -37
- data/spec/spec/matchers/has_spec.rb +10 -0
- data/spec/spec/matchers/have_spec.rb +105 -2
- data/spec/spec/matchers/operator_matcher_spec.rb +35 -2
- data/spec/spec/matchers/simple_matcher_spec.rb +64 -2
- data/spec/spec/mocks/any_number_of_times_spec.rb +7 -0
- data/spec/spec/mocks/bug_report_496.rb +17 -0
- data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +7 -1
- data/spec/spec/mocks/hash_including_matcher_spec.rb +45 -24
- data/spec/spec/mocks/mock_spec.rb +55 -10
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +54 -0
- data/spec/spec/mocks/null_object_mock_spec.rb +14 -0
- data/spec/spec/mocks/options_hash_spec.rb +18 -28
- data/spec/spec/mocks/partial_mock_spec.rb +2 -0
- data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +20 -6
- data/spec/spec/mocks/stub_spec.rb +7 -0
- data/spec/spec/runner/command_line_spec.rb +5 -12
- data/spec/spec/runner/drb_command_line_spec.rb +13 -6
- data/spec/spec/runner/formatter/html_formatter_spec.rb +2 -1
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +3 -3
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +20 -2
- data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +2 -1
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +3 -3
- data/spec/spec/runner/formatter/story/html_formatter_spec.rb +76 -2
- data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +161 -0
- data/spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb +82 -0
- data/spec/spec/runner/heckle_runner_spec.rb +8 -8
- data/spec/spec/runner/option_parser_spec.rb +21 -6
- data/spec/spec/runner/output_one_time_fixture_runner.rb +1 -1
- data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +6 -0
- data/spec/spec/runner/reporter_spec.rb +51 -5
- data/spec/spec/runner/spec_parser_spec.rb +4 -4
- data/spec/spec/story/runner/plain_text_story_runner_spec.rb +2 -5
- data/spec/spec/story/runner/story_mediator_spec.rb +10 -0
- data/spec/spec/story/runner/story_parser_spec.rb +23 -6
- data/spec/spec/story/scenario_spec.rb +1 -3
- data/spec/spec/story/step_mother_spec.rb +12 -0
- data/spec/spec/story/step_spec.rb +57 -4
- data/spec/spec/story/story_spec.rb +1 -3
- data/spec/spec/story/world_spec.rb +1 -1
- data/spec/spec_helper.rb +21 -68
- data/stories/all.rb +1 -1
- data/stories/configuration/before_blocks.story +21 -0
- data/stories/configuration/stories.rb +7 -0
- data/stories/example_groups/stories.rb +3 -4
- data/stories/resources/spec/before_blocks_example.rb +32 -0
- data/stories/stories/multiline_steps.story +23 -0
- data/stories/stories/steps/multiline_steps.rb +13 -0
- data/stories/stories/stories.rb +6 -0
- data/story_server/prototype/javascripts/builder.js +136 -0
- data/story_server/prototype/javascripts/controls.js +972 -0
- data/story_server/prototype/javascripts/dragdrop.js +976 -0
- data/story_server/prototype/javascripts/effects.js +1117 -0
- data/story_server/prototype/javascripts/prototype.js +4140 -0
- data/story_server/prototype/javascripts/rspec.js +149 -0
- data/story_server/prototype/javascripts/scriptaculous.js +58 -0
- data/story_server/prototype/javascripts/slider.js +276 -0
- data/story_server/prototype/javascripts/sound.js +55 -0
- data/story_server/prototype/javascripts/unittest.js +568 -0
- data/story_server/prototype/lib/server.rb +24 -0
- data/story_server/prototype/stories.html +176 -0
- data/story_server/prototype/stylesheets/rspec.css +136 -0
- data/story_server/prototype/stylesheets/test.css +90 -0
- metadata +166 -166
- data/README +0 -36
- data/UPGRADE +0 -7
- data/bin/spec_translator +0 -8
- data/lib/spec/mocks/argument_constraint_matchers.rb +0 -31
- data/lib/spec/translator.rb +0 -114
- data/spec/spec/example/example_spec.rb +0 -53
- data/spec/spec/runner/execution_context_spec.rb +0 -37
- data/spec/spec/translator_spec.rb +0 -265
data/{TODO → TODO.txt}
RENAMED
|
File without changes
|
data/bin/autospec
ADDED
data/bin/spec
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
class MessageAppender
|
|
4
|
+
|
|
5
|
+
def initialize(appendage)
|
|
6
|
+
@appendage = appendage
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def append_to(message)
|
|
10
|
+
if_told_to_yield do
|
|
11
|
+
message << @appendage
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "a message expectation yielding to a block" do
|
|
18
|
+
it "should yield if told to" do
|
|
19
|
+
appender = MessageAppender.new("appended to")
|
|
20
|
+
appender.should_receive(:if_told_to_yield).and_yield
|
|
21
|
+
message = ""
|
|
22
|
+
appender.append_to(message)
|
|
23
|
+
message.should == "appended to"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should not yield if not told to" do
|
|
27
|
+
appender = MessageAppender.new("appended to")
|
|
28
|
+
appender.should_receive(:if_told_to_yield)
|
|
29
|
+
message = ""
|
|
30
|
+
appender.append_to(message)
|
|
31
|
+
message.should == ""
|
|
32
|
+
end
|
|
33
|
+
end
|
data/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Story: cells with more than three neighbours die
|
|
2
2
|
|
|
3
|
-
As a game producer
|
|
4
|
-
I want cells with more than three neighbours to die
|
|
5
|
-
So that I can show the people with money how we are getting on
|
|
3
|
+
As a game producer
|
|
4
|
+
I want cells with more than three neighbours to die
|
|
5
|
+
So that I can show the people with money how we are getting on
|
|
6
6
|
|
|
7
|
-
Scenario: blink
|
|
7
|
+
Scenario: blink
|
|
8
8
|
|
|
9
|
-
Given the grid looks like
|
|
10
|
-
.....
|
|
11
|
-
...XX
|
|
12
|
-
...XX
|
|
13
|
-
.XX..
|
|
14
|
-
.XX..
|
|
15
|
-
When the next step occurs
|
|
16
|
-
Then the grid should look like
|
|
17
|
-
.....
|
|
18
|
-
...XX
|
|
19
|
-
....X
|
|
20
|
-
.X...
|
|
21
|
-
.XX..
|
|
9
|
+
Given the grid looks like
|
|
10
|
+
.....
|
|
11
|
+
...XX
|
|
12
|
+
...XX
|
|
13
|
+
.XX..
|
|
14
|
+
.XX..
|
|
15
|
+
When the next step occurs
|
|
16
|
+
Then the grid should look like
|
|
17
|
+
.....
|
|
18
|
+
...XX
|
|
19
|
+
....X
|
|
20
|
+
.X...
|
|
21
|
+
.XX..
|
data/init.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Placeholder to satisfy Rails.
|
|
2
|
+
#
|
|
3
|
+
# Do NOT add any require statements to this file. Doing
|
|
4
|
+
# so will cause Rails to load this plugin all of the time.
|
|
5
|
+
#
|
|
6
|
+
# Running 'ruby script/generate rspec' will
|
|
7
|
+
# generate spec/spec_helper.rb, which includes the necessary
|
|
8
|
+
# require statements and configuration. This file should
|
|
9
|
+
# be required by all of your spec files.
|
data/lib/autotest/discover.rb
CHANGED
data/lib/autotest/rspec.rb
CHANGED
|
@@ -28,7 +28,7 @@ class Autotest::Rspec < Autotest
|
|
|
28
28
|
def consolidate_failures(failed)
|
|
29
29
|
filters = new_hash_of_arrays
|
|
30
30
|
failed.each do |spec, trace|
|
|
31
|
-
if trace =~ /\n(\.\/)?(
|
|
31
|
+
if trace =~ /\n(\.\/)?(.*spec\.rb):[\d]+:\Z?/
|
|
32
32
|
filters[$2] << spec
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -36,37 +36,11 @@ class Autotest::Rspec < Autotest
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def make_test_cmd(files_to_test)
|
|
39
|
-
return
|
|
39
|
+
return '' if files_to_test.empty?
|
|
40
|
+
return "#{ruby} -S #{files_to_test.keys.flatten.join(' ')} #{add_options_if_present}"
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
def add_options_if_present # :nodoc:
|
|
43
44
|
File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
|
|
44
45
|
end
|
|
45
|
-
|
|
46
|
-
# Finds the proper spec command to use. Precendence is set in the
|
|
47
|
-
# lazily-evaluated method spec_commands. Alias + Override that in
|
|
48
|
-
# ~/.autotest to provide a different spec command then the default
|
|
49
|
-
# paths provided.
|
|
50
|
-
def spec_command(separator=File::ALT_SEPARATOR)
|
|
51
|
-
unless defined? @spec_command then
|
|
52
|
-
@spec_command = spec_commands.find { |cmd| File.exists? cmd }
|
|
53
|
-
|
|
54
|
-
raise RspecCommandError, "No spec command could be found!" unless @spec_command
|
|
55
|
-
|
|
56
|
-
@spec_command.gsub! File::SEPARATOR, separator if separator
|
|
57
|
-
end
|
|
58
|
-
@spec_command
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Autotest will look for spec commands in the following
|
|
62
|
-
# locations, in this order:
|
|
63
|
-
#
|
|
64
|
-
# * bin/spec
|
|
65
|
-
# * default spec bin/loader installed in Rubygems
|
|
66
|
-
def spec_commands
|
|
67
|
-
[
|
|
68
|
-
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')),
|
|
69
|
-
File.join(Config::CONFIG['bindir'], 'spec')
|
|
70
|
-
]
|
|
71
|
-
end
|
|
72
46
|
end
|
data/lib/spec.rb
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
require 'spec/version'
|
|
2
1
|
require 'spec/matchers'
|
|
3
2
|
require 'spec/expectations'
|
|
4
3
|
require 'spec/example'
|
|
5
4
|
require 'spec/extensions'
|
|
6
5
|
require 'spec/runner'
|
|
6
|
+
require 'spec/adapters'
|
|
7
|
+
require 'spec/version'
|
|
7
8
|
|
|
8
|
-
if Object.const_defined?(:Test)
|
|
9
|
-
require 'spec/interop/test'
|
|
9
|
+
if Object.const_defined?(:Test)
|
|
10
|
+
require 'spec/interop/test'
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
module Spec
|
|
13
14
|
class << self
|
|
14
15
|
def run?
|
|
15
|
-
|
|
16
|
+
Runner.options.examples_run?
|
|
16
17
|
end
|
|
17
18
|
|
|
18
|
-
def run
|
|
19
|
-
return true if run
|
|
20
|
-
|
|
21
|
-
@run = true; \
|
|
22
|
-
result; \
|
|
19
|
+
def run
|
|
20
|
+
return true if run?
|
|
21
|
+
Runner.options.run_examples
|
|
23
22
|
end
|
|
24
|
-
attr_writer :run
|
|
25
23
|
|
|
26
|
-
def exit
|
|
27
|
-
!Object.const_defined?(:Test) || Test::Unit.run
|
|
24
|
+
def exit?
|
|
25
|
+
!Object.const_defined?(:Test) || Test::Unit.run?
|
|
28
26
|
end
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'spec/adapters/ruby_engine'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'spec/adapters/ruby_engine/mri'
|
|
2
|
+
require 'spec/adapters/ruby_engine/rubinius'
|
|
3
|
+
|
|
4
|
+
module Spec
|
|
5
|
+
module Adapters
|
|
6
|
+
module RubyEngine
|
|
7
|
+
|
|
8
|
+
ENGINES = {
|
|
9
|
+
'mri' => MRI.new,
|
|
10
|
+
'rbx' => Rubinius.new
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
def self.engine
|
|
14
|
+
if Object.const_defined?('RUBY_ENGINE')
|
|
15
|
+
return Object.const_get('RUBY_ENGINE')
|
|
16
|
+
else
|
|
17
|
+
return 'mri'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.adapter
|
|
22
|
+
return ENGINES[engine]
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/spec/example/errors.rb
CHANGED
|
@@ -3,6 +3,8 @@ module Spec
|
|
|
3
3
|
|
|
4
4
|
module ExampleGroupMethods
|
|
5
5
|
class << self
|
|
6
|
+
attr_accessor :matcher_class
|
|
7
|
+
|
|
6
8
|
def description_text(*args)
|
|
7
9
|
args.inject("") do |result, arg|
|
|
8
10
|
result << " " unless (result == "" || arg.to_s =~ /^(\s|\.|#)/)
|
|
@@ -119,7 +121,7 @@ module Spec
|
|
|
119
121
|
|
|
120
122
|
def run
|
|
121
123
|
examples = examples_to_run
|
|
122
|
-
reporter.add_example_group(self)
|
|
124
|
+
reporter.add_example_group(self) unless examples_to_run.empty?
|
|
123
125
|
return true if examples.empty?
|
|
124
126
|
return dry_run(examples) if dry_run?
|
|
125
127
|
|
|
@@ -169,7 +171,7 @@ module Spec
|
|
|
169
171
|
def examples #:nodoc:
|
|
170
172
|
examples = example_objects.dup
|
|
171
173
|
add_method_examples(examples)
|
|
172
|
-
|
|
174
|
+
Spec::Runner.options.reverse ? examples.reverse : examples
|
|
173
175
|
end
|
|
174
176
|
|
|
175
177
|
def number_of_examples #:nodoc:
|
|
@@ -250,15 +252,15 @@ module Spec
|
|
|
250
252
|
|
|
251
253
|
def register(®istration_binding_block)
|
|
252
254
|
@registration_binding_block = registration_binding_block
|
|
253
|
-
|
|
255
|
+
Spec::Runner.options.add_example_group self
|
|
254
256
|
end
|
|
255
257
|
|
|
256
258
|
def unregister #:nodoc:
|
|
257
|
-
|
|
259
|
+
Spec::Runner.options.remove_example_group self
|
|
258
260
|
end
|
|
259
261
|
|
|
260
262
|
def registration_backtrace
|
|
261
|
-
eval("caller", registration_binding_block
|
|
263
|
+
eval("caller", registration_binding_block)
|
|
262
264
|
end
|
|
263
265
|
|
|
264
266
|
def run_before_each(example)
|
|
@@ -276,8 +278,8 @@ module Spec
|
|
|
276
278
|
private
|
|
277
279
|
def dry_run(examples)
|
|
278
280
|
examples.each do |example|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
Spec::Runner.options.reporter.example_started(example)
|
|
282
|
+
Spec::Runner.options.reporter.example_finished(example)
|
|
281
283
|
end
|
|
282
284
|
return true
|
|
283
285
|
end
|
|
@@ -300,7 +302,7 @@ module Spec
|
|
|
300
302
|
|
|
301
303
|
after_all_instance_variables = instance_variables
|
|
302
304
|
examples.each do |example_group_instance|
|
|
303
|
-
success &= example_group_instance.execute(
|
|
305
|
+
success &= example_group_instance.execute(Spec::Runner.options, instance_variables)
|
|
304
306
|
after_all_instance_variables = example_group_instance.instance_variable_hash
|
|
305
307
|
end
|
|
306
308
|
return [success, after_all_instance_variables]
|
|
@@ -322,7 +324,8 @@ module Spec
|
|
|
322
324
|
all_examples = examples
|
|
323
325
|
return all_examples unless specified_examples?
|
|
324
326
|
all_examples.reject do |example|
|
|
325
|
-
matcher =
|
|
327
|
+
matcher = ExampleGroupMethods.matcher_class.
|
|
328
|
+
new(description.to_s, example.description)
|
|
326
329
|
!matcher.matches?(specified_examples)
|
|
327
330
|
end
|
|
328
331
|
end
|
|
@@ -332,15 +335,15 @@ module Spec
|
|
|
332
335
|
end
|
|
333
336
|
|
|
334
337
|
def specified_examples
|
|
335
|
-
|
|
338
|
+
Spec::Runner.options.examples
|
|
336
339
|
end
|
|
337
340
|
|
|
338
341
|
def reporter
|
|
339
|
-
|
|
342
|
+
Spec::Runner.options.reporter
|
|
340
343
|
end
|
|
341
344
|
|
|
342
345
|
def dry_run?
|
|
343
|
-
|
|
346
|
+
Spec::Runner.options.dry_run
|
|
344
347
|
end
|
|
345
348
|
|
|
346
349
|
def example_objects
|
|
@@ -395,7 +398,7 @@ module Spec
|
|
|
395
398
|
case scope
|
|
396
399
|
when :each; before_each_parts
|
|
397
400
|
when :all; before_all_parts
|
|
398
|
-
when :suite;
|
|
401
|
+
when :suite; Spec::Runner.options.before_suite_parts
|
|
399
402
|
end
|
|
400
403
|
end
|
|
401
404
|
|
|
@@ -403,7 +406,7 @@ module Spec
|
|
|
403
406
|
case scope
|
|
404
407
|
when :each; after_each_parts
|
|
405
408
|
when :all; after_all_parts
|
|
406
|
-
when :suite;
|
|
409
|
+
when :suite; Spec::Runner.options.after_suite_parts
|
|
407
410
|
end
|
|
408
411
|
end
|
|
409
412
|
|
|
@@ -18,7 +18,7 @@ module Spec
|
|
|
18
18
|
Timeout.timeout(options.timeout) do
|
|
19
19
|
begin
|
|
20
20
|
before_example
|
|
21
|
-
|
|
21
|
+
eval_block
|
|
22
22
|
rescue Exception => e
|
|
23
23
|
execution_error ||= e
|
|
24
24
|
end
|
|
@@ -63,7 +63,7 @@ module Spec
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def description
|
|
66
|
-
@_defined_description ||
|
|
66
|
+
@_defined_description || ::Spec::Matchers.generated_description || "NO NAME"
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def __full_description
|
|
@@ -79,13 +79,8 @@ module Spec
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
def
|
|
83
|
-
|
|
84
|
-
return instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
|
|
85
|
-
ensure
|
|
86
|
-
@_matcher_description = Spec::Matchers.generated_description
|
|
87
|
-
Spec::Matchers.clear_generated_description
|
|
88
|
-
end
|
|
82
|
+
def eval_block
|
|
83
|
+
return instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
|
|
89
84
|
end
|
|
90
85
|
|
|
91
86
|
def implementation_backtrace
|
|
@@ -22,7 +22,8 @@ module Spec
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
# NOTE - we don't need the second arg, but extenders do: http://www.ruby-doc.org/core/classes/Object.html#M000604
|
|
26
|
+
def respond_to?(sym, include_private_data=false)
|
|
26
27
|
MethodDispatcher.new(self.class.described_module).respond_to?(sym) ? true : super
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -27,7 +27,7 @@ module Spec
|
|
|
27
27
|
#
|
|
28
28
|
# NOTE that this does NOT support receiver.should != expected.
|
|
29
29
|
# Instead, use receiver.should_not == expected
|
|
30
|
-
def should(matcher
|
|
30
|
+
def should(matcher=nil, &block)
|
|
31
31
|
ExpectationMatcherHandler.handle_matcher(self, matcher, &block)
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -50,7 +50,7 @@ module Spec
|
|
|
50
50
|
# => Passes unless (receiver =~ regexp)
|
|
51
51
|
#
|
|
52
52
|
# See Spec::Matchers for more information about matchers
|
|
53
|
-
def should_not(matcher
|
|
53
|
+
def should_not(matcher=nil, &block)
|
|
54
54
|
NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block)
|
|
55
55
|
end
|
|
56
56
|
|