rspec-steps 0.4.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/README +10 -7
- data/lib/rspec-steps/duckpunch/example-group.rb +25 -19
- data/lib/rspec-steps/duckpunch/object-extensions.rb +4 -2
- data/lib/rspec-steps/stepwise.rb +65 -13
- data/spec/example_group_spec.rb +23 -23
- data/spec_help/file-sandbox.rb +10 -10
- data/spec_help/rspec-sandbox.rb +58 -36
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: feeff714af8dab45f65c914f485a8106a4b86940
|
4
|
+
data.tar.gz: e18ec6c20e2fac92749ef351323b6d4fa33b7bf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddc384403a0f28313483f99613d16c2c35a643777ac605c6de3e709f8693e074a801c0e995f4cceadd8d77730d096995187cbdac1c87e7ee573f7adf6159223d
|
7
|
+
data.tar.gz: 61c444f82fa0ed67bb53eaa5b534fcc88aa1ae413c73d4b7d7040b340f50b4598190a666469714a6eeec947776e239f7e1e527a3eabd600a086895a748e740de
|
data/doc/README
CHANGED
@@ -6,6 +6,10 @@ in sequence and which stop when a step fails. It's often incredibly
|
|
6
6
|
useful to be able to aseemble a series of tests that should all pass,
|
7
7
|
but where completely isolating them is less than sensible.
|
8
8
|
|
9
|
+
( RSpec Steps has gone on with the tide of progress - it only supports RSpec
|
10
|
+
3.x. If you need Rspec 2 suport, check out two-step:
|
11
|
+
https://github.com/LRDesign/two-step )
|
12
|
+
|
9
13
|
One excellent example is web site integration tests. With RSpec steps you can
|
10
14
|
do:
|
11
15
|
|
@@ -106,11 +110,10 @@ diverge, you can DRY your code out with shared_steps blocks, like so:
|
|
106
110
|
|
107
111
|
## Versions and Dependencies
|
108
112
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
0.0.9: Released Feb 22, 2013.
|
113
|
-
NOTES: works with rspec 2.6 through 2.10. Does not work with rspec >= 2.11
|
113
|
+
The goal (sadly unfulfilled) is to try to be compatible with as many versions
|
114
|
+
of RSpec 3.x as possible. Frankly, Rspec-Steps is more than a little bit of a
|
115
|
+
hack, and intrudes wholesale on RSpec's private interfaces.
|
114
116
|
|
115
|
-
|
116
|
-
|
117
|
+
We make good use of Travis to check compatibility, however. You can check what
|
118
|
+
versions of RSpec and Ruby RSpec-Steps works with here:
|
119
|
+
https://travis-ci.org/LRDesign/rspec-steps
|
@@ -1,27 +1,33 @@
|
|
1
1
|
require 'rspec/core'
|
2
2
|
require 'rspec-steps/stepwise'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
if RSpec.configuration.respond_to? :alias_example_group_to
|
5
|
+
RSpec.configuration.alias_example_group_to :steps, :stepwise => true
|
6
|
+
else
|
7
|
+
module RSpec::Steps
|
8
|
+
module DSL
|
9
|
+
def steps(*args, &block)
|
10
|
+
options =
|
11
|
+
if args.last.is_a?(Hash)
|
12
|
+
args.pop
|
13
|
+
else
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
options[:stepwise] = true
|
17
|
+
options[:caller] ||= caller
|
18
|
+
args.push(options)
|
16
19
|
|
17
|
-
|
20
|
+
describe(*args, &block)
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
|
-
end
|
21
|
-
|
22
|
-
RSpec::Core::ExampleGroup.extend RSpec::Steps::DSL
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
[RSpec::Core::ExampleGroup, RSpec, self].each do |mod|
|
26
|
+
mod.extend RSpec::Steps::DSL
|
27
|
+
end
|
28
|
+
Module::send(:include, RSpec::Steps::DSL)
|
29
|
+
end
|
26
30
|
|
27
|
-
RSpec::
|
31
|
+
RSpec::configure do |config|
|
32
|
+
config.include(RSpecStepwise, :stepwise => true)
|
33
|
+
end
|
@@ -3,6 +3,8 @@ require 'rspec-steps/stepwise'
|
|
3
3
|
require 'rspec/core/shared_example_group'
|
4
4
|
|
5
5
|
module RSpec::Core::SharedExampleGroup
|
6
|
-
alias
|
7
|
-
|
6
|
+
alias shared_steps shared_examples_for
|
7
|
+
if respond_to? :share_as
|
8
|
+
alias steps_shared_as share_as
|
9
|
+
end
|
8
10
|
end
|
data/lib/rspec-steps/stepwise.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
module RSpecStepwise
|
2
2
|
class ApatheticReporter < ::RSpec::Core::Reporter
|
3
|
+
def initialize
|
4
|
+
@examples = []
|
5
|
+
@failed_examples = []
|
6
|
+
@pending_examples = []
|
7
|
+
@duration = @start = @load_time = nil
|
8
|
+
end
|
9
|
+
|
3
10
|
def notify(*args)
|
4
11
|
#noop
|
5
12
|
end
|
@@ -22,10 +29,15 @@ module RSpecStepwise
|
|
22
29
|
|
23
30
|
def build_example_block
|
24
31
|
#variables of concern: reporter, instance
|
32
|
+
reporter = @reporter
|
25
33
|
@example_block = proc do
|
26
34
|
begin
|
27
35
|
self.class.filtered_examples.inject(true) do |success, example|
|
28
|
-
|
36
|
+
if RSpec.respond_to? :wants_to_quit
|
37
|
+
break if RSpec.wants_to_quit
|
38
|
+
else
|
39
|
+
break if RSpec.world.wants_to_quit
|
40
|
+
end
|
29
41
|
example.extend StepExample
|
30
42
|
unless success
|
31
43
|
example.metadata[:pending] = true
|
@@ -34,7 +46,13 @@ module RSpecStepwise
|
|
34
46
|
succeeded = with_indelible_ivars do
|
35
47
|
example.run(self, reporter)
|
36
48
|
end
|
37
|
-
|
49
|
+
if self.class.fail_fast? && !succeeded
|
50
|
+
if RSpec.respond_to? :wants_to_quit=
|
51
|
+
RSpec.wants_to_quit = true
|
52
|
+
else
|
53
|
+
RSpec.world.wants_to_quit = true
|
54
|
+
end
|
55
|
+
end
|
38
56
|
success && succeeded
|
39
57
|
end
|
40
58
|
end
|
@@ -48,10 +66,12 @@ module RSpecStepwise
|
|
48
66
|
rescue Object => ex
|
49
67
|
puts "\n#{__FILE__}:#{__LINE__} => #{[ex, ex.backtrace].pretty_inspect}"
|
50
68
|
end
|
69
|
+
alias run_before_example run_before_each
|
51
70
|
|
52
71
|
def run_after_each
|
53
72
|
@example_group_class.run_after_step(self)
|
54
73
|
end
|
74
|
+
alias run_after_example run_after_each
|
55
75
|
|
56
76
|
def with_around_hooks
|
57
77
|
yield
|
@@ -92,10 +112,18 @@ module RSpecStepwise
|
|
92
112
|
end
|
93
113
|
end
|
94
114
|
|
115
|
+
def _metadata_from_args(args)
|
116
|
+
if RSpec::Core::Metadata.respond_to?(:build_hash_from)
|
117
|
+
RSpec::Core::Metadata.build_hash_from(args)
|
118
|
+
else
|
119
|
+
build_metadata_hash_from(args)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
95
123
|
def before(*args, &block)
|
96
124
|
if args.first == :step
|
97
125
|
args.shift
|
98
|
-
options =
|
126
|
+
options = _metadata_from_args(args)
|
99
127
|
return ((hooks[:before][:step] ||= []) << build_before_hook(options, &block))
|
100
128
|
end
|
101
129
|
if args.first == :each
|
@@ -107,7 +135,7 @@ module RSpecStepwise
|
|
107
135
|
def after(*args, &block)
|
108
136
|
if args.first == :step
|
109
137
|
args.shift
|
110
|
-
options =
|
138
|
+
options = _metadata_from_args(args)
|
111
139
|
hooks[:after][:step] ||= []
|
112
140
|
return (hooks[:after][:step].unshift build_after_hook(options, &block))
|
113
141
|
end
|
@@ -162,32 +190,56 @@ module RSpecStepwise
|
|
162
190
|
|
163
191
|
def perform_steps(name, *args, &customization_block)
|
164
192
|
shared_block = nil
|
165
|
-
if world.respond_to? :shared_example_groups
|
193
|
+
if respond_to?(:world) and world.respond_to? :shared_example_groups
|
166
194
|
shared_block = world.shared_example_groups[name]
|
167
195
|
else
|
168
|
-
|
196
|
+
if respond_to?(:shared_example_groups)
|
197
|
+
shared_block = shared_example_groups[name]
|
198
|
+
else
|
199
|
+
shared_block = RSpec.world.shared_example_group_registry.find(parent_groups, name)
|
200
|
+
end
|
169
201
|
end
|
170
202
|
raise "Could not find shared example group named #{name.inspect}" unless shared_block
|
171
203
|
|
172
|
-
|
173
|
-
|
204
|
+
if respond_to? :module_exec
|
205
|
+
module_exec(*args, &shared_block)
|
206
|
+
module_exec(&customization_block) if customization_block
|
207
|
+
else
|
208
|
+
module_eval_with_args(*args, &shared_block)
|
209
|
+
module_eval(&customization_block) if customization_block
|
210
|
+
end
|
174
211
|
end
|
175
212
|
|
176
213
|
def run_examples(reporter)
|
177
214
|
whole_list_example = WholeListExample.new(self, "step list", {})
|
178
215
|
|
179
216
|
instance = new
|
180
|
-
|
181
|
-
|
182
|
-
|
217
|
+
if respond_to? :before_context_ivars
|
218
|
+
set_ivars(instance, before_context_ivars)
|
219
|
+
else
|
220
|
+
set_ivars(instance, before_all_ivars)
|
221
|
+
end
|
222
|
+
instance.example = whole_list_example if respond_to? :example=
|
223
|
+
instance.reporter = reporter if respond_to? :reporter=
|
183
224
|
|
184
225
|
result = suspend_transactional_fixtures do
|
185
226
|
whole_list_example.run(instance, reporter)
|
186
227
|
end
|
187
228
|
|
188
229
|
unless whole_list_example.exception.nil?
|
189
|
-
|
190
|
-
|
230
|
+
if fail_fast?
|
231
|
+
if RSpec.respond_to? :wants_to_quit=
|
232
|
+
RSpec.wants_to_quit = true
|
233
|
+
else
|
234
|
+
RSpec.world.wants_to_quit = true
|
235
|
+
end
|
236
|
+
end
|
237
|
+
if respond_to? :fail_filtered_examples
|
238
|
+
fail_filtered_examples(whole_list_example.exception, reporter)
|
239
|
+
else
|
240
|
+
ex = whole_list_example.exception
|
241
|
+
for_filtered_examples(reporter) {|example| example.fail_with_exception(reporter, ex) }
|
242
|
+
end
|
191
243
|
end
|
192
244
|
|
193
245
|
result
|
data/spec/example_group_spec.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'rspec-steps'
|
2
2
|
require 'rspec-sandbox'
|
3
3
|
|
4
|
-
describe RSpec::Core::ExampleGroup
|
4
|
+
describe RSpec::Core::ExampleGroup do
|
5
5
|
describe "::steps" do
|
6
6
|
it "should create an ExampleGroup that includes RSpec::Stepwise" do
|
7
7
|
group = nil
|
8
8
|
sandboxed do
|
9
|
-
group = steps "Test Steps" do
|
9
|
+
group = RSpec.steps "Test Steps" do
|
10
10
|
end
|
11
11
|
end
|
12
|
-
(class << group; self; end).included_modules.
|
12
|
+
expect((class << group; self; end).included_modules).to include(RSpecStepwise::ClassMethods)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
17
17
|
it "should retain instance variables between steps" do
|
18
18
|
group = nil
|
19
19
|
sandboxed do
|
20
|
-
group = steps "Test Steps" do
|
20
|
+
group = RSpec.steps "Test Steps" do
|
21
21
|
it("sets @a"){ @a = 1 }
|
22
22
|
it("reads @a"){ @a.should == 1}
|
23
23
|
end
|
@@ -25,14 +25,14 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
group.examples.each do |example|
|
28
|
-
example.metadata[:execution_result]
|
28
|
+
expect(example.metadata[:execution_result].status).to eq(:passed)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should work with shared_steps/perform steps" do
|
33
33
|
group = nil
|
34
34
|
sandboxed do
|
35
|
-
group = steps "Test Steps" do
|
35
|
+
group = RSpec.steps "Test Steps" do
|
36
36
|
shared_steps "add one" do
|
37
37
|
it("adds one to @a"){ @a += 1 }
|
38
38
|
end
|
@@ -46,7 +46,7 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
group.examples.each do |example|
|
49
|
-
example.metadata[:execution_result]
|
49
|
+
expect(example.metadata[:execution_result].status).to eq(:passed)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -56,7 +56,7 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
56
56
|
befores = []
|
57
57
|
|
58
58
|
sandboxed do
|
59
|
-
group = steps "Test Each Step" do
|
59
|
+
group = RSpec.steps "Test Each Step" do
|
60
60
|
before :each do
|
61
61
|
befores << :each
|
62
62
|
end
|
@@ -91,12 +91,12 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
91
91
|
group.run
|
92
92
|
end
|
93
93
|
|
94
|
-
befores.find_all{|item| item == :all}.length.
|
95
|
-
befores.find_all{|item| item == :each}.length.
|
96
|
-
befores.find_all{|item| item == :step}.length.
|
97
|
-
afters.find_all{|item| item == :all}.length.
|
98
|
-
afters.find_all{|item| item == :each}.length.
|
99
|
-
afters.find_all{|item| item == :step}.length.
|
94
|
+
expect(befores.find_all{|item| item == :all}.length).to eq(1)
|
95
|
+
expect(befores.find_all{|item| item == :each}.length).to eq(1)
|
96
|
+
expect(befores.find_all{|item| item == :step}.length).to eq(3)
|
97
|
+
expect(afters.find_all{|item| item == :all}.length).to eq(1)
|
98
|
+
expect(afters.find_all{|item| item == :each}.length).to eq(1)
|
99
|
+
expect(afters.find_all{|item| item == :step}.length).to eq(3)
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should mark later examples as failed if a before hook fails" do
|
@@ -104,7 +104,7 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
104
104
|
exception = Exception.new "Testing Error"
|
105
105
|
|
106
106
|
sandboxed do
|
107
|
-
group = steps "Test Steps" do
|
107
|
+
group = RSpec.steps "Test Steps" do
|
108
108
|
before { raise exception }
|
109
109
|
it { 1.should == 1 }
|
110
110
|
it { 1.should == 1 }
|
@@ -113,28 +113,28 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
group.examples.each do |example|
|
116
|
-
example.metadata[:execution_result]
|
117
|
-
example.metadata[:execution_result]
|
116
|
+
expect(example.metadata[:execution_result].status).to eq(:failed)
|
117
|
+
expect(example.metadata[:execution_result].exception).to eq(exception)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should mark later examples as pending if one fails" do
|
122
122
|
group = nil
|
123
123
|
sandboxed do
|
124
|
-
group = steps "Test Steps" do
|
124
|
+
group = RSpec.steps "Test Steps" do
|
125
125
|
it { fail "All others fail" }
|
126
126
|
it { 1.should == 1 }
|
127
127
|
end
|
128
128
|
group.run
|
129
129
|
end
|
130
130
|
|
131
|
-
group.examples[1].metadata[:pending].
|
131
|
+
expect(group.examples[1].metadata[:pending]).to eq(true)
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should allow nested steps", :pending => "Not really" do
|
135
135
|
group = nil
|
136
136
|
sandboxed do
|
137
|
-
group = steps "Test Steps" do
|
137
|
+
group = RSpec.steps "Test Steps" do
|
138
138
|
steps "Nested" do
|
139
139
|
it { @a = 1 }
|
140
140
|
it { @a.should == 1}
|
@@ -144,16 +144,16 @@ describe RSpec::Core::ExampleGroup, "defined as stepwise" do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
group.children[0].examples.each do |example|
|
147
|
-
example.metadata[:execution_result]
|
147
|
+
expect(example.metadata[:execution_result].status).to eq(:passed)
|
148
148
|
end
|
149
|
-
group.children[0].
|
149
|
+
expect(group.children[0].size).to eq(2)
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should not allow nested normal contexts" do
|
153
153
|
pending "A correct approach - in the meantime, this behavior is undefined"
|
154
154
|
expect {
|
155
155
|
sandboxed do
|
156
|
-
steps "Basic" do
|
156
|
+
RSpec.steps "Basic" do
|
157
157
|
describe "Not allowed" do
|
158
158
|
end
|
159
159
|
end
|
data/spec_help/file-sandbox.rb
CHANGED
@@ -34,7 +34,7 @@ module FileSandbox
|
|
34
34
|
end
|
35
35
|
|
36
36
|
attr_reader :sandbox
|
37
|
-
|
37
|
+
|
38
38
|
def in_sandbox(&block)
|
39
39
|
raise "I expected to create a sandbox as you passed in a block to me" if !block_given?
|
40
40
|
|
@@ -84,7 +84,7 @@ module FileSandbox
|
|
84
84
|
clean_up
|
85
85
|
FileUtils.mkdir_p @root
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def [](name)
|
89
89
|
SandboxFile.new(File.join(@root, name), name)
|
90
90
|
end
|
@@ -102,17 +102,17 @@ module FileSandbox
|
|
102
102
|
file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')
|
103
103
|
end
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
raise "unexpected keys '#{options.keys.join(', ')}'" unless options.empty?
|
107
|
-
|
107
|
+
|
108
108
|
dir || file
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
def remove(options)
|
112
112
|
name = File.join(@root, options[:file])
|
113
113
|
FileUtils.remove_file name
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
def clean_up
|
117
117
|
FileUtils.rm_rf @root
|
118
118
|
if File.exists? @root
|
@@ -124,7 +124,7 @@ module FileSandbox
|
|
124
124
|
|
125
125
|
class SandboxFile
|
126
126
|
attr_reader :path
|
127
|
-
|
127
|
+
|
128
128
|
def initialize(path, sandbox_path)
|
129
129
|
@path = path
|
130
130
|
@sandbox_path = sandbox_path
|
@@ -141,12 +141,12 @@ module FileSandbox
|
|
141
141
|
def content
|
142
142
|
File.read path
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
def content=(content)
|
146
146
|
FileUtils.mkdir_p File.dirname(@path)
|
147
147
|
File.open(@path, "w") {|f| f << content}
|
148
148
|
end
|
149
|
-
|
149
|
+
|
150
150
|
def binary_content=(content)
|
151
151
|
FileUtils.mkdir_p File.dirname(@path)
|
152
152
|
File.open(@path, "wb") {|f| f << content}
|
@@ -159,6 +159,6 @@ module FileSandbox
|
|
159
159
|
alias exists? exist?
|
160
160
|
alias contents content
|
161
161
|
alias contents= content=
|
162
|
-
alias binary_contents= binary_content=
|
162
|
+
alias binary_contents= binary_content=
|
163
163
|
end
|
164
164
|
end
|
data/spec_help/rspec-sandbox.rb
CHANGED
@@ -1,46 +1,68 @@
|
|
1
|
+
require 'rspec/support/spec'
|
1
2
|
require 'rspec/core'
|
2
3
|
|
3
|
-
class
|
4
|
-
|
5
|
-
def method_missing(method, *args, &block)
|
6
|
-
# ignore
|
7
|
-
end
|
4
|
+
class << RSpec
|
5
|
+
attr_writer :configuration, :world
|
8
6
|
end
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
load 'rspec-steps/duckpunch/example-group.rb'
|
19
|
-
|
20
|
-
object = Object.new
|
21
|
-
object.extend(RSpec::Core::SharedExampleGroup)
|
22
|
-
object.extend(RSpec::Steps::DSL)
|
23
|
-
object.extend(RSpec::Core::DSL)
|
24
|
-
|
25
|
-
(class << RSpec::Core::ExampleGroup; self; end).class_eval do
|
26
|
-
alias_method :orig_run, :run
|
27
|
-
def run(reporter=nil)
|
28
|
-
@orig_mock_space = RSpec::Mocks::space
|
29
|
-
RSpec::Mocks::space = RSpec::Mocks::Space.new
|
30
|
-
orig_run(reporter || NullObject.new)
|
31
|
-
ensure
|
32
|
-
RSpec::Mocks::space = @orig_mock_space
|
8
|
+
$rspec_core_without_stderr_monkey_patch = RSpec::Core::Configuration.new
|
9
|
+
|
10
|
+
class RSpec::Core::Configuration
|
11
|
+
def self.new(*args, &block)
|
12
|
+
super.tap do |config|
|
13
|
+
# We detect ruby warnings via $stderr,
|
14
|
+
# so direct our deprecations to $stdout instead.
|
15
|
+
config.deprecation_stream = $stdout
|
33
16
|
end
|
34
17
|
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Sandboxing
|
21
|
+
def sandboxed(&block)
|
22
|
+
@orig_config = RSpec.configuration
|
23
|
+
@orig_world = RSpec.world
|
24
|
+
@orig_example = RSpec.current_example
|
25
|
+
new_config = RSpec::Core::Configuration.new
|
26
|
+
new_config.expose_dsl_globally = false
|
27
|
+
new_config.expecting_with_rspec = true
|
28
|
+
new_config.include(RSpecStepwise, :stepwise => true)
|
29
|
+
new_world = RSpec::Core::World.new(new_config)
|
30
|
+
RSpec.configuration = new_config
|
31
|
+
RSpec.world = new_world
|
32
|
+
object = Object.new
|
33
|
+
object.extend(RSpec::Core::SharedExampleGroup)
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
(class << RSpec::Core::ExampleGroup; self; end).class_exec do
|
36
|
+
alias_method :orig_run, :run
|
37
|
+
def run(reporter=nil)
|
38
|
+
RSpec.current_example = nil
|
39
|
+
orig_run(reporter || NullObject.new)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
RSpec::Mocks.with_temporary_scope do
|
44
|
+
object.instance_exec(&block)
|
45
|
+
end
|
46
|
+
ensure
|
47
|
+
(class << RSpec::Core::ExampleGroup; self; end).class_exec do
|
48
|
+
remove_method :run
|
49
|
+
alias_method :run, :orig_run
|
50
|
+
remove_method :orig_run
|
51
|
+
end
|
52
|
+
|
53
|
+
RSpec.configuration = @orig_config
|
54
|
+
RSpec.world = @orig_world
|
55
|
+
RSpec.current_example = @orig_example
|
42
56
|
end
|
57
|
+
end
|
58
|
+
|
59
|
+
RSpec.configure do |config|
|
60
|
+
config.include Sandboxing
|
61
|
+
end
|
43
62
|
|
44
|
-
|
45
|
-
|
63
|
+
class NullObject
|
64
|
+
private
|
65
|
+
def method_missing(method, *args, &block)
|
66
|
+
# ignore
|
67
|
+
end
|
46
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-steps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Judson Lester
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: corundum
|
@@ -17,34 +17,48 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.0
|
20
|
+
version: 0.4.0
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.0
|
27
|
+
version: 0.4.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: metric_fu
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 4.11.1
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 4.11.1
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: rspec
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
31
45
|
requirements:
|
32
46
|
- - '>='
|
33
47
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
48
|
+
version: '3.0'
|
35
49
|
- - <
|
36
50
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
51
|
+
version: '3.99'
|
38
52
|
type: :runtime
|
39
53
|
prerelease: false
|
40
54
|
version_requirements: !ruby/object:Gem::Requirement
|
41
55
|
requirements:
|
42
56
|
- - '>='
|
43
57
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
58
|
+
version: '3.0'
|
45
59
|
- - <
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '3.99'
|
48
62
|
description: |2
|
49
63
|
I don't like Cucumber. I don't need plain text stories. My clients either
|
50
64
|
read code or don't read any test documents, so Cucumber is mostly useless to me.
|
@@ -315,7 +329,7 @@ rdoc_options:
|
|
315
329
|
- --main
|
316
330
|
- doc/README
|
317
331
|
- --title
|
318
|
-
- rspec-steps-0.
|
332
|
+
- rspec-steps-1.0.0 RDoc
|
319
333
|
require_paths:
|
320
334
|
- lib/
|
321
335
|
required_ruby_version: !ruby/object:Gem::Requirement
|