rspec 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -31,9 +31,6 @@ This module should provide the following methods, each of which returns a Matche
|
|
31
31
|
it "have_at_most" do
|
32
32
|
have_at_most(0).should be_an_instance_of(Have)
|
33
33
|
end
|
34
|
-
it "include" do
|
35
|
-
include(:value).should be_an_instance_of(Include)
|
36
|
-
end
|
37
34
|
it "raise_error" do
|
38
35
|
raise_error.should be_an_instance_of(RaiseError)
|
39
36
|
raise_error(NoMethodError).should be_an_instance_of(RaiseError)
|
@@ -28,6 +28,43 @@ module Spec
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
it "is not diffable by default" do
|
32
|
+
matcher = Spec::Matchers::Matcher.new(:name) do
|
33
|
+
match {|actual|}
|
34
|
+
end
|
35
|
+
matcher.matches?(0)
|
36
|
+
matcher.should_not be_diffable
|
37
|
+
end
|
38
|
+
|
39
|
+
it "is diffable when told to be" do
|
40
|
+
matcher = Spec::Matchers::Matcher.new(:name) do
|
41
|
+
match {|actual|}
|
42
|
+
diffable
|
43
|
+
end
|
44
|
+
matcher.matches?(0)
|
45
|
+
matcher.should be_diffable
|
46
|
+
end
|
47
|
+
|
48
|
+
it "provides expected" do
|
49
|
+
matcher = Spec::Matchers::Matcher.new(:name, 'expected string') do
|
50
|
+
match {|actual|}
|
51
|
+
end
|
52
|
+
|
53
|
+
matcher.matches?('actual string')
|
54
|
+
|
55
|
+
matcher.expected.should == ['expected string']
|
56
|
+
end
|
57
|
+
|
58
|
+
it "provides actual" do
|
59
|
+
matcher = Spec::Matchers::Matcher.new(:name, 'expected string') do
|
60
|
+
match {|actual|}
|
61
|
+
end
|
62
|
+
|
63
|
+
matcher.matches?('actual string')
|
64
|
+
|
65
|
+
matcher.actual.should == 'actual string'
|
66
|
+
end
|
67
|
+
|
31
68
|
context "with overrides" do
|
32
69
|
before(:each) do
|
33
70
|
@matcher = Spec::Matchers::Matcher.new(:be_boolean, true) do |boolean|
|
@@ -143,6 +180,22 @@ module Spec
|
|
143
180
|
@matcher.description.should == "matcher name 1, 2, 3, and 4"
|
144
181
|
end
|
145
182
|
end
|
183
|
+
|
184
|
+
context "with helper methods" do
|
185
|
+
it "does something" do
|
186
|
+
matcher = Spec::Matchers::Matcher.new(:be_similar_to, [1,2,3]) do |sample|
|
187
|
+
match do |actual|
|
188
|
+
similar?(sample, actual)
|
189
|
+
end
|
190
|
+
|
191
|
+
def similar?(a, b)
|
192
|
+
a.sort == b.sort
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
matcher.matches?([2,3,1]).should be_true
|
197
|
+
end
|
198
|
+
end
|
146
199
|
|
147
200
|
end
|
148
201
|
end
|
@@ -5,6 +5,7 @@ module Spec
|
|
5
5
|
describe Configuration do
|
6
6
|
with_sandboxed_options do
|
7
7
|
with_sandboxed_config do
|
8
|
+
|
8
9
|
describe "#mock_with" do
|
9
10
|
it "should default mock framework to rspec" do
|
10
11
|
config.mock_framework.should =~ /\/spec\/adapters\/mock_frameworks\/rspec$/
|
@@ -179,7 +180,7 @@ module Spec
|
|
179
180
|
config.append_before(:all, :type => :special_child) do
|
180
181
|
order << :special_child_append_before_all
|
181
182
|
end
|
182
|
-
config.append_before
|
183
|
+
config.append_before do # default is :each
|
183
184
|
order << :append_before_each
|
184
185
|
end
|
185
186
|
config.append_before(:each, :type => :special) do
|
@@ -293,7 +294,16 @@ module Spec
|
|
293
294
|
:append__after_all
|
294
295
|
]
|
295
296
|
end
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
describe "#predicate_matchers (DEPRECATED)" do
|
301
|
+
it "is deprecated" do
|
302
|
+
Spec.should_receive(:deprecate)
|
303
|
+
config.predicate_matchers[:foo] = :bar?
|
304
|
+
end
|
296
305
|
end
|
306
|
+
|
297
307
|
end
|
298
308
|
end
|
299
309
|
end
|
@@ -6,13 +6,19 @@ module Spec
|
|
6
6
|
describe DrbCommandLine do
|
7
7
|
|
8
8
|
context "without server running" do
|
9
|
-
it "
|
9
|
+
it "prints error" do
|
10
10
|
err = out = StringIO.new
|
11
11
|
DrbCommandLine.run(OptionParser.parse(['--version'], err, out))
|
12
12
|
|
13
13
|
err.rewind
|
14
14
|
err.read.should =~ /No server is running/
|
15
15
|
end
|
16
|
+
|
17
|
+
it "returns nil" do
|
18
|
+
err = out = StringIO.new
|
19
|
+
result = DrbCommandLine.run(OptionParser.parse(['--version'], err, out))
|
20
|
+
result.should be_nil
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
context "with server running" do
|
@@ -45,6 +51,12 @@ module Spec
|
|
45
51
|
DRb.stop_service
|
46
52
|
end
|
47
53
|
|
54
|
+
it "returns true" do
|
55
|
+
err = out = StringIO.new
|
56
|
+
result = DrbCommandLine.run(OptionParser.parse(['--version'], err, out))
|
57
|
+
result.should be_true
|
58
|
+
end
|
59
|
+
|
48
60
|
it "should run against local server" do
|
49
61
|
out = run_spec_via_druby(['--version'])
|
50
62
|
out.should =~ /rspec \d+\.\d+\.\d+.*/n
|
@@ -4,19 +4,26 @@ module Spec
|
|
4
4
|
module Runner
|
5
5
|
module Formatter
|
6
6
|
describe BaseFormatter do
|
7
|
-
subject {BaseFormatter.new(nil,
|
7
|
+
subject { BaseFormatter.new(nil,nil) }
|
8
|
+
it {should respond_to(:start ).with(1).argument }
|
9
|
+
it {should respond_to(:example_group_started).with(1).argument }
|
10
|
+
it {should respond_to(:example_started ).with(1).argument }
|
11
|
+
# -3 indicates that one of the arguments is optional, with a default
|
12
|
+
# value assigned. This is due to deprecated_pending_location. Once
|
13
|
+
# that is removed, this should be changed to 2.
|
14
|
+
it {should respond_to(:example_pending ).with(-3).arguments}
|
15
|
+
it {should respond_to(:example_passed ).with(1).argument }
|
16
|
+
it {should respond_to(:example_failed ).with(3).arguments}
|
17
|
+
it {should respond_to(:start_dump ).with(0).arguments}
|
18
|
+
it {should respond_to(:dump_failure ).with(2).arguments}
|
19
|
+
it {should respond_to(:dump_summary ).with(4).arguments}
|
20
|
+
it {should respond_to(:dump_pending ).with(0).arguments}
|
21
|
+
it {should respond_to(:close ).with(0).arguments}
|
8
22
|
|
9
|
-
it
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
it {should respond_to(:example_failed ).with(3).arguments}
|
14
|
-
it {should respond_to(:example_pending ).with(3).arguments}
|
15
|
-
it {should respond_to(:start_dump ).with(0).arguments}
|
16
|
-
it {should respond_to(:dump_failure ).with(2).arguments}
|
17
|
-
it {should respond_to(:dump_summary ).with(4).arguments}
|
18
|
-
it {should respond_to(:dump_pending ).with(0).arguments}
|
19
|
-
it {should respond_to(:close ).with(0).arguments}
|
23
|
+
it "deprecates add_example_group" do
|
24
|
+
Spec.should_receive(:deprecate)
|
25
|
+
subject.add_example_group(stub('example group'))
|
26
|
+
end
|
20
27
|
end
|
21
28
|
end
|
22
29
|
end
|
@@ -37,7 +37,7 @@ module Spec
|
|
37
37
|
|
38
38
|
context "#colourise" do
|
39
39
|
it "warns when subclasses call colourise" do
|
40
|
-
|
40
|
+
Spec.should_receive(:deprecate)
|
41
41
|
@formatter.method_that_class_colourise('this message', @failure)
|
42
42
|
end
|
43
43
|
|
@@ -49,7 +49,7 @@ module Spec
|
|
49
49
|
|
50
50
|
context "#magenta" do
|
51
51
|
it "warns when subclasses call magenta" do
|
52
|
-
|
52
|
+
Spec.should_receive(:deprecate).with(/#magenta/)
|
53
53
|
@formatter.method_that_class_magenta('this message')
|
54
54
|
end
|
55
55
|
|
@@ -15,9 +15,9 @@ module Spec
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should add example name for each failure" do
|
18
|
-
formatter.
|
18
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(Class.new(::Spec::Example::ExampleGroupDouble).describe("b 1")))
|
19
19
|
formatter.example_failed("e 1", nil, Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
20
|
-
formatter.
|
20
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(Class.new(::Spec::Example::ExampleGroupDouble).describe("b 2")))
|
21
21
|
formatter.example_failed("e 2", nil, Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
22
22
|
formatter.example_failed("e 3", nil, Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
23
23
|
io.string.should include("b 1")
|
@@ -29,13 +29,13 @@ module Spec
|
|
29
29
|
child_example_group = Class.new(parent_example_group).describe("#child_method")
|
30
30
|
grand_child_example_group = Class.new(child_example_group).describe("GrandChild")
|
31
31
|
|
32
|
-
formatter.
|
32
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
33
33
|
formatter.example_failed("failure", nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
34
34
|
io.string.should == "Parent#child_method GrandChild\n"
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should remove druby url, which is used by Spec::Distributed" do
|
38
|
-
@formatter.
|
38
|
+
@formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(Class.new(::Spec::Example::ExampleGroupDouble).describe("something something (druby://99.99.99.99:99)")))
|
39
39
|
@formatter.example_failed("e 1", nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
40
40
|
io.string.should == "something something\n"
|
41
41
|
end
|
@@ -15,9 +15,9 @@ module Spec
|
|
15
15
|
example_group_1 = Class.new(::Spec::Example::ExampleGroupDouble).describe("A")
|
16
16
|
example_group_2 = Class.new(example_group_1).describe("B")
|
17
17
|
|
18
|
-
@formatter.
|
18
|
+
@formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(example_group_1))
|
19
19
|
@formatter.example_failed(example_group_1.it("a1"){}, nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
20
|
-
@formatter.
|
20
|
+
@formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(example_group_2))
|
21
21
|
@formatter.example_failed(example_group_2.it("b2"){}, nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
22
22
|
@formatter.example_failed(example_group_2.it("b3"){}, nil, ::Spec::Runner::Reporter::Failure.new("g", nil, RuntimeError.new))
|
23
23
|
@io.string.should eql(<<-EOF
|
@@ -192,10 +192,10 @@ a {
|
|
192
192
|
<div class="failure" id="failure_1">
|
193
193
|
<div class="message"><pre>Mock 'poke me' expected :poke with (any args) once, but received it 0 times</pre></div>
|
194
194
|
<div class="backtrace"><pre>./examples/failing/mocking_example.rb:13:
|
195
|
-
/
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
./spec/spec/runner/formatter/../../../spec_helper.rb:43:in `run_with'
|
196
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:38:
|
197
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:in `chdir'
|
198
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:</pre></div>
|
199
199
|
<pre class="ruby"><code><span class="linenum">11</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">should fail when expected message not received</span><span class="punct">"</span> <span class="keyword">do</span>
|
200
200
|
<span class="linenum">12</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">("</span><span class="string">poke me</span><span class="punct">")</span>
|
201
201
|
<span class="offending"><span class="linenum">13</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(</span><span class="symbol">:poke</span><span class="punct">)</span></span>
|
@@ -209,10 +209,10 @@ a {
|
|
209
209
|
<div class="failure" id="failure_2">
|
210
210
|
<div class="message"><pre>Mock 'one two three' received :three out of order</pre></div>
|
211
211
|
<div class="backtrace"><pre>./examples/failing/mocking_example.rb:22:
|
212
|
-
/
|
213
|
-
|
214
|
-
|
215
|
-
|
212
|
+
./spec/spec/runner/formatter/../../../spec_helper.rb:43:in `run_with'
|
213
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:38:
|
214
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:in `chdir'
|
215
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:</pre></div>
|
216
216
|
<pre class="ruby"><code><span class="linenum">20</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(</span><span class="symbol">:three</span><span class="punct">).</span><span class="ident">ordered</span>
|
217
217
|
<span class="linenum">21</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">one</span>
|
218
218
|
<span class="offending"><span class="linenum">22</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">three</span></span>
|
@@ -226,10 +226,10 @@ a {
|
|
226
226
|
<div class="failure" id="failure_3">
|
227
227
|
<div class="message"><pre>Mock 'don't talk to me' expected :any_message_at_all with (no args) 0 times, but received it once</pre></div>
|
228
228
|
<div class="backtrace"><pre>./examples/failing/mocking_example.rb:29:
|
229
|
-
/
|
230
|
-
|
231
|
-
|
232
|
-
|
229
|
+
./spec/spec/runner/formatter/../../../spec_helper.rb:43:in `run_with'
|
230
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:38:
|
231
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:in `chdir'
|
232
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:</pre></div>
|
233
233
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">("</span><span class="string">don't talk to me</span><span class="punct">")</span>
|
234
234
|
<span class="linenum">28</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_not_receive</span><span class="punct">(</span><span class="symbol">:any_message_at_all</span><span class="punct">)</span>
|
235
235
|
<span class="offending"><span class="linenum">29</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">any_message_at_all</span></span>
|
@@ -242,10 +242,10 @@ a {
|
|
242
242
|
<div class="failure" id="failure_4">
|
243
243
|
<div class="message"><pre>Expected pending 'here is the bug' to fail. No Error was raised.</pre></div>
|
244
244
|
<div class="backtrace"><pre>./examples/failing/mocking_example.rb:33:
|
245
|
-
/
|
246
|
-
|
247
|
-
|
248
|
-
|
245
|
+
./spec/spec/runner/formatter/../../../spec_helper.rb:43:in `run_with'
|
246
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:38:
|
247
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:in `chdir'
|
248
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:</pre></div>
|
249
249
|
<pre class="ruby"><code><span class="linenum">31</span>
|
250
250
|
<span class="linenum">32</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">has a bug we need to fix</span><span class="punct">"</span> <span class="keyword">do</span>
|
251
251
|
<span class="offending"><span class="linenum">33</span> <span class="ident">pending</span> <span class="punct">"</span><span class="string">here is the bug</span><span class="punct">"</span> <span class="keyword">do</span></span>
|
@@ -273,10 +273,10 @@ Diff:
|
|
273
273
|
framework for Ruby
|
274
274
|
</pre></div>
|
275
275
|
<div class="backtrace"><pre>./examples/failing/diffing_spec.rb:13:
|
276
|
-
/
|
277
|
-
|
278
|
-
|
279
|
-
|
276
|
+
./spec/spec/runner/formatter/../../../spec_helper.rb:43:in `run_with'
|
277
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:38:
|
278
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:in `chdir'
|
279
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:</pre></div>
|
280
280
|
<pre class="ruby"><code><span class="linenum">11</span><span class="ident">framework</span> <span class="keyword">for</span> <span class="constant">Ruby</span>
|
281
281
|
<span class="linenum">12</span><span class="constant">EOF</span>
|
282
282
|
<span class="offending"><span class="linenum">13</span> <span class="ident">usa</span><span class="punct">.</span><span class="ident">should</span> <span class="punct">==</span> <span class="ident">uk</span></span>
|
@@ -287,28 +287,25 @@ Diff:
|
|
287
287
|
<dd class="spec failed">
|
288
288
|
<span class="failed_spec_name">should print diff of different objects' pretty representation</span>
|
289
289
|
<div class="failure" id="failure_6">
|
290
|
-
<div class="message"><pre>
|
290
|
+
<div class="message"><pre>
|
291
|
+
expected <Animal
|
291
292
|
name=bob,
|
292
293
|
species=tortoise
|
293
294
|
>
|
294
|
-
|
295
|
+
|
296
|
+
got <Animal
|
295
297
|
name=bob,
|
296
298
|
species=giraffe
|
297
299
|
>
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
<Animal
|
302
|
-
name=bob,
|
303
|
-
-species=tortoise
|
304
|
-
+species=giraffe
|
305
|
-
>
|
300
|
+
|
301
|
+
|
302
|
+
(compared using eql?)
|
306
303
|
</pre></div>
|
307
304
|
<div class="backtrace"><pre>./examples/failing/diffing_spec.rb:34:
|
308
|
-
/
|
309
|
-
|
310
|
-
|
311
|
-
|
305
|
+
./spec/spec/runner/formatter/../../../spec_helper.rb:43:in `run_with'
|
306
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:38:
|
307
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:in `chdir'
|
308
|
+
./spec/spec/runner/formatter/html_formatter_spec.rb:26:</pre></div>
|
312
309
|
<pre class="ruby"><code><span class="linenum">32</span> <span class="ident">expected</span> <span class="punct">=</span> <span class="constant">Animal</span><span class="punct">.</span><span class="ident">new</span> <span class="punct">"</span><span class="string">bob</span><span class="punct">",</span> <span class="punct">"</span><span class="string">giraffe</span><span class="punct">"</span>
|
313
310
|
<span class="linenum">33</span> <span class="ident">actual</span> <span class="punct">=</span> <span class="constant">Animal</span><span class="punct">.</span><span class="ident">new</span> <span class="punct">"</span><span class="string">bob</span><span class="punct">",</span> <span class="punct">"</span><span class="string">tortoise</span><span class="punct">"</span>
|
314
311
|
<span class="offending"><span class="linenum">34</span> <span class="ident">expected</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eql</span><span class="punct">(</span><span class="ident">actual</span><span class="punct">)</span></span>
|
@@ -10,6 +10,7 @@ module Spec
|
|
10
10
|
module Formatter
|
11
11
|
describe HtmlFormatter do
|
12
12
|
attr_reader :root, :expected_file, :expected_html
|
13
|
+
|
13
14
|
before do
|
14
15
|
@root = File.expand_path("#{File.dirname(__FILE__)}/../../../..")
|
15
16
|
suffix = jruby? ? '-jruby' : ''
|
@@ -104,6 +105,25 @@ module Spec
|
|
104
105
|
html.should =~ /This was a dry-run/m
|
105
106
|
end
|
106
107
|
end
|
108
|
+
|
109
|
+
it "should have method_missing as private" do
|
110
|
+
HtmlFormatter.private_instance_methods.should include("method_missing")
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should respond_to? all messages" do
|
114
|
+
formatter = HtmlFormatter.new({ }, StringIO.new)
|
115
|
+
formatter.should respond_to(:just_about_anything)
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should respond_to? anything, when given the private flag" do
|
119
|
+
formatter = HtmlFormatter.new({ }, StringIO.new)
|
120
|
+
formatter.respond_to?(:method_missing, true).should be_true
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should not respond_to? method_missing (because it's private)" do
|
124
|
+
formatter = HtmlFormatter.new({ }, StringIO.new)
|
125
|
+
formatter.respond_to?(:method_missing).should be_false
|
126
|
+
end
|
107
127
|
end
|
108
128
|
end
|
109
129
|
end
|
@@ -17,12 +17,12 @@ module Spec
|
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "where ExampleGroup has no superclass with a description" do
|
20
|
-
def
|
21
|
-
formatter.
|
20
|
+
def example_group_started
|
21
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(example_group))
|
22
22
|
end
|
23
23
|
|
24
24
|
before do
|
25
|
-
|
25
|
+
example_group_started
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#dump_summary" do
|
@@ -49,7 +49,7 @@ OUT
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe "#
|
52
|
+
describe "#example_group_started" do
|
53
53
|
describe "when ExampleGroup has a nested description" do
|
54
54
|
|
55
55
|
describe "when ExampleGroup has no parents with nested description" do
|
@@ -60,13 +60,13 @@ OUT
|
|
60
60
|
|
61
61
|
describe "when ExampleGroup has one parent with nested description" do
|
62
62
|
attr_reader :child_example_group
|
63
|
-
def
|
63
|
+
def example_group_started
|
64
64
|
@child_example_group = Class.new(example_group).describe("Child ExampleGroup")
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "and parent ExampleGroups have not been printed" do
|
68
68
|
before do
|
69
|
-
formatter.
|
69
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should push ExampleGroup name with two spaces of indentation" do
|
@@ -79,9 +79,9 @@ OUT
|
|
79
79
|
|
80
80
|
describe "and parent ExampleGroups have been printed" do
|
81
81
|
before do
|
82
|
-
formatter.
|
82
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(example_group))
|
83
83
|
io.string = ""
|
84
|
-
formatter.
|
84
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should print only the indented ExampleGroup" do
|
@@ -94,14 +94,14 @@ OUT
|
|
94
94
|
|
95
95
|
describe "when ExampleGroup has two parents with nested description" do
|
96
96
|
attr_reader :child_example_group, :grand_child_example_group
|
97
|
-
def
|
97
|
+
def example_group_started
|
98
98
|
@child_example_group = Class.new(example_group).describe("Child ExampleGroup")
|
99
99
|
@grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
|
100
100
|
end
|
101
101
|
|
102
102
|
describe "and parent ExampleGroups have not been printed" do
|
103
103
|
before do
|
104
|
-
formatter.
|
104
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
105
105
|
|
106
106
|
end
|
107
107
|
|
@@ -116,9 +116,9 @@ OUT
|
|
116
116
|
|
117
117
|
describe "and parent ExampleGroups have been printed" do
|
118
118
|
before do
|
119
|
-
formatter.
|
119
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
120
120
|
io.string = ""
|
121
|
-
formatter.
|
121
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should print only the indented ExampleGroup" do
|
@@ -134,9 +134,9 @@ OUT
|
|
134
134
|
attr_reader :child_example_group
|
135
135
|
|
136
136
|
describe "and parent ExampleGroups have not been printed" do
|
137
|
-
def
|
137
|
+
def example_group_started
|
138
138
|
@child_example_group = Class.new(example_group)
|
139
|
-
formatter.
|
139
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should render only the parent ExampleGroup" do
|
@@ -147,11 +147,11 @@ OUT
|
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "and parent ExampleGroups have been printed" do
|
150
|
-
def
|
150
|
+
def example_group_started
|
151
151
|
@child_example_group = Class.new(example_group)
|
152
|
-
formatter.
|
152
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(example_group))
|
153
153
|
io.string = ""
|
154
|
-
formatter.
|
154
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(child_example_group))
|
155
155
|
end
|
156
156
|
|
157
157
|
it "should not render anything" do
|
@@ -161,7 +161,7 @@ OUT
|
|
161
161
|
end
|
162
162
|
|
163
163
|
describe "when ExampleGroup nested description is blank" do
|
164
|
-
def
|
164
|
+
def example_group_started
|
165
165
|
example_group.set_description
|
166
166
|
super
|
167
167
|
end
|
@@ -206,10 +206,10 @@ OUT
|
|
206
206
|
describe "where ExampleGroup has two superclasses with a description" do
|
207
207
|
attr_reader :child_example_group, :grand_child_example_group
|
208
208
|
|
209
|
-
def
|
209
|
+
def example_group_started
|
210
210
|
@child_example_group = Class.new(example_group).describe("Child ExampleGroup")
|
211
211
|
@grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
|
212
|
-
formatter.
|
212
|
+
formatter.example_group_started(Spec::Example::ExampleGroupProxy.new(grand_child_example_group))
|
213
213
|
end
|
214
214
|
|
215
215
|
describe "when having an error" do
|