rspec 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +78 -1
- data/EXAMPLES.rd +8 -5
- data/README +1 -0
- data/Rakefile +1 -1
- data/examples/pending_example.rb +20 -0
- data/lib/autotest/rspec.rb +46 -18
- data/lib/spec/dsl.rb +1 -0
- data/lib/spec/dsl/behaviour.rb +37 -27
- data/lib/spec/dsl/behaviour_callbacks.rb +4 -0
- data/lib/spec/dsl/behaviour_eval.rb +27 -16
- data/lib/spec/dsl/behaviour_factory.rb +2 -2
- data/lib/spec/dsl/composite_proc_builder.rb +9 -4
- data/lib/spec/dsl/configuration.rb +20 -4
- data/lib/spec/dsl/description.rb +7 -0
- data/lib/spec/dsl/errors.rb +9 -0
- data/lib/spec/dsl/example.rb +18 -10
- data/lib/spec/matchers/have.rb +10 -13
- data/lib/spec/matchers/operator_matcher.rb +3 -3
- data/lib/spec/matchers/raise_error.rb +8 -3
- data/lib/spec/mocks/error_generator.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +11 -0
- data/lib/spec/mocks/methods.rb +9 -5
- data/lib/spec/mocks/proxy.rb +13 -9
- data/lib/spec/rake/spectask.rb +80 -38
- data/lib/spec/runner/backtrace_tweaker.rb +2 -1
- data/lib/spec/runner/behaviour_runner.rb +37 -16
- data/lib/spec/runner/formatter/base_formatter.rb +23 -15
- data/lib/spec/runner/formatter/base_text_formatter.rb +39 -11
- data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +7 -3
- data/lib/spec/runner/formatter/failing_examples_formatter.rb +3 -3
- data/lib/spec/runner/formatter/html_formatter.rb +32 -25
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +6 -5
- data/lib/spec/runner/formatter/rdoc_formatter.rb +6 -6
- data/lib/spec/runner/formatter/specdoc_formatter.rb +7 -6
- data/lib/spec/runner/option_parser.rb +6 -5
- data/lib/spec/runner/options.rb +60 -43
- data/lib/spec/runner/reporter.rb +17 -6
- data/lib/spec/runner/spec_parser.rb +1 -1
- data/lib/spec/translator.rb +8 -0
- data/lib/spec/version.rb +3 -3
- data/plugins/mock_frameworks/flexmock.rb +14 -18
- data/plugins/mock_frameworks/mocha.rb +0 -2
- data/plugins/mock_frameworks/rr.rb +21 -0
- data/spec/autotest/discover_spec.rb +19 -0
- data/spec/autotest/rspec_spec.rb +257 -0
- data/spec/autotest_helper.rb +4 -0
- data/spec/spec/dsl/behaviour_eval_spec.rb +30 -0
- data/spec/spec/dsl/behaviour_factory_spec.rb +18 -0
- data/spec/spec/dsl/behaviour_spec.rb +95 -58
- data/spec/spec/dsl/composite_proc_builder_spec.rb +0 -13
- data/spec/spec/dsl/configuration_spec.rb +6 -1
- data/spec/spec/dsl/description_spec.rb +9 -1
- data/spec/spec/dsl/example_class_spec.rb +3 -3
- data/spec/spec/dsl/example_instance_spec.rb +26 -28
- data/spec/spec/dsl/example_matcher_spec.rb +91 -0
- data/spec/spec/dsl/shared_behaviour_spec.rb +24 -0
- data/spec/spec/expectations/extensions/object_spec.rb +2 -2
- data/spec/spec/expectations/fail_with_spec.rb +2 -2
- data/spec/spec/matchers/have_spec.rb +1 -1
- data/spec/spec/matchers/operator_matcher_spec.rb +10 -10
- data/spec/spec/matchers/raise_error_spec.rb +38 -0
- data/spec/spec/mocks/argument_expectation_spec.rb +18 -14
- data/spec/spec/mocks/at_most_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_11545_spec.rb +31 -0
- data/spec/spec/mocks/partial_mock_spec.rb +33 -1
- data/spec/spec/runner/behaviour_runner_spec.rb +72 -49
- data/spec/spec/runner/command_line_spec.rb +1 -1
- data/spec/spec/runner/context_matching_spec.rb +10 -10
- data/spec/spec/runner/drb_command_line_spec.rb +62 -59
- data/spec/spec/runner/extensions/bug_report_10577_spec.rb +35 -0
- data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +15 -2
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +3 -3
- data/spec/spec/runner/formatter/html_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +14 -15
- data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +1 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +42 -9
- data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +40 -40
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +55 -49
- data/spec/spec/runner/option_parser_spec.rb +16 -15
- data/spec/spec/runner/options_spec.rb +64 -31
- data/spec/spec/runner/reporter_spec.rb +67 -15
- data/spec/spec/spec_classes.rb +9 -1
- data/spec/spec/translator_spec.rb +48 -0
- data/spec/spec_helper.rb +5 -2
- metadata +13 -6
- data/examples/not_yet_implemented_spec.rb +0 -12
- data/spec/spec/runner/example_matcher_spec.rb +0 -127
@@ -2,11 +2,11 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
2
2
|
|
3
3
|
module Spec
|
4
4
|
module Runner
|
5
|
-
describe
|
5
|
+
describe Options do
|
6
6
|
before do
|
7
|
-
@
|
8
|
-
@
|
9
|
-
@options = Options.new
|
7
|
+
@err = StringIO.new('')
|
8
|
+
@out = StringIO.new('')
|
9
|
+
@options = Options.new(@err, @out)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "instantiates empty arrays" do
|
@@ -23,36 +23,42 @@ module Spec
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "parse_diff sets context_lines" do
|
26
|
-
@options.parse_diff nil
|
26
|
+
@options.parse_diff nil
|
27
27
|
@options.context_lines.should == 3
|
28
28
|
end
|
29
29
|
|
30
30
|
it "defaults diff to unified" do
|
31
|
-
@options.parse_diff nil
|
31
|
+
@options.parse_diff nil
|
32
32
|
@options.diff_format.should == :unified
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should use unified diff format option when format is unified" do
|
36
|
-
@options.parse_diff 'unified'
|
36
|
+
@options.parse_diff 'unified'
|
37
37
|
@options.diff_format.should == :unified
|
38
38
|
@options.differ_class.should equal(Spec::Expectations::Differs::Default)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should use context diff format option when format is context" do
|
42
|
-
@options.parse_diff 'context'
|
42
|
+
@options.parse_diff 'context'
|
43
43
|
@options.diff_format.should == :context
|
44
44
|
@options.differ_class.should == Spec::Expectations::Differs::Default
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should use custom diff format option when format is a custom format" do
|
48
|
-
@options.parse_diff "Custom::Formatter"
|
48
|
+
@options.parse_diff "Custom::Formatter"
|
49
49
|
@options.diff_format.should == :custom
|
50
50
|
@options.differ_class.should == Custom::Formatter
|
51
51
|
end
|
52
52
|
|
53
|
-
it "should print instructions about how to fix
|
54
|
-
@options.parse_diff "Custom::
|
55
|
-
@
|
53
|
+
it "should print instructions about how to fix missing differ" do
|
54
|
+
lambda { @options.parse_diff "Custom::MissingDiffer" }.should raise_error(NameError)
|
55
|
+
@err.string.should match(/Couldn't find differ class Custom::MissingDiffer/n)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should print instructions about how to fix bad formatter" do
|
59
|
+
lambda do
|
60
|
+
@options.parse_format "Custom::BadFormatter"
|
61
|
+
end.should raise_error(NameError, /undefined local variable or method `bad_method'/)
|
56
62
|
end
|
57
63
|
|
58
64
|
it "parse_example sets single example when argument not a file" do
|
@@ -76,9 +82,50 @@ module Spec
|
|
76
82
|
end
|
77
83
|
end
|
78
84
|
|
79
|
-
describe
|
85
|
+
describe Options, "splitting class names and args" do
|
86
|
+
before do
|
87
|
+
@err = StringIO.new('')
|
88
|
+
@out = StringIO.new('')
|
89
|
+
@options = Options.new(@err, @out)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should split class names with args" do
|
93
|
+
@options.split_at_colon('Foo').should == ['Foo', nil]
|
94
|
+
@options.split_at_colon('Foo:arg').should == ['Foo', 'arg']
|
95
|
+
@options.split_at_colon('Foo::Bar::Zap:arg').should == ['Foo::Bar::Zap', 'arg']
|
96
|
+
@options.split_at_colon('Foo:arg1,arg2').should == ['Foo', 'arg1,arg2']
|
97
|
+
@options.split_at_colon('Foo::Bar::Zap:arg1,arg2').should == ['Foo::Bar::Zap', 'arg1,arg2']
|
98
|
+
@options.split_at_colon('Foo::Bar::Zap:drb://foo,drb://bar').should == ['Foo::Bar::Zap', 'drb://foo,drb://bar']
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should raise error when splitting something starting with a number" do
|
102
|
+
lambda { @options.split_at_colon('') }.should raise_error("Couldn't parse \"\"")
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should raise error when not class name" do
|
106
|
+
lambda do
|
107
|
+
@options.load_class('foo', 'fruit', '--food')
|
108
|
+
end.should raise_error('"foo" is not a valid class name')
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe Options, "receiving create_behaviour_runner" do
|
80
113
|
before do
|
81
|
-
@
|
114
|
+
@err = StringIO.new
|
115
|
+
@out = StringIO.new
|
116
|
+
@options = Options.new(@err, @out)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should fail when custom runner not found" do
|
120
|
+
@options.runner_arg = "Whatever"
|
121
|
+
lambda { @options.create_behaviour_runner }.should raise_error(NameError)
|
122
|
+
@err.string.should match(/Couldn't find behaviour runner class/)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should fail when custom runner not valid class name" do
|
126
|
+
@options.runner_arg = "whatever"
|
127
|
+
lambda { @options.create_behaviour_runner }.should raise_error('"whatever" is not a valid class name')
|
128
|
+
@err.string.should match(/"whatever" is not a valid class name/)
|
82
129
|
end
|
83
130
|
|
84
131
|
it "returns nil when generate is true" do
|
@@ -91,20 +138,6 @@ module Spec
|
|
91
138
|
runner.class.should == BehaviourRunner
|
92
139
|
end
|
93
140
|
|
94
|
-
it "returns a custom runner when runner_type is set" do
|
95
|
-
runner_type = Class.new do
|
96
|
-
attr_reader :options
|
97
|
-
def initialize(options)
|
98
|
-
@options = options
|
99
|
-
end
|
100
|
-
end
|
101
|
-
@options.runner_type = runner_type
|
102
|
-
|
103
|
-
runner = @options.create_behaviour_runner
|
104
|
-
runner.class.should == runner_type
|
105
|
-
runner.options.should === @options
|
106
|
-
end
|
107
|
-
|
108
141
|
it "does not set Expectations differ when differ_class is not set" do
|
109
142
|
@options.differ_class = nil
|
110
143
|
Spec::Expectations.should_not_receive(:differ=)
|
@@ -116,7 +149,7 @@ module Spec
|
|
116
149
|
Spec::Expectations.should_receive(:differ=).with(anything()).and_return do |arg|
|
117
150
|
arg.class.should == Spec::Expectations::Differs::Default
|
118
151
|
end
|
119
|
-
@options.
|
152
|
+
@options.configure
|
120
153
|
end
|
121
154
|
|
122
155
|
it "creates a Reporter" do
|
@@ -124,7 +157,7 @@ module Spec
|
|
124
157
|
@options.formatters << formatter
|
125
158
|
reporter = Reporter.new(@formatters, @backtrace_tweaker)
|
126
159
|
Reporter.should_receive(:new).with(@options.formatters, @options.backtrace_tweaker).and_return(reporter)
|
127
|
-
@options.
|
160
|
+
@options.configure
|
128
161
|
@options.reporter.should === reporter
|
129
162
|
end
|
130
163
|
|
@@ -135,7 +168,7 @@ module Spec
|
|
135
168
|
formatter.should_receive(:colour=).with(true)
|
136
169
|
formatter.should_receive(:dry_run=).with(true)
|
137
170
|
@options.formatters << formatter
|
138
|
-
@options.
|
171
|
+
@options.configure
|
139
172
|
end
|
140
173
|
end
|
141
174
|
end
|
@@ -14,6 +14,10 @@ module Spec
|
|
14
14
|
def failure
|
15
15
|
Mocks::DuckTypeArgConstraint.new(:header, :exception)
|
16
16
|
end
|
17
|
+
|
18
|
+
def description(s)
|
19
|
+
Spec::DSL::Description.new(s)
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
describe Reporter do
|
@@ -21,8 +25,8 @@ module Spec
|
|
21
25
|
before(:each) {setup}
|
22
26
|
|
23
27
|
it "should tell formatter when behaviour is added" do
|
24
|
-
@formatter.should_receive(:add_behaviour).with("behaviour")
|
25
|
-
@reporter.add_behaviour("behaviour")
|
28
|
+
@formatter.should_receive(:add_behaviour).with(description("behaviour"))
|
29
|
+
@reporter.add_behaviour(description("behaviour"))
|
26
30
|
end
|
27
31
|
|
28
32
|
it "should handle multiple behaviours with same name" do
|
@@ -30,14 +34,15 @@ module Spec
|
|
30
34
|
@formatter.should_receive(:example_started).exactly(3).times
|
31
35
|
@formatter.should_receive(:example_passed).exactly(3).times
|
32
36
|
@formatter.should_receive(:start_dump)
|
37
|
+
@formatter.should_receive(:close).with(no_args)
|
33
38
|
@formatter.should_receive(:dump_summary).with(anything(), 3, 0, 0)
|
34
|
-
@reporter.add_behaviour("behaviour")
|
39
|
+
@reporter.add_behaviour(description("behaviour"))
|
35
40
|
@reporter.example_started("spec 1")
|
36
41
|
@reporter.example_finished("spec 1")
|
37
|
-
@reporter.add_behaviour("behaviour")
|
42
|
+
@reporter.add_behaviour(description("behaviour"))
|
38
43
|
@reporter.example_started("spec 2")
|
39
44
|
@reporter.example_finished("spec 2")
|
40
|
-
@reporter.add_behaviour("behaviour")
|
45
|
+
@reporter.add_behaviour(description("behaviour"))
|
41
46
|
@reporter.example_started("spec 3")
|
42
47
|
@reporter.example_finished("spec 3")
|
43
48
|
@reporter.dump
|
@@ -51,12 +56,13 @@ module Spec
|
|
51
56
|
@formatter.should_receive(:example_failed).with("example", 2, failure)
|
52
57
|
@formatter.should_receive(:dump_failure).exactly(2).times
|
53
58
|
@formatter.should_receive(:start_dump)
|
59
|
+
@formatter.should_receive(:close).with(no_args)
|
54
60
|
@formatter.should_receive(:dump_summary).with(anything(), 4, 2, 0)
|
55
61
|
@backtrace_tweaker.should_receive(:tweak_backtrace).twice
|
56
|
-
@reporter.add_behaviour("behaviour")
|
62
|
+
@reporter.add_behaviour(description("behaviour"))
|
57
63
|
@reporter.example_finished("example")
|
58
64
|
@reporter.example_finished("example", error)
|
59
|
-
@reporter.add_behaviour("behaviour")
|
65
|
+
@reporter.add_behaviour(description("behaviour"))
|
60
66
|
@reporter.example_finished("example")
|
61
67
|
@reporter.example_finished("example", error)
|
62
68
|
@reporter.dump
|
@@ -65,12 +71,14 @@ module Spec
|
|
65
71
|
it "should push stats to formatter even with no data" do
|
66
72
|
@formatter.should_receive(:start_dump)
|
67
73
|
@formatter.should_receive(:dump_summary).with(anything(), 0, 0, 0)
|
74
|
+
@formatter.should_receive(:close).with(no_args)
|
68
75
|
@reporter.dump
|
69
76
|
end
|
70
77
|
|
71
78
|
it "should push time to formatter" do
|
72
79
|
@formatter.should_receive(:start).with(5)
|
73
80
|
@formatter.should_receive(:start_dump)
|
81
|
+
@formatter.should_receive(:close).with(no_args)
|
74
82
|
@formatter.should_receive(:dump_summary) do |time, a, b|
|
75
83
|
time.to_s.should match(/[0-9].[0-9|e|-]+/)
|
76
84
|
end
|
@@ -80,7 +88,7 @@ module Spec
|
|
80
88
|
end
|
81
89
|
end
|
82
90
|
|
83
|
-
describe Reporter, "
|
91
|
+
describe Reporter, "reporting one passing example" do
|
84
92
|
include ReporterSpecHelper
|
85
93
|
before(:each) {setup}
|
86
94
|
|
@@ -99,12 +107,13 @@ module Spec
|
|
99
107
|
@formatter.should_receive(:example_passed)
|
100
108
|
@formatter.should_receive(:start_dump)
|
101
109
|
@formatter.should_receive(:dump_summary).with(anything(), 1, 0, 0)
|
110
|
+
@formatter.should_receive(:close).with(no_args)
|
102
111
|
@reporter.example_finished("example")
|
103
112
|
@reporter.dump
|
104
113
|
end
|
105
114
|
end
|
106
115
|
|
107
|
-
describe Reporter, "
|
116
|
+
describe Reporter, "reporting one failing example" do
|
108
117
|
include ReporterSpecHelper
|
109
118
|
before(:each) {setup}
|
110
119
|
|
@@ -125,29 +134,72 @@ module Spec
|
|
125
134
|
@formatter.should_receive(:start_dump)
|
126
135
|
@formatter.should_receive(:dump_failure).with(1, anything())
|
127
136
|
@formatter.should_receive(:dump_summary).with(anything(), 1, 1, 0)
|
128
|
-
@
|
137
|
+
@formatter.should_receive(:close).with(no_args)
|
138
|
+
@reporter.add_behaviour(description("behaviour"))
|
129
139
|
@reporter.example_finished("example", RuntimeError.new)
|
130
140
|
@reporter.dump
|
131
141
|
end
|
132
142
|
|
133
143
|
end
|
134
144
|
|
135
|
-
describe Reporter, "
|
145
|
+
describe Reporter, "reporting one pending example (Not Yet Implemented)" do
|
136
146
|
include ReporterSpecHelper
|
137
147
|
before(:each) {setup}
|
138
148
|
|
139
|
-
it "should tell formatter example
|
140
|
-
@formatter.should_receive(:
|
149
|
+
it "should tell formatter example is pending" do
|
150
|
+
@formatter.should_receive(:example_pending).with(description("behaviour"), "example", "Not Yet Implemented")
|
151
|
+
@formatter.should_receive(:add_behaviour).with(description("behaviour"))
|
152
|
+
@reporter.add_behaviour(description('behaviour'))
|
141
153
|
@reporter.example_finished("example", nil, nil, true)
|
142
154
|
end
|
143
155
|
|
144
|
-
it "should account for
|
145
|
-
@formatter.should_receive(:
|
156
|
+
it "should account for pending example in stats" do
|
157
|
+
@formatter.should_receive(:example_pending).with(description("behaviour"), "example", "Not Yet Implemented")
|
146
158
|
@formatter.should_receive(:start_dump)
|
147
159
|
@formatter.should_receive(:dump_summary).with(anything(), 1, 0, 1)
|
160
|
+
@formatter.should_receive(:add_behaviour).with(description("behaviour"))
|
161
|
+
@formatter.should_receive(:close).with(no_args)
|
162
|
+
@reporter.add_behaviour(description('behaviour'))
|
148
163
|
@reporter.example_finished("example", nil, nil, true)
|
149
164
|
@reporter.dump
|
150
165
|
end
|
151
166
|
end
|
167
|
+
|
168
|
+
describe Reporter, "reporting one pending example (ExamplePendingError)" do
|
169
|
+
include ReporterSpecHelper
|
170
|
+
before(:each) {setup}
|
171
|
+
|
172
|
+
it "should tell formatter example is pending" do
|
173
|
+
@formatter.should_receive(:example_pending).with(description("behaviour"), "example", "reason")
|
174
|
+
@formatter.should_receive(:add_behaviour).with(description("behaviour"))
|
175
|
+
@reporter.add_behaviour(description('behaviour'))
|
176
|
+
@reporter.example_finished("example", Spec::DSL::ExamplePendingError.new("reason"), nil, false)
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should account for pending example in stats" do
|
180
|
+
@formatter.should_receive(:example_pending).with(description("behaviour"), "example", "reason")
|
181
|
+
@formatter.should_receive(:start_dump)
|
182
|
+
@formatter.should_receive(:dump_summary).with(anything(), 1, 0, 1)
|
183
|
+
@formatter.should_receive(:close).with(no_args)
|
184
|
+
@formatter.should_receive(:add_behaviour).with(description("behaviour"))
|
185
|
+
@reporter.add_behaviour(description('behaviour'))
|
186
|
+
@reporter.example_finished("example", Spec::DSL::ExamplePendingError.new("reason"), nil, false)
|
187
|
+
@reporter.dump
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe Reporter, "reporting one pending example (PendingFixedError)" do
|
192
|
+
include ReporterSpecHelper
|
193
|
+
before(:each) {setup}
|
194
|
+
|
195
|
+
it "should tell formatter pending example is fixed" do
|
196
|
+
@formatter.should_receive(:example_failed) do |name, counter, failure|
|
197
|
+
failure.header.should == "'behaviour example' FIXED"
|
198
|
+
end
|
199
|
+
@formatter.should_receive(:add_behaviour).with(description("behaviour"))
|
200
|
+
@reporter.add_behaviour(description('behaviour'))
|
201
|
+
@reporter.example_finished("example", Spec::DSL::PendingFixedError.new("reason"), nil, false)
|
202
|
+
end
|
203
|
+
end
|
152
204
|
end
|
153
205
|
end
|
data/spec/spec/spec_classes.rb
CHANGED
@@ -104,8 +104,16 @@ module Custom
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
+
class BadFormatter < Spec::Runner::Formatter::BaseTextFormatter
|
108
|
+
attr_reader :where
|
109
|
+
|
110
|
+
def initialize(where)
|
111
|
+
bad_method
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
107
115
|
class BehaviourRunner
|
108
|
-
def initialize(
|
116
|
+
def initialize(options, arg=nil); end
|
109
117
|
end
|
110
118
|
end
|
111
119
|
|
@@ -213,4 +213,52 @@ describe "Translator" do
|
|
213
213
|
"controller.should redirect_to('http://not_existing_domain_for_novalis.test.host/404.html')"
|
214
214
|
)
|
215
215
|
end
|
216
|
+
|
217
|
+
it "should translate :any_args" do
|
218
|
+
@t.translate_line(
|
219
|
+
"mock.should_receive(:foo).with(:any_args)"
|
220
|
+
).should eql(
|
221
|
+
"mock.should_receive(:foo).with(any_args)"
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
225
|
+
it "should translate :anything" do
|
226
|
+
@t.translate_line(
|
227
|
+
"mock.should_receive(:foo).with(:anything)"
|
228
|
+
).should eql(
|
229
|
+
"mock.should_receive(:foo).with(anything)"
|
230
|
+
)
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should translate :boolean" do
|
234
|
+
@t.translate_line(
|
235
|
+
"mock.should_receive(:foo).with(:boolean)"
|
236
|
+
).should eql(
|
237
|
+
"mock.should_receive(:foo).with(boolean)"
|
238
|
+
)
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should translate :no_args" do
|
242
|
+
@t.translate_line(
|
243
|
+
"mock.should_receive(:foo).with(:no_args)"
|
244
|
+
).should eql(
|
245
|
+
"mock.should_receive(:foo).with(no_args)"
|
246
|
+
)
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should translate :numeric" do
|
250
|
+
@t.translate_line(
|
251
|
+
"mock.should_receive(:foo).with(:numeric)"
|
252
|
+
).should eql(
|
253
|
+
"mock.should_receive(:foo).with(an_instance_of(Numeric))"
|
254
|
+
)
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should translate :string" do
|
258
|
+
@t.translate_line(
|
259
|
+
"mock.should_receive(:foo).with(:string)"
|
260
|
+
).should eql(
|
261
|
+
"mock.should_receive(:foo).with(an_instance_of(String))"
|
262
|
+
)
|
263
|
+
end
|
216
264
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,10 +4,11 @@ require 'rbconfig'
|
|
4
4
|
dir = File.dirname(__FILE__)
|
5
5
|
lib_path = File.expand_path("#{dir}/../lib")
|
6
6
|
$LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
|
7
|
+
$_spec_spec = true # Prevents Kernel.exit in various places
|
7
8
|
|
8
9
|
require 'spec'
|
9
10
|
require 'spec/mocks'
|
10
|
-
require 'hpricot'
|
11
|
+
require 'hpricot' # Needed to compare generated with wanted HTML
|
11
12
|
spec_classes_path = File.expand_path("#{dir}/../spec/spec/spec_classes")
|
12
13
|
require spec_classes_path unless $LOAD_PATH.include?(spec_classes_path)
|
13
14
|
|
@@ -26,7 +27,7 @@ module Spec
|
|
26
27
|
begin
|
27
28
|
proc.call
|
28
29
|
true
|
29
|
-
rescue => @error
|
30
|
+
rescue Exception => @error
|
30
31
|
false
|
31
32
|
end
|
32
33
|
end
|
@@ -41,3 +42,5 @@ module Spec
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
class NonStandardError < Exception; end
|
metadata
CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rspec
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-
|
8
|
-
summary: RSpec-1.0.
|
6
|
+
version: 1.0.6
|
7
|
+
date: 2007-08-12 00:00:00 -04:00
|
8
|
+
summary: RSpec-1.0.6 (r2326) - BDD for Ruby http://rspec.rubyforge.org/
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: rspec-devel@rubyforge.org
|
@@ -27,7 +27,7 @@ signing_key:
|
|
27
27
|
cert_chain:
|
28
28
|
post_install_message:
|
29
29
|
authors:
|
30
|
-
-
|
30
|
+
- RSpec Development Team
|
31
31
|
files:
|
32
32
|
- CHANGES
|
33
33
|
- EXAMPLES.rd
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/spec/dsl/composite_proc_builder.rb
|
45
45
|
- lib/spec/dsl/configuration.rb
|
46
46
|
- lib/spec/dsl/description.rb
|
47
|
+
- lib/spec/dsl/errors.rb
|
47
48
|
- lib/spec/dsl/example.rb
|
48
49
|
- lib/spec/dsl/example_matcher.rb
|
49
50
|
- lib/spec/dsl/example_should_raise_handler.rb
|
@@ -114,6 +115,9 @@ files:
|
|
114
115
|
- lib/spec/translator.rb
|
115
116
|
- lib/spec/version.rb
|
116
117
|
- lib/spec.rb
|
118
|
+
- spec/autotest/discover_spec.rb
|
119
|
+
- spec/autotest/rspec_spec.rb
|
120
|
+
- spec/autotest_helper.rb
|
117
121
|
- spec/spec/dsl/behaviour_eval_spec.rb
|
118
122
|
- spec/spec/dsl/behaviour_factory_spec.rb
|
119
123
|
- spec/spec/dsl/behaviour_spec.rb
|
@@ -122,6 +126,7 @@ files:
|
|
122
126
|
- spec/spec/dsl/description_spec.rb
|
123
127
|
- spec/spec/dsl/example_class_spec.rb
|
124
128
|
- spec/spec/dsl/example_instance_spec.rb
|
129
|
+
- spec/spec/dsl/example_matcher_spec.rb
|
125
130
|
- spec/spec/dsl/example_should_raise_spec.rb
|
126
131
|
- spec/spec/dsl/predicate_matcher_spec.rb
|
127
132
|
- spec/spec/dsl/shared_behaviour_spec.rb
|
@@ -152,6 +157,7 @@ files:
|
|
152
157
|
- spec/spec/mocks/at_least_spec.rb
|
153
158
|
- spec/spec/mocks/at_most_spec.rb
|
154
159
|
- spec/spec/mocks/bug_report_10260_spec.rb
|
160
|
+
- spec/spec/mocks/bug_report_11545_spec.rb
|
155
161
|
- spec/spec/mocks/bug_report_7611_spec.rb
|
156
162
|
- spec/spec/mocks/bug_report_7805_spec.rb
|
157
163
|
- spec/spec/mocks/bug_report_8165_spec.rb
|
@@ -176,8 +182,8 @@ files:
|
|
176
182
|
- spec/spec/runner/command_line_spec.rb
|
177
183
|
- spec/spec/runner/context_matching_spec.rb
|
178
184
|
- spec/spec/runner/drb_command_line_spec.rb
|
179
|
-
- spec/spec/runner/example_matcher_spec.rb
|
180
185
|
- spec/spec/runner/execution_context_spec.rb
|
186
|
+
- spec/spec/runner/extensions/bug_report_10577_spec.rb
|
181
187
|
- spec/spec/runner/extensions/kernel_spec.rb
|
182
188
|
- spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb
|
183
189
|
- spec/spec/runner/formatter/failing_examples_formatter_spec.rb
|
@@ -217,8 +223,8 @@ files:
|
|
217
223
|
- examples/legacy_spec.rb
|
218
224
|
- examples/mocking_example.rb
|
219
225
|
- examples/multi_threaded_behaviour_runner.rb
|
220
|
-
- examples/not_yet_implemented_spec.rb
|
221
226
|
- examples/partial_mock_example.rb
|
227
|
+
- examples/pending_example.rb
|
222
228
|
- examples/predicate_example.rb
|
223
229
|
- examples/priority.txt
|
224
230
|
- examples/shared_behaviours_example.rb
|
@@ -231,6 +237,7 @@ files:
|
|
231
237
|
- plugins/mock_frameworks
|
232
238
|
- plugins/mock_frameworks/flexmock.rb
|
233
239
|
- plugins/mock_frameworks/mocha.rb
|
240
|
+
- plugins/mock_frameworks/rr.rb
|
234
241
|
- plugins/mock_frameworks/rspec.rb
|
235
242
|
test_files: []
|
236
243
|
|