rspec-given 2.0.0.beta.1 → 2.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +20 -0
- data/README.md +3 -8
- data/Rakefile +54 -47
- data/examples/integration/given_spec.rb +12 -0
- data/examples/stack/stack_spec.rb +1 -1
- data/lib/rspec/given/extensions.rb +7 -0
- data/lib/rspec/given/version.rb +1 -1
- metadata +10 -8
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
rake (0.9.2.2)
|
6
|
+
rspec (2.11.0)
|
7
|
+
rspec-core (~> 2.11.0)
|
8
|
+
rspec-expectations (~> 2.11.0)
|
9
|
+
rspec-mocks (~> 2.11.0)
|
10
|
+
rspec-core (2.11.1)
|
11
|
+
rspec-expectations (2.11.2)
|
12
|
+
diff-lcs (~> 1.1.3)
|
13
|
+
rspec-mocks (2.11.2)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
rake (>= 0.9.2.2)
|
20
|
+
rspec (>= 2.0)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# rspec-given
|
2
2
|
|
3
|
-
Covering rspec-given, version 2.0.0.beta.
|
3
|
+
Covering rspec-given, version 2.0.0.beta.2.
|
4
4
|
|
5
5
|
rspec-given is an RSpec extension to allow Given/When/Then notation in
|
6
6
|
RSpec specifications. It is a natural extension of the experimental
|
@@ -62,7 +62,7 @@ describe Stack do
|
|
62
62
|
When(:pop_result) { stack.pop }
|
63
63
|
|
64
64
|
Then { pop_result.should == :an_item }
|
65
|
-
Then { stack.should
|
65
|
+
Then { stack.depth.should == 0 }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -231,7 +231,6 @@ assertion. Code in _Then_ blocks should not have any side effects.
|
|
231
231
|
After the related _When_ block is run, the stack should be empty. If
|
232
232
|
it is not empty, the test will fail.
|
233
233
|
|
234
|
-
<!--
|
235
234
|
### Invariant
|
236
235
|
|
237
236
|
The _Invariant_ block is a new idea that doesn't have an analog in
|
@@ -250,11 +249,6 @@ that context.
|
|
250
249
|
Invariants that reference a _Given_ precondition accessor must only be
|
251
250
|
used in contexts that define that accessor.
|
252
251
|
|
253
|
-
NOTE: Invariants are not yet implemented in the current version of
|
254
|
-
rspec-given.
|
255
|
-
|
256
|
-
-->
|
257
|
-
|
258
252
|
# Future Directions
|
259
253
|
|
260
254
|
I really like the way the Given framework is working out. I feel my
|
@@ -282,3 +276,4 @@ has laid some groundwork in this area.
|
|
282
276
|
* Github: [https://github.com/jimweirich/rspec-given](https://github.com/jimweirich/rspec-given)
|
283
277
|
* Clone URL: git://github.com/jimweirich/rspec-given.git
|
284
278
|
* Bug/Issue Reporting: [https://github.com/jimweirich/rspec-given/issues](https://github.com/jimweirich/rspec-given/issues)
|
279
|
+
* Continuous Integration: [http://travis-ci.org/#!/jimweirich/rspec-given](http://travis-ci.org/#!/jimweirich/rspec-given)
|
data/Rakefile
CHANGED
@@ -138,8 +138,13 @@ end
|
|
138
138
|
|
139
139
|
|
140
140
|
# RDoc ---------------------------------------------------------------
|
141
|
-
|
142
|
-
|
141
|
+
begin
|
142
|
+
gem "rdoc"
|
143
|
+
require 'rdoc/task'
|
144
|
+
RDOC_ENABLED = true
|
145
|
+
rescue LoadError => ex
|
146
|
+
RDOC_ENABLED = false
|
147
|
+
end
|
143
148
|
|
144
149
|
begin
|
145
150
|
require 'darkfish-rdoc'
|
@@ -148,57 +153,59 @@ rescue LoadError => ex
|
|
148
153
|
DARKFISH_ENABLED = false
|
149
154
|
end
|
150
155
|
|
151
|
-
|
152
|
-
|
153
|
-
open(
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
156
|
+
if RDOC_ENABLED
|
157
|
+
def md_to_rdoc(infile, outfile)
|
158
|
+
open(infile) do |ins|
|
159
|
+
open(outfile, "w") do |outs|
|
160
|
+
state = :copy
|
161
|
+
while line = ins.gets
|
162
|
+
case state
|
163
|
+
when :ignore
|
164
|
+
if line =~ /^-->/
|
165
|
+
state = :copy
|
166
|
+
end
|
167
|
+
when :pre
|
168
|
+
if line =~ /^<\/pre>/
|
169
|
+
state = :copy
|
170
|
+
else
|
171
|
+
outs.puts " #{line}"
|
172
|
+
end
|
173
|
+
when :copy
|
174
|
+
if line =~ /^<!--/
|
175
|
+
state = :ignore
|
176
|
+
elsif line =~ /^<pre>/
|
177
|
+
state = :pre
|
178
|
+
else
|
179
|
+
line.gsub!(/^####/, '====')
|
180
|
+
line.gsub!(/^###/, '===')
|
181
|
+
line.gsub!(/^##/, '==')
|
182
|
+
line.gsub!(/^#/, '=')
|
183
|
+
outs.puts line
|
184
|
+
end
|
178
185
|
end
|
179
186
|
end
|
180
187
|
end
|
181
188
|
end
|
182
189
|
end
|
183
|
-
end
|
184
190
|
|
185
|
-
file "README" => ["README.md"] do
|
186
|
-
|
187
|
-
end
|
191
|
+
file "README" => ["README.md"] do
|
192
|
+
md_to_rdoc("README.md", "README")
|
193
|
+
end
|
188
194
|
|
189
|
-
RDoc::Task.new("rdoc") do |rdoc|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
195
|
+
RDoc::Task.new("rdoc") do |rdoc|
|
196
|
+
rdoc.rdoc_dir = 'html'
|
197
|
+
rdoc.title = "RSpec/Given -- A Given/When/Then extension for RSpec"
|
198
|
+
rdoc.options = [
|
199
|
+
'--line-numbers',
|
200
|
+
'--main' , 'README',
|
201
|
+
'--title', 'RSpec::Given - Given/When/Then Extensions for RSpec'
|
202
|
+
]
|
203
|
+
rdoc.options << '-SHN' << '-f' << 'darkfish' if DARKFISH_ENABLED
|
204
|
+
|
205
|
+
rdoc.rdoc_files.include('README')
|
206
|
+
rdoc.rdoc_files.include('MIT-LICENSE')
|
207
|
+
rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
|
208
|
+
end
|
198
209
|
|
199
|
-
rdoc
|
200
|
-
rdoc.rdoc_files.include('MIT-LICENSE')
|
201
|
-
rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
|
210
|
+
task :rdoc => "README"
|
202
211
|
end
|
203
|
-
|
204
|
-
task :rdoc => "README"
|
@@ -49,3 +49,15 @@ describe "Lazy Givens" do
|
|
49
49
|
Then { value.should == :ok }
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
describe "Non-Lazy Givens" do
|
54
|
+
Given(:info) { [] }
|
55
|
+
|
56
|
+
When { info << :when }
|
57
|
+
|
58
|
+
context "inner" do
|
59
|
+
Given!(:a) { info << :given; "A VALUE" }
|
60
|
+
Then { info.should == [:given, :when] }
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -46,6 +46,12 @@ module RSpec
|
|
46
46
|
@_rg_invariants ||= []
|
47
47
|
end
|
48
48
|
|
49
|
+
# Trigger the evaluation of a Given! block by referencing its
|
50
|
+
# name.
|
51
|
+
def _rg_trigger_given(name) # :nodoc:
|
52
|
+
Proc.new { send(name) }
|
53
|
+
end
|
54
|
+
|
49
55
|
# *DEPRECATED:*
|
50
56
|
#
|
51
57
|
# The Scenario command is deprecated. Using Scenario in a spec
|
@@ -95,6 +101,7 @@ module RSpec
|
|
95
101
|
# Given!(:name) { ... code ... }
|
96
102
|
def Given!(name, &block)
|
97
103
|
let!(name, &block)
|
104
|
+
_rg_givens << _rg_trigger_given(name)
|
98
105
|
end
|
99
106
|
|
100
107
|
# Declare the code that is under test.
|
data/lib/rspec/given/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-given
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70238859403780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>'
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.2.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70238859403780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bluecloth
|
27
|
-
requirement: &
|
27
|
+
requirement: &70238859403340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70238859403340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70238859402720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>'
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 2.4.2
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70238859402720
|
47
47
|
description: ! 'Given is an RSpec extension that allows explicit definition of the
|
48
48
|
|
49
49
|
pre and post-conditions for code under test.
|
@@ -54,6 +54,8 @@ executables: []
|
|
54
54
|
extensions: []
|
55
55
|
extra_rdoc_files: []
|
56
56
|
files:
|
57
|
+
- Gemfile
|
58
|
+
- Gemfile.lock
|
57
59
|
- MIT-LICENSE
|
58
60
|
- Rakefile
|
59
61
|
- README.md
|