rspec 1.2.2 → 1.2.3
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/History.rdoc +31 -1
- data/Manifest.txt +14 -12
- data/Rakefile +1 -1
- data/Upgrade.rdoc +43 -3
- data/examples/failing/failing_implicit_docstrings_example.rb +5 -5
- data/examples/passing/implicit_docstrings_example.rb +3 -3
- data/features/before_and_after_blocks/before_and_after_blocks.feature +20 -21
- data/features/example_groups/example_group_with_should_methods.feature +20 -8
- data/features/example_groups/implicit_docstrings.feature +36 -20
- data/features/example_groups/nested_groups.feature +25 -10
- data/features/extensions/custom_example_group.feature +19 -0
- data/features/formatters/custom_formatter.feature +30 -0
- data/features/heckle/heckle.feature +7 -7
- data/features/interop/examples_and_tests_together.feature +63 -14
- data/features/interop/rspec_output.feature +25 -0
- data/features/interop/test_but_not_test_unit.feature +19 -7
- data/features/interop/test_case_with_should_methods.feature +37 -8
- data/features/matchers/{create_matcher.feature → define_matcher.feature} +54 -30
- data/features/matchers/{create_matcher_outside_rspec.feature → define_matcher_outside_rspec.feature} +7 -7
- data/features/mock_framework_integration/use_flexmock.feature +3 -3
- data/features/mock_framework_integration/use_mocha.feature +3 -3
- data/features/mock_framework_integration/use_rr.feature +3 -3
- data/features/mocks/mix_stubs_and_mocks.feature +4 -4
- data/features/pending/pending_examples.feature +18 -18
- data/features/runner/specify_line_number.feature +32 -0
- data/features/step_definitions/running_rspec_steps.rb +41 -0
- data/features/subject/explicit_subject.feature +4 -4
- data/features/subject/implicit_subject.feature +4 -4
- data/features/support/env.rb +64 -11
- data/features/support/matchers/smart_match.rb +10 -35
- data/lib/spec.rb +1 -0
- data/lib/spec/deprecation.rb +40 -0
- data/lib/spec/dsl/main.rb +10 -5
- data/lib/spec/example.rb +1 -27
- data/lib/spec/example/args_and_options.rb +27 -0
- data/lib/spec/example/before_and_after_hooks.rb +30 -21
- data/lib/spec/example/errors.rb +8 -18
- data/lib/spec/example/example_group_factory.rb +0 -4
- data/lib/spec/example/example_group_methods.rb +27 -41
- data/lib/spec/example/example_group_proxy.rb +12 -22
- data/lib/spec/example/example_methods.rb +8 -18
- data/lib/spec/example/example_proxy.rb +4 -4
- data/lib/spec/example/pending.rb +3 -4
- data/lib/spec/example/predicate_matchers.rb +1 -1
- data/lib/spec/example/subject.rb +2 -0
- data/lib/spec/expectations.rb +1 -26
- data/lib/spec/expectations/extensions.rb +1 -1
- data/lib/spec/expectations/extensions/kernel.rb +52 -0
- data/lib/spec/expectations/handler.rb +21 -10
- data/lib/spec/matchers/be.rb +3 -3
- data/lib/spec/matchers/be_close.rb +17 -21
- data/lib/spec/matchers/be_instance_of.rb +7 -26
- data/lib/spec/matchers/be_kind_of.rb +7 -26
- data/lib/spec/matchers/dsl.rb +9 -4
- data/lib/spec/matchers/eql.rb +24 -25
- data/lib/spec/matchers/equal.rb +25 -25
- data/lib/spec/matchers/exist.rb +5 -21
- data/lib/spec/matchers/include.rb +22 -44
- data/lib/spec/matchers/match.rb +5 -25
- data/lib/spec/matchers/match_array.rb +8 -4
- data/lib/spec/matchers/matcher.rb +13 -2
- data/lib/spec/matchers/pretty.rb +1 -0
- data/lib/spec/matchers/simple_matcher.rb +2 -2
- data/lib/spec/mocks/mock.rb +10 -10
- data/lib/spec/mocks/spec_methods.rb +1 -1
- data/lib/spec/runner/configuration.rb +53 -42
- data/lib/spec/{expectations → runner}/differs/default.rb +0 -0
- data/lib/spec/{expectations → runner}/differs/load-diff-lcs.rb +0 -0
- data/lib/spec/runner/drb_command_line.rb +1 -1
- data/lib/spec/runner/example_group_runner.rb +0 -12
- data/lib/spec/runner/formatter/base_formatter.rb +77 -30
- data/lib/spec/runner/formatter/base_text_formatter.rb +19 -24
- data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +1 -1
- data/lib/spec/runner/formatter/html_formatter.rb +4 -6
- data/lib/spec/runner/formatter/nested_text_formatter.rb +2 -2
- data/lib/spec/runner/formatter/no_op_method_missing.rb +21 -0
- data/lib/spec/runner/formatter/profile_formatter.rb +0 -4
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +4 -5
- data/lib/spec/runner/formatter/silent_formatter.rb +10 -0
- data/lib/spec/runner/formatter/specdoc_formatter.rb +2 -2
- data/lib/spec/runner/option_parser.rb +14 -7
- data/lib/spec/runner/options.rb +17 -7
- data/lib/spec/runner/reporter.rb +69 -64
- data/lib/spec/version.rb +1 -1
- data/spec/spec/dsl/main_spec.rb +7 -0
- data/spec/spec/example/example_group_methods_spec.rb +16 -32
- data/spec/spec/example/example_group_proxy_spec.rb +25 -5
- data/spec/spec/example/example_group_spec.rb +2 -2
- data/spec/spec/example/example_methods_spec.rb +19 -24
- data/spec/spec/example/example_proxy_spec.rb +11 -1
- data/spec/spec/example/pending_module_spec.rb +2 -108
- data/spec/spec/example/predicate_matcher_spec.rb +23 -3
- data/spec/spec/expectations/extensions/object_spec.rb +9 -9
- data/spec/spec/expectations/fail_with_spec.rb +13 -13
- data/spec/spec/expectations/handler_spec.rb +44 -15
- data/spec/spec/matchers/be_close_spec.rb +9 -0
- data/spec/spec/matchers/be_instance_of_spec.rb +6 -4
- data/spec/spec/matchers/be_kind_of_spec.rb +5 -3
- data/spec/spec/matchers/be_spec.rb +1 -5
- data/spec/spec/matchers/compatibility_spec.rb +1 -1
- data/spec/spec/matchers/dsl_spec.rb +10 -1
- data/spec/spec/matchers/eql_spec.rb +8 -4
- data/spec/spec/matchers/equal_spec.rb +8 -4
- data/spec/spec/matchers/exist_spec.rb +1 -1
- data/spec/spec/matchers/include_spec.rb +1 -1
- data/spec/spec/matchers/match_array_spec.rb +26 -1
- data/spec/spec/matchers/match_spec.rb +2 -2
- data/spec/spec/matchers/matcher_methods_spec.rb +0 -3
- data/spec/spec/matchers/matcher_spec.rb +53 -0
- data/spec/spec/matchers/operator_matcher_spec.rb +1 -1
- data/spec/spec/mocks/mock_spec.rb +6 -0
- data/spec/spec/runner/configuration_spec.rb +11 -1
- data/spec/spec/runner/drb_command_line_spec.rb +13 -1
- data/spec/spec/runner/example_group_runner_spec.rb +0 -7
- data/spec/spec/runner/formatter/base_formatter_spec.rb +19 -12
- data/spec/spec/runner/formatter/base_text_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +4 -4
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +2 -2
- data/spec/spec/runner/formatter/html_formatted-1.8.6.html +31 -34
- data/spec/spec/runner/formatter/html_formatter_spec.rb +20 -0
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -20
- data/spec/spec/runner/formatter/profile_formatter_spec.rb +22 -3
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +24 -3
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
- data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +25 -28
- data/spec/spec/runner/formatter/text_mate_formatter_spec.rb +2 -2
- data/spec/spec/runner/option_parser_spec.rb +108 -40
- data/spec/spec/runner/reporter_spec.rb +16 -17
- data/spec/spec_helper.rb +4 -1
- metadata +20 -18
- data/features/example_groups/output.feature +0 -20
- data/features/step_definitions/running_rspec.rb +0 -69
- data/lib/spec/expectations/extensions/object.rb +0 -63
- data/resources/spec/example_group_with_should_methods.rb +0 -12
- data/resources/spec/simple_spec.rb +0 -8
- data/resources/test/spec_and_test_together.rb +0 -56
- data/resources/test/spec_including_test_but_not_unit.rb +0 -11
- data/resources/test/test_case_with_should_methods.rb +0 -29
@@ -32,7 +32,7 @@ module Spec
|
|
32
32
|
# to any message it receives that it hasn't been explicitly instructed
|
33
33
|
# to respond to.
|
34
34
|
def stub_everything(name = 'stub')
|
35
|
-
|
35
|
+
Spec.warn(<<-WARNING)
|
36
36
|
|
37
37
|
DEPRECATION: stub_everything('#{name}') is deprecated and will be removed
|
38
38
|
from a future version of rspec. Please use mock('#{name}').as_null_object
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Spec
|
2
2
|
module Runner
|
3
3
|
class Configuration
|
4
|
+
include Spec::Example::ArgsAndOptions
|
5
|
+
|
4
6
|
# Chooses what mock framework to use. Example:
|
5
7
|
#
|
6
8
|
# Spec::Runner.configure do |config|
|
@@ -74,8 +76,8 @@ module Spec
|
|
74
76
|
# # *Will* include ControllerExampleHelpers
|
75
77
|
# end
|
76
78
|
#
|
77
|
-
def include(*
|
78
|
-
include_or_extend(:include, *
|
79
|
+
def include(*modules_and_options)
|
80
|
+
include_or_extend(:include, *modules_and_options)
|
79
81
|
end
|
80
82
|
|
81
83
|
# :call-seq:
|
@@ -85,61 +87,61 @@ module Spec
|
|
85
87
|
#
|
86
88
|
# Works just like #include, but extends the example groups
|
87
89
|
# with the modules rather than including them.
|
88
|
-
def extend(*
|
89
|
-
include_or_extend(:extend, *
|
90
|
-
end
|
91
|
-
|
92
|
-
# Defines global predicate matchers. Example:
|
93
|
-
#
|
94
|
-
# config.predicate_matchers[:swim] = :can_swim?
|
95
|
-
#
|
96
|
-
# This makes it possible to say:
|
97
|
-
#
|
98
|
-
# person.should swim # passes if person.can_swim? returns true
|
99
|
-
#
|
100
|
-
def predicate_matchers
|
101
|
-
@predicate_matchers ||= {}
|
102
|
-
end
|
103
|
-
|
104
|
-
# Prepends a global <tt>before</tt> block to all example groups.
|
105
|
-
# See #append_before for filtering semantics.
|
106
|
-
def prepend_before(*args, &proc)
|
107
|
-
add_callback(:prepend_before, *args, &proc)
|
90
|
+
def extend(*modules_and_options)
|
91
|
+
include_or_extend(:extend, *modules_and_options)
|
108
92
|
end
|
109
93
|
|
110
94
|
# Appends a global <tt>before</tt> block to all example groups.
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
|
117
|
-
|
118
|
-
#
|
119
|
-
# config.prepend_before(:type => :farm)
|
120
|
-
#
|
121
|
-
def append_before(*args, &proc)
|
122
|
-
add_callback(:append_before, *args, &proc)
|
95
|
+
# <tt>scope</tt> can be any of <tt>:each</tt> (default), <tt>:all</tt>, or
|
96
|
+
# <tt>:suite</tt>. When <tt>:each</tt>, the block is executed before each
|
97
|
+
# example. When <tt>:all</tt>, the block is executed once per example
|
98
|
+
# group, before any of its examples are run. When <tt>:suite</tt> the
|
99
|
+
# block is run once before the entire suite is run.
|
100
|
+
def append_before(scope = :each, options={}, &proc)
|
101
|
+
add_callback(:append_before, scope, options, &proc)
|
123
102
|
end
|
124
103
|
alias_method :before, :append_before
|
125
104
|
|
105
|
+
# Prepends a global <tt>before</tt> block to all example groups.
|
106
|
+
#
|
107
|
+
# See <tt>append_before</tt> for scoping semantics.
|
108
|
+
def prepend_before(scope = :each, options={}, &proc)
|
109
|
+
add_callback(:prepend_before, scope, options, &proc)
|
110
|
+
end
|
111
|
+
|
126
112
|
# Prepends a global <tt>after</tt> block to all example groups.
|
127
|
-
#
|
128
|
-
|
129
|
-
|
113
|
+
#
|
114
|
+
# See <tt>append_before</tt> for scoping semantics.
|
115
|
+
def prepend_after(scope = :each, options={}, &proc)
|
116
|
+
add_callback(:prepend_after, scope, options, &proc)
|
130
117
|
end
|
131
118
|
alias_method :after, :prepend_after
|
132
119
|
|
133
120
|
# Appends a global <tt>after</tt> block to all example groups.
|
134
|
-
#
|
135
|
-
|
136
|
-
|
121
|
+
#
|
122
|
+
# See <tt>append_before</tt> for scoping semantics.
|
123
|
+
def append_after(scope = :each, options={}, &proc)
|
124
|
+
add_callback(:append_after, scope, options, &proc)
|
137
125
|
end
|
138
126
|
|
127
|
+
# DEPRECATED - use Spec::Matchers::DSL instead
|
128
|
+
#
|
129
|
+
# Defines global predicate matchers. Example:
|
130
|
+
#
|
131
|
+
# config.predicate_matchers[:swim] = :can_swim?
|
132
|
+
#
|
133
|
+
# This makes it possible to say:
|
134
|
+
#
|
135
|
+
# person.should swim # passes if person.can_swim? returns true
|
136
|
+
#
|
137
|
+
def predicate_matchers
|
138
|
+
@predicate_matchers ||= Spec::HashWithDeprecationNotice.new("predicate_matchers", "the new Matcher DSL")
|
139
|
+
end
|
140
|
+
|
139
141
|
private
|
140
142
|
|
141
143
|
def include_or_extend(action, *args)
|
142
|
-
modules, options =
|
144
|
+
modules, options = args_and_options(*args)
|
143
145
|
[get_type_from_options(options)].flatten.each do |required_example_group|
|
144
146
|
required_example_group = required_example_group.to_sym if required_example_group
|
145
147
|
modules.each do |mod|
|
@@ -149,7 +151,7 @@ module Spec
|
|
149
151
|
end
|
150
152
|
|
151
153
|
def add_callback(sym, *args, &proc)
|
152
|
-
scope, options =
|
154
|
+
scope, options = scope_and_options(*args)
|
153
155
|
example_group = Spec::Example::ExampleGroupFactory[get_type_from_options(options)]
|
154
156
|
example_group.__send__(sym, scope, &proc)
|
155
157
|
end
|
@@ -161,6 +163,15 @@ module Spec
|
|
161
163
|
def mock_framework_path(framework_name)
|
162
164
|
File.expand_path(File.join(File.dirname(__FILE__), "/../adapters/mock_frameworks/#{framework_name}"))
|
163
165
|
end
|
166
|
+
|
167
|
+
def scope_and_options(*args) # :nodoc:
|
168
|
+
args, options = args_and_options(*args)
|
169
|
+
return scope_from(*args), options
|
170
|
+
end
|
171
|
+
|
172
|
+
def scope_from(*args) # :nodoc:
|
173
|
+
args[0] || :each
|
174
|
+
end
|
164
175
|
end
|
165
176
|
end
|
166
177
|
end
|
File without changes
|
File without changes
|
@@ -12,7 +12,7 @@ module Spec
|
|
12
12
|
DRb.start_service("druby://localhost:0")
|
13
13
|
spec_server = DRbObject.new_with_uri("druby://127.0.0.1:8989")
|
14
14
|
spec_server.run(options.argv, options.error_stream, options.output_stream)
|
15
|
-
rescue DRb::DRbConnError
|
15
|
+
rescue DRb::DRbConnError
|
16
16
|
options.error_stream.puts "No server is running"
|
17
17
|
end
|
18
18
|
end
|
@@ -55,17 +55,5 @@ module Spec
|
|
55
55
|
@options.number_of_examples
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
59
|
-
class BehaviourRunner < ExampleGroupRunner
|
60
|
-
def initialize(options)
|
61
|
-
Kernel.warn <<-WARNING
|
62
|
-
DEPRECATED: The BeheviourRunner class is deprecated and will
|
63
|
-
be removed from rspec-1.2.
|
64
|
-
|
65
|
-
Use ExampleGroupRunner instead.
|
66
|
-
WARNING
|
67
|
-
super
|
68
|
-
end
|
69
|
-
end
|
70
58
|
end
|
71
59
|
end
|
@@ -1,14 +1,29 @@
|
|
1
1
|
module Spec
|
2
2
|
module Runner
|
3
3
|
module Formatter
|
4
|
-
# Formatter base-class, which implements all required methods
|
5
|
-
# Almost all of the implementations are no-ops, with the exception
|
6
|
-
# of +add_example_group+ (see below).
|
4
|
+
# Formatter base-class, which implements all required methods as no-ops, with the exception
|
7
5
|
class BaseFormatter
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
# Formatters are initialized with <tt>options</tt> and <tt>output</tt>
|
7
|
+
# arguments. RSpec's built-in formatters already expect this, and any
|
8
|
+
# custom formatters should as well.
|
9
|
+
#
|
10
|
+
# ==== Parameters
|
11
|
+
# options::
|
12
|
+
# A struct containing boolean values for colour, autospec,
|
13
|
+
# and dry_run
|
14
|
+
# output::
|
15
|
+
# Used by RSpec's built-in formatters to determine where to
|
16
|
+
# write the output. Default is <tt>STDOUT</tt>, otherwise a
|
17
|
+
# filename is expected.
|
18
|
+
#
|
19
|
+
# === Example
|
20
|
+
# If you invoke the <tt>spec</tt> command with:
|
21
|
+
#
|
22
|
+
# --format progress:progress_report.txt
|
23
|
+
#
|
24
|
+
# ... the value of <tt>output</tt> will be progress_report.txt. If you
|
25
|
+
# don't identify an output destination, the default is STDOUT.
|
26
|
+
def initialize(options, output)
|
12
27
|
end
|
13
28
|
|
14
29
|
# This method is invoked before any examples are run, right after
|
@@ -16,55 +31,77 @@ module Spec
|
|
16
31
|
# formatters that need to provide progress on feedback (graphical ones)
|
17
32
|
#
|
18
33
|
# This method will only be invoked once, and the next one to be invoked
|
19
|
-
# is #
|
34
|
+
# is #example_group_started
|
35
|
+
#
|
36
|
+
# ==== Parameters
|
37
|
+
# example_count:: the total number of examples to be run
|
20
38
|
def start(example_count)
|
21
39
|
end
|
22
40
|
|
23
|
-
# This method is invoked at the beginning of the execution of each
|
24
|
-
#
|
25
|
-
#
|
41
|
+
# This method is invoked at the beginning of the execution of each
|
42
|
+
# example_group. The next method to be invoked after this is
|
43
|
+
# #example_started
|
26
44
|
#
|
27
|
-
#
|
45
|
+
# ==== Parameters
|
46
|
+
# example_group_proxy:: instance of Spec::Example::ExampleGroupProxy
|
47
|
+
def example_group_started(example_group_proxy)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Deprecated - use example_group_started instead
|
28
51
|
def add_example_group(example_group_proxy)
|
29
|
-
|
52
|
+
Spec.deprecate("BaseFormatter#add_example_group", "BaseFormatter#example_group_started")
|
53
|
+
example_group_started(example_group_proxy)
|
30
54
|
end
|
31
55
|
|
32
|
-
# This method is invoked when an +example+ starts.
|
33
|
-
#
|
56
|
+
# This method is invoked when an +example+ starts. The next method to be
|
57
|
+
# invoked after this is #example_passed, #example_failed, or
|
58
|
+
# #example_pending
|
34
59
|
#
|
35
|
-
#
|
36
|
-
#
|
60
|
+
# ==== Parameters
|
61
|
+
# example_proxy:: instance of Spec::Example::ExampleProxy
|
37
62
|
def example_started(example_proxy)
|
38
63
|
end
|
39
64
|
|
40
65
|
# This method is invoked when an +example+ passes.
|
41
66
|
# +example_proxy+ is the same instance of Spec::Example::ExampleProxy
|
42
67
|
# that was passed to example_started
|
68
|
+
#
|
69
|
+
# ==== Parameters
|
70
|
+
# example_proxy:: instance of Spec::Example::ExampleProxy
|
43
71
|
def example_passed(example_proxy)
|
44
72
|
end
|
45
73
|
|
46
74
|
# This method is invoked when an +example+ fails, i.e. an exception occurred
|
47
|
-
# inside it (such as a failed should or other exception).
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# that was passed
|
75
|
+
# inside it (such as a failed should or other exception).
|
76
|
+
#
|
77
|
+
# ==== Parameters
|
78
|
+
# example_proxy::
|
79
|
+
# The same instance of Spec::Example::ExampleProxy that was passed
|
80
|
+
# to <tt>example_started</tt>
|
81
|
+
#
|
82
|
+
# counter:: the sequential number of this failure
|
83
|
+
#
|
84
|
+
# failure:: instance of Spec::Runner::Reporter::Failure
|
52
85
|
def example_failed(example_proxy, counter, failure)
|
53
86
|
end
|
54
87
|
|
55
88
|
# This method is invoked when an example is not yet implemented (i.e. has not
|
56
89
|
# been provided a block), or when an ExamplePendingError is raised.
|
57
90
|
# +message+ is the message from the ExamplePendingError, if it exists, or the
|
58
|
-
# default value of "Not Yet Implemented"
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
|
91
|
+
# default value of "Not Yet Implemented". +deprecated_pending_location+ is
|
92
|
+
# deprecated - use example_proxy.location instead
|
93
|
+
#
|
94
|
+
# ==== Parameters
|
95
|
+
# example_proxy:: instance of Spec::Example::ExampleProxy
|
96
|
+
# message::
|
97
|
+
# the message passed to the pending message, or an internal
|
98
|
+
# default
|
99
|
+
#
|
100
|
+
def example_pending(example_proxy, message, deprecated_pending_location=nil)
|
64
101
|
end
|
65
102
|
|
66
103
|
# This method is invoked after all of the examples have executed. The next method
|
67
|
-
# to be invoked after this one is #dump_failure (once for each failed example)
|
104
|
+
# to be invoked after this one is #dump_failure (once for each failed example)
|
68
105
|
def start_dump
|
69
106
|
end
|
70
107
|
|
@@ -72,14 +109,24 @@ module Spec
|
|
72
109
|
# This method is invoked for each failed example after all examples have run. +counter+ is the sequence number
|
73
110
|
# of the associated example. +failure+ is a Failure object, which contains detailed
|
74
111
|
# information about the failure.
|
112
|
+
#
|
113
|
+
# ==== Parameters
|
114
|
+
# counter:: the sequential number of this failure
|
115
|
+
# failure:: instance of Spec::Runner::Reporter::Failure
|
75
116
|
def dump_failure(counter, failure)
|
76
117
|
end
|
77
118
|
|
78
119
|
# This method is invoked after the dumping of examples and failures.
|
120
|
+
#
|
121
|
+
# ==== Parameters
|
122
|
+
# duration:: the total time for the entire run
|
123
|
+
# example_count:: the number of examples run
|
124
|
+
# failure_count:: the number of examples that failed
|
125
|
+
# pending_count:: the number of examples that are pending
|
79
126
|
def dump_summary(duration, example_count, failure_count, pending_count)
|
80
127
|
end
|
81
128
|
|
82
|
-
# This gets invoked after the summary
|
129
|
+
# This gets invoked after the summary
|
83
130
|
def dump_pending
|
84
131
|
end
|
85
132
|
|
@@ -8,23 +8,28 @@ module Spec
|
|
8
8
|
# non-text based ones too - just ignore the +output+ constructor
|
9
9
|
# argument.
|
10
10
|
class BaseTextFormatter < BaseFormatter
|
11
|
-
attr_reader :output, :
|
12
|
-
# Creates a new instance that will write to +
|
11
|
+
attr_reader :output, :example_group
|
12
|
+
# Creates a new instance that will write to +output+. If +output+ is a
|
13
13
|
# String, output will be written to the File with that name, otherwise
|
14
|
-
# +
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
# +output+ is exected to be an IO (or an object that responds to #puts
|
15
|
+
# and #write).
|
16
|
+
def initialize(options, output)
|
17
|
+
@options = options
|
18
|
+
if String === output
|
19
|
+
FileUtils.mkdir_p(File.dirname(output))
|
20
|
+
@output = File.open(output, 'w')
|
20
21
|
else
|
21
|
-
@output =
|
22
|
+
@output = output
|
22
23
|
end
|
23
24
|
@pending_examples = []
|
24
25
|
end
|
26
|
+
|
27
|
+
def example_group_started(example_group_proxy)
|
28
|
+
@example_group = example_group_proxy
|
29
|
+
end
|
25
30
|
|
26
|
-
def example_pending(example, message,
|
27
|
-
@pending_examples << ["#{@example_group.description} #{example.description}", message,
|
31
|
+
def example_pending(example, message, ignore)
|
32
|
+
@pending_examples << ["#{@example_group.description} #{example.description}", message, example.location]
|
28
33
|
end
|
29
34
|
|
30
35
|
def dump_failure(counter, failure)
|
@@ -40,12 +45,7 @@ module Spec
|
|
40
45
|
end
|
41
46
|
|
42
47
|
def colourise(message, failure)
|
43
|
-
|
44
|
-
DEPRECATED: BaseTextFormatter#colourise is deprecated and will be
|
45
|
-
removed from a future version of RSpec.
|
46
|
-
|
47
|
-
Please use colorize_failure instead.
|
48
|
-
NOTICE
|
48
|
+
Spec::deprecate("BaseTextFormatter#colourise", "colorize_failure")
|
49
49
|
colorize_failure(message, failure)
|
50
50
|
end
|
51
51
|
|
@@ -126,14 +126,9 @@ NOTICE
|
|
126
126
|
def red(text); colour(text, "\e[31m"); end
|
127
127
|
def yellow(text); colour(text, "\e[33m"); end
|
128
128
|
def blue(text); colour(text, "\e[34m"); end
|
129
|
-
|
129
|
+
|
130
130
|
def magenta(text)
|
131
|
-
|
132
|
-
DEPRECATED: BaseTextFormatter#magenta is deprecated and will be
|
133
|
-
removed from a future version of RSpec.
|
134
|
-
|
135
|
-
Please use red instead (it is red/green/refactor after all).
|
136
|
-
NOTICE
|
131
|
+
Spec::deprecate("BaseTextFormatter#magenta")
|
137
132
|
red(text)
|
138
133
|
end
|
139
134
|
end
|
@@ -6,7 +6,7 @@ module Spec
|
|
6
6
|
class FailingExampleGroupsFormatter < BaseTextFormatter
|
7
7
|
def example_failed(example, counter, failure)
|
8
8
|
if @example_group
|
9
|
-
@output.puts @example_group.
|
9
|
+
@output.puts @example_group.description.gsub(/ \(druby.*\)/,"")
|
10
10
|
|
11
11
|
@output.flush
|
12
12
|
@example_group = nil
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'spec/runner/formatter/base_text_formatter'
|
3
|
+
require 'spec/runner/formatter/no_op_method_missing'
|
3
4
|
|
4
5
|
module Spec
|
5
6
|
module Runner
|
6
7
|
module Formatter
|
7
8
|
class HtmlFormatter < BaseTextFormatter
|
8
9
|
include ERB::Util # for the #h method
|
10
|
+
include NOOPMethodMissing
|
9
11
|
|
10
12
|
def initialize(options, output)
|
11
13
|
super
|
@@ -14,10 +16,6 @@ module Spec
|
|
14
16
|
@header_red = nil
|
15
17
|
end
|
16
18
|
|
17
|
-
def method_missing(sym, *args)
|
18
|
-
# no-op
|
19
|
-
end
|
20
|
-
|
21
19
|
# The number of the currently running example_group
|
22
20
|
def example_group_number
|
23
21
|
@example_group_number
|
@@ -36,7 +34,7 @@ module Spec
|
|
36
34
|
@output.flush
|
37
35
|
end
|
38
36
|
|
39
|
-
def
|
37
|
+
def example_group_started(example_group)
|
40
38
|
super
|
41
39
|
@example_group_red = false
|
42
40
|
@example_group_number += 1
|
@@ -85,7 +83,7 @@ module Spec
|
|
85
83
|
@output.flush
|
86
84
|
end
|
87
85
|
|
88
|
-
def example_pending(example, message,
|
86
|
+
def example_pending(example, message, deprecated_pending_location=nil)
|
89
87
|
@output.puts " <script type=\"text/javascript\">makeYellow('rspec-header');</script>" unless @header_red
|
90
88
|
@output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{example_group_number}');</script>" unless @example_group_red
|
91
89
|
move_progress
|