rspec 1.1.8 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +30 -3
- data/License.txt +22 -0
- data/Manifest.txt +3 -3
- data/README.txt +1 -25
- data/Rakefile +4 -2
- data/TODO.txt +5 -4
- data/bin/autospec +1 -1
- data/examples/pure/shared_example_group_example.rb +2 -2
- data/lib/autotest/rspec.rb +1 -1
- data/lib/spec.rb +5 -1
- data/lib/spec/example.rb +1 -1
- data/lib/spec/example/before_and_after_hooks.rb +93 -0
- data/lib/spec/example/configuration.rb +10 -1
- data/lib/spec/example/example_group.rb +2 -1
- data/lib/spec/example/example_group_factory.rb +18 -1
- data/lib/spec/example/example_group_methods.rb +45 -123
- data/lib/spec/example/example_methods.rb +9 -6
- data/lib/spec/example/shared_example_group.rb +6 -12
- data/lib/spec/extensions/main.rb +1 -1
- data/lib/spec/interop/test/unit/testcase.rb +1 -1
- data/lib/spec/mocks/error_generator.rb +1 -1
- data/lib/spec/mocks/message_expectation.rb +19 -4
- data/lib/spec/mocks/methods.rb +2 -2
- data/lib/spec/mocks/proxy.rb +4 -5
- data/lib/spec/runner.rb +3 -4
- data/lib/spec/runner/formatter/nested_text_formatter.rb +3 -3
- data/lib/spec/runner/option_parser.rb +23 -22
- data/lib/spec/version.rb +1 -1
- data/rspec.gemspec +19 -8
- data/spec/autotest/rspec_spec.rb +5 -1
- data/spec/spec/example/configuration_spec.rb +229 -215
- data/spec/spec/example/example_group_class_definition_spec.rb +9 -9
- data/spec/spec/example/example_group_factory_spec.rb +48 -27
- data/spec/spec/example/example_group_methods_spec.rb +436 -426
- data/spec/spec/example/example_group_spec.rb +459 -500
- data/spec/spec/example/example_methods_spec.rb +92 -86
- data/spec/spec/example/shared_example_group_spec.rb +219 -203
- data/spec/spec/extensions/main_spec.rb +23 -23
- data/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +13 -0
- data/spec/spec/interop/test/unit/spec_spec.rb +15 -8
- data/spec/spec/mocks/mock_spec.rb +12 -2
- data/spec/spec/mocks/nil_expectation_warning_spec.rb +0 -1
- data/spec/spec/mocks/partial_mock_spec.rb +10 -5
- data/spec/spec/package/bin_spec_spec.rb +8 -0
- data/spec/spec/runner/command_line_spec.rb +101 -100
- data/spec/spec/runner/drb_command_line_spec.rb +0 -2
- data/spec/spec/runner/formatter/html_formatter_spec.rb +1 -4
- data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +230 -245
- data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +2 -3
- data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +110 -109
- data/spec/spec/runner/option_parser_spec.rb +18 -6
- data/spec/spec_helper.rb +26 -5
- data/stories/mock_framework_integration/use_flexmock.story +1 -1
- metadata +38 -7
- data/lib/spec/example/module_inclusion_warnings.rb +0 -38
- data/spec/spec/example/example_group/described_module_spec.rb +0 -20
- data/spec/spec/example/example_group/warning_messages_spec.rb +0 -76
@@ -6,7 +6,6 @@ module Spec
|
|
6
6
|
module Runner
|
7
7
|
module Formatter
|
8
8
|
describe TextMateFormatter do
|
9
|
-
include SandboxedOptions
|
10
9
|
attr_reader :root, :suffix, :expected_file
|
11
10
|
before do
|
12
11
|
@root = File.expand_path(File.dirname(__FILE__) + '/../../../..')
|
@@ -33,9 +32,9 @@ module Spec
|
|
33
32
|
]
|
34
33
|
err = StringIO.new
|
35
34
|
out = StringIO.new
|
36
|
-
options = ::Spec::Runner::OptionParser.parse(args, err, out)
|
37
|
-
run_with(options)
|
38
35
|
|
36
|
+
run_with ::Spec::Runner::OptionParser.parse(args, err, out)
|
37
|
+
|
39
38
|
yield(out.string)
|
40
39
|
end
|
41
40
|
end
|
@@ -5,150 +5,151 @@ module Spec
|
|
5
5
|
module Runner
|
6
6
|
module Formatter
|
7
7
|
describe SpecdocFormatter do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
with_sandboxed_options do
|
9
|
+
attr_reader :io, :formatter, :example_group
|
10
|
+
before(:each) do
|
11
|
+
@io = StringIO.new
|
12
|
+
options.stub!(:dry_run).and_return(false)
|
13
|
+
options.stub!(:colour).and_return(false)
|
14
|
+
@formatter = SpecdocFormatter.new(options, io)
|
15
|
+
@example_group = ::Spec::Example::ExampleGroup.describe("ExampleGroup") do
|
16
|
+
specify "example" do
|
17
|
+
end
|
17
18
|
end
|
18
19
|
end
|
19
|
-
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def add_example_group
|
27
|
-
formatter.add_example_group(example_group)
|
28
|
-
end
|
21
|
+
describe "where ExampleGroup has no superclasss with a description" do
|
22
|
+
before do
|
23
|
+
add_example_group
|
24
|
+
end
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
formatter.dump_summary(3, 2, 1, 0)
|
33
|
-
io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
|
26
|
+
def add_example_group
|
27
|
+
formatter.add_example_group(example_group)
|
34
28
|
end
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
describe "#dump_summary" do
|
31
|
+
it "should produce standard summary without pending when pending has a 0 count" do
|
32
|
+
formatter.dump_summary(3, 2, 1, 0)
|
33
|
+
io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should produce standard summary" do
|
37
|
+
formatter.dump_summary(3, 2, 1, 4)
|
38
|
+
io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure, 4 pending\n")
|
39
|
+
end
|
39
40
|
end
|
40
|
-
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
describe "#add_example_group" do
|
43
|
+
it "should push ExampleGroup name" do
|
44
|
+
io.string.should eql("\nExampleGroup\n")
|
45
|
+
end
|
45
46
|
end
|
46
|
-
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
describe "#example_failed" do
|
49
|
+
describe "where ExampleGroup has no superclasss with a description" do
|
50
|
+
describe "when having an error" do
|
51
|
+
it "should push failing spec name and failure number" do
|
52
|
+
formatter.example_failed(
|
53
|
+
example_group.it("spec"),
|
54
|
+
98,
|
55
|
+
Reporter::Failure.new("c s", RuntimeError.new)
|
56
|
+
)
|
57
|
+
io.string.should have_example_group_output("- spec (ERROR - 98)\n")
|
58
|
+
end
|
58
59
|
end
|
59
|
-
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
describe "when having an expectation failure" do
|
62
|
+
it "should push failing spec name and failure number" do
|
63
|
+
formatter.example_failed(
|
64
|
+
example_group.it("spec"),
|
65
|
+
98,
|
66
|
+
Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new)
|
67
|
+
)
|
68
|
+
io.string.should have_example_group_output("- spec (FAILED - 98)\n")
|
69
|
+
end
|
69
70
|
end
|
70
71
|
end
|
71
|
-
end
|
72
72
|
|
73
|
-
|
74
|
-
|
73
|
+
describe "where ExampleGroup has two superclasses with a description" do
|
74
|
+
attr_reader :child_example_group, :grand_child_example_group
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "when having an error" do
|
83
|
-
it "should push failing spec name and failure number" do
|
84
|
-
formatter.example_failed(
|
85
|
-
example_group.it("spec"),
|
86
|
-
98,
|
87
|
-
Reporter::Failure.new("c s", RuntimeError.new)
|
88
|
-
)
|
89
|
-
io.string.should have_nested_example_group_output("- spec (ERROR - 98)\n")
|
76
|
+
def add_example_group
|
77
|
+
@child_example_group = Class.new(example_group).describe("Child ExampleGroup")
|
78
|
+
@grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
|
79
|
+
formatter.add_example_group(grand_child_example_group)
|
90
80
|
end
|
91
|
-
end
|
92
81
|
|
93
|
-
|
94
|
-
|
95
|
-
|
82
|
+
describe "when having an error" do
|
83
|
+
it "should push failing spec name and failure number" do
|
84
|
+
formatter.example_failed(
|
96
85
|
example_group.it("spec"),
|
97
86
|
98,
|
98
|
-
Reporter::Failure.new("c s",
|
99
|
-
|
100
|
-
|
87
|
+
Reporter::Failure.new("c s", RuntimeError.new)
|
88
|
+
)
|
89
|
+
io.string.should have_nested_example_group_output("- spec (ERROR - 98)\n")
|
90
|
+
end
|
101
91
|
end
|
102
|
-
end
|
103
92
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
93
|
+
describe "when having an expectation" do
|
94
|
+
it "should push failing spec name and failure number" do
|
95
|
+
formatter.example_failed(
|
96
|
+
example_group.it("spec"),
|
97
|
+
98,
|
98
|
+
Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new)
|
99
|
+
)
|
100
|
+
io.string.should have_nested_example_group_output("- spec (FAILED - 98)\n")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def have_nested_example_group_output(expected_output)
|
105
|
+
expected_full_output = "\nExampleGroup Child ExampleGroup GrandChild ExampleGroup\n#{expected_output}"
|
106
|
+
::Spec::Matchers::SimpleMatcher.new(expected_full_output) do |actual|
|
107
|
+
actual == expected_full_output
|
108
|
+
end
|
108
109
|
end
|
109
110
|
end
|
110
111
|
end
|
111
|
-
end
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
describe "#start" do
|
114
|
+
it "should push nothing on start" do
|
115
|
+
formatter.start(5)
|
116
|
+
io.string.should have_example_group_output("")
|
117
|
+
end
|
117
118
|
end
|
118
|
-
end
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
120
|
+
describe "#start_dump" do
|
121
|
+
it "should push nothing on start dump" do
|
122
|
+
formatter.start_dump
|
123
|
+
io.string.should have_example_group_output("")
|
124
|
+
end
|
124
125
|
end
|
125
|
-
end
|
126
126
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
127
|
+
describe "#example_passed" do
|
128
|
+
it "should push passing spec name" do
|
129
|
+
formatter.example_passed(example_group.it("spec"))
|
130
|
+
io.string.should have_example_group_output("- spec\n")
|
131
|
+
end
|
131
132
|
end
|
132
|
-
end
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
134
|
+
describe "#example_pending" do
|
135
|
+
it "should push pending example name and message" do
|
136
|
+
formatter.example_pending(example_group.examples.first, 'reason', "#{__FILE__}:#{__LINE__}")
|
137
|
+
io.string.should have_example_group_output("- example (PENDING: reason)\n")
|
138
|
+
end
|
139
139
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
140
|
+
it "should dump pending" do
|
141
|
+
formatter.example_pending(example_group.examples.first, 'reason', "#{__FILE__}:#{__LINE__}")
|
142
|
+
io.rewind
|
143
|
+
formatter.dump_pending
|
144
|
+
io.string.should =~ /Pending\:\nExampleGroup example \(reason\)\n/
|
145
|
+
end
|
145
146
|
end
|
146
|
-
end
|
147
147
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
148
|
+
def have_example_group_output(expected_output)
|
149
|
+
expected = "\nExampleGroup\n#{expected_output}"
|
150
|
+
::Spec::Matchers::SimpleMatcher.new(expected) do |actual|
|
151
|
+
actual == expected
|
152
|
+
end
|
152
153
|
end
|
153
154
|
end
|
154
155
|
end
|
@@ -28,6 +28,12 @@ describe "OptionParser" do
|
|
28
28
|
@parser.options
|
29
29
|
end
|
30
30
|
|
31
|
+
it "should leave the submitted argv alone" do
|
32
|
+
args = ["--pattern", "foo"]
|
33
|
+
@parser.order!(args)
|
34
|
+
args.should == ["--pattern", "foo"]
|
35
|
+
end
|
36
|
+
|
31
37
|
it "should accept files to include" do
|
32
38
|
options = parse(["--pattern", "foo"])
|
33
39
|
options.filename_pattern.should == "foo"
|
@@ -66,12 +72,18 @@ describe "OptionParser" do
|
|
66
72
|
options.colour.should == false
|
67
73
|
end
|
68
74
|
|
69
|
-
it "should print help to stdout if no args" do
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
+
it "should print help to stdout if no args and spec_comand?" do
|
76
|
+
Spec.stub!(:spec_command?).and_return(true)
|
77
|
+
options = parse([])
|
78
|
+
@out.rewind
|
79
|
+
@out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should not print help to stdout if no args and NOT spec_command?" do
|
83
|
+
Spec.stub!(:spec_command?).and_return(false)
|
84
|
+
options = parse([])
|
85
|
+
@out.rewind
|
86
|
+
@out.read.should == ""
|
75
87
|
end
|
76
88
|
|
77
89
|
it "should print help to stdout" do
|
data/spec/spec_helper.rb
CHANGED
@@ -35,12 +35,16 @@ module Spec
|
|
35
35
|
end
|
36
36
|
exception
|
37
37
|
end
|
38
|
+
|
39
|
+
def run_with(options)
|
40
|
+
::Spec::Runner::CommandLine.run(options)
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
|
-
|
45
|
+
def with_sandboxed_options
|
42
46
|
attr_reader :options
|
43
|
-
|
47
|
+
|
44
48
|
before(:each) do
|
45
49
|
@original_rspec_options = ::Spec::Runner.options
|
46
50
|
::Spec::Runner.use(@options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new))
|
@@ -49,8 +53,25 @@ share_as :SandboxedOptions do
|
|
49
53
|
after(:each) do
|
50
54
|
::Spec::Runner.use(@original_rspec_options)
|
51
55
|
end
|
56
|
+
|
57
|
+
yield
|
58
|
+
end
|
52
59
|
|
53
|
-
|
54
|
-
|
60
|
+
def with_sandboxed_config
|
61
|
+
attr_reader :config
|
62
|
+
|
63
|
+
before(:each) do
|
64
|
+
@config = ::Spec::Example::Configuration.new
|
65
|
+
@original_configuration = ::Spec::Runner.configuration
|
66
|
+
spec_configuration = @config
|
67
|
+
::Spec::Runner.instance_eval {@configuration = spec_configuration}
|
55
68
|
end
|
56
|
-
|
69
|
+
|
70
|
+
after(:each) do
|
71
|
+
original_configuration = @original_configuration
|
72
|
+
::Spec::Runner.instance_eval {@configuration = original_configuration}
|
73
|
+
::Spec::Example::ExampleGroupFactory.reset
|
74
|
+
end
|
75
|
+
|
76
|
+
yield
|
77
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RSpec Development Team
|
@@ -9,9 +9,39 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-20 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: diff-lcs
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: spicycode-rcov
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.1.3
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: syntax
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
15
45
|
- !ruby/object:Gem::Dependency
|
16
46
|
name: hoe
|
17
47
|
type: :development
|
@@ -20,7 +50,7 @@ dependencies:
|
|
20
50
|
requirements:
|
21
51
|
- - ">="
|
22
52
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
53
|
+
version: 1.8.0
|
24
54
|
version:
|
25
55
|
description: Behaviour Driven Development for Ruby.
|
26
56
|
email:
|
@@ -32,6 +62,7 @@ extensions: []
|
|
32
62
|
|
33
63
|
extra_rdoc_files:
|
34
64
|
- History.txt
|
65
|
+
- License.txt
|
35
66
|
- Manifest.txt
|
36
67
|
- README.txt
|
37
68
|
- TODO.txt
|
@@ -44,6 +75,7 @@ extra_rdoc_files:
|
|
44
75
|
- spec/spec/runner/failed.txt
|
45
76
|
files:
|
46
77
|
- History.txt
|
78
|
+
- License.txt
|
47
79
|
- Manifest.txt
|
48
80
|
- README.txt
|
49
81
|
- Rakefile
|
@@ -130,6 +162,7 @@ files:
|
|
130
162
|
- lib/spec/adapters/ruby_engine/mri.rb
|
131
163
|
- lib/spec/adapters/ruby_engine/rubinius.rb
|
132
164
|
- lib/spec/example.rb
|
165
|
+
- lib/spec/example/before_and_after_hooks.rb
|
133
166
|
- lib/spec/example/configuration.rb
|
134
167
|
- lib/spec/example/errors.rb
|
135
168
|
- lib/spec/example/example_group.rb
|
@@ -137,7 +170,6 @@ files:
|
|
137
170
|
- lib/spec/example/example_group_methods.rb
|
138
171
|
- lib/spec/example/example_matcher.rb
|
139
172
|
- lib/spec/example/example_methods.rb
|
140
|
-
- lib/spec/example/module_inclusion_warnings.rb
|
141
173
|
- lib/spec/example/module_reopening_fix.rb
|
142
174
|
- lib/spec/example/pending.rb
|
143
175
|
- lib/spec/example/shared_example_group.rb
|
@@ -258,8 +290,6 @@ files:
|
|
258
290
|
- spec/spec.opts
|
259
291
|
- spec/spec/adapters/ruby_engine_spec.rb
|
260
292
|
- spec/spec/example/configuration_spec.rb
|
261
|
-
- spec/spec/example/example_group/described_module_spec.rb
|
262
|
-
- spec/spec/example/example_group/warning_messages_spec.rb
|
263
293
|
- spec/spec/example/example_group_class_definition_spec.rb
|
264
294
|
- spec/spec/example/example_group_factory_spec.rb
|
265
295
|
- spec/spec/example/example_group_methods_spec.rb
|
@@ -279,6 +309,7 @@ files:
|
|
279
309
|
- spec/spec/interop/test/unit/resources/spec_that_fails.rb
|
280
310
|
- spec/spec/interop/test/unit/resources/spec_that_passes.rb
|
281
311
|
- spec/spec/interop/test/unit/resources/spec_with_errors.rb
|
312
|
+
- spec/spec/interop/test/unit/resources/spec_with_options_hash.rb
|
282
313
|
- spec/spec/interop/test/unit/resources/test_case_that_fails.rb
|
283
314
|
- spec/spec/interop/test/unit/resources/test_case_that_passes.rb
|
284
315
|
- spec/spec/interop/test/unit/resources/test_case_with_errors.rb
|
@@ -472,6 +503,6 @@ rubyforge_project: rspec
|
|
472
503
|
rubygems_version: 1.3.0
|
473
504
|
signing_key:
|
474
505
|
specification_version: 2
|
475
|
-
summary: rspec 1.1.
|
506
|
+
summary: rspec 1.1.9
|
476
507
|
test_files: []
|
477
508
|
|