rspec-given 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +2 -10
- data/Gemfile.lock +12 -64
- data/MIT-LICENSE +1 -2
- data/README.md +16 -3
- data/Rakefile +17 -11
- data/doc/main.rdoc +7 -0
- data/examples/stack/stack_spec.rb +17 -18
- data/lib/rspec/given/evaluator.rb +39 -0
- data/lib/rspec/given/natural_assertion.rb +20 -42
- data/lib/rspec/given/version.rb +1 -1
- data/spec/lib/rspec/given/evaluator_spec.rb +31 -0
- data/spec/lib/rspec/given/ext/numeric_spec.rb +22 -0
- data/spec/lib/rspec/given/ext/numeric_specifications.rb +22 -0
- data/spec/lib/rspec/given/extensions_spec.rb +204 -0
- data/spec/lib/rspec/given/failure_spec.rb +17 -0
- data/spec/lib/rspec/given/file_cache_spec.rb +28 -0
- data/spec/lib/rspec/given/fuzzy_number_spec.rb +111 -0
- data/spec/lib/rspec/given/have_failed_spec.rb +70 -0
- data/spec/lib/rspec/given/lexical_purity_spec.rb +19 -0
- data/spec/lib/rspec/given/line_extractor_spec.rb +86 -0
- data/spec/lib/rspec/given/module_methods_spec.rb +13 -0
- data/spec/lib/rspec/given/natural_assertion_spec.rb +178 -0
- data/spec/lib/rspec/given/options_spec.rb +139 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/faux_then.rb +53 -0
- data/spec/support/natural_assertion_control.rb +15 -0
- metadata +36 -73
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# The Faux module defines a FauxThen method that is used to setup an
|
4
|
+
# environment identical to the real Then blocks. This makes it easy to
|
5
|
+
# create realistic NaturalAssertion and Evaluator objects that can be
|
6
|
+
# used for making assertions.
|
7
|
+
#
|
8
|
+
# Typical Usage:
|
9
|
+
#
|
10
|
+
# context "with something" do
|
11
|
+
# Given(:a) { 1 }
|
12
|
+
# FauxThen { a + 2 }
|
13
|
+
# Then { result_block == 3 }
|
14
|
+
# Then { na.evaluate("a") == 1 }
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# The FauxThen sets up two special values:
|
18
|
+
#
|
19
|
+
# * block_result -- is the result of evaluating the FauxThen block
|
20
|
+
# * na -- is a the natural assertion object whose context is the
|
21
|
+
# FauxThen block.
|
22
|
+
#
|
23
|
+
module Faux
|
24
|
+
module CX
|
25
|
+
def FauxThen(&block)
|
26
|
+
@block = block
|
27
|
+
end
|
28
|
+
def the_block
|
29
|
+
@block
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module IX
|
34
|
+
def block_result
|
35
|
+
instance_eval(&self.class.the_block)
|
36
|
+
end
|
37
|
+
|
38
|
+
def na
|
39
|
+
block = self.class.the_block
|
40
|
+
RSpec::Given::NaturalAssertion.new("FauxThen", block, self, self.class._rgc_lines)
|
41
|
+
end
|
42
|
+
|
43
|
+
def ev
|
44
|
+
RSpec::Given::Evaluator.new(self, self.class.the_block)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Extend RSpec with our Faux Then blocks
|
50
|
+
RSpec.configure do |c|
|
51
|
+
c.extend(Faux::CX)
|
52
|
+
c.include(Faux::IX)
|
53
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module NaturalAssertionControl
|
2
|
+
def use_natural_assertions_if_supported(enabled=true)
|
3
|
+
if enabled && ! RSpec::Given::NATURAL_ASSERTIONS_SUPPORTED
|
4
|
+
Given {
|
5
|
+
pending "Natural assertions are not supported in JRuby"
|
6
|
+
}
|
7
|
+
else
|
8
|
+
use_natural_assertions(enabled)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.configure do |c|
|
14
|
+
c.extend(NaturalAssertionControl)
|
15
|
+
end
|
metadata
CHANGED
@@ -1,101 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-given
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
5
|
-
prerelease:
|
4
|
+
version: 2.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jim Weirich
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2.
|
19
|
+
version: '2.12'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
26
|
+
version: '2.12'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: sorcerer
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.3.7
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.3.7
|
46
|
-
|
47
|
-
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rdoc
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>'
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 2.4.2
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>'
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 2.4.2
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: ghpreview
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 0.0.1
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 0.0.1
|
94
|
-
description: ! 'Given is an RSpec extension that allows explicit definition of the
|
95
|
-
|
41
|
+
description: |
|
42
|
+
Given is an RSpec extension that allows explicit definition of the
|
96
43
|
pre and post-conditions for code under test.
|
97
|
-
|
98
|
-
'
|
99
44
|
email: jim.weirich@gmail.com
|
100
45
|
executables: []
|
101
46
|
extensions: []
|
@@ -110,6 +55,7 @@ files:
|
|
110
55
|
- lib/rspec/given.rb
|
111
56
|
- lib/rspec/given/configure.rb
|
112
57
|
- lib/rspec/given/core.rb
|
58
|
+
- lib/rspec/given/evaluator.rb
|
113
59
|
- lib/rspec/given/ext/numeric.rb
|
114
60
|
- lib/rspec/given/extensions.rb
|
115
61
|
- lib/rspec/given/failure.rb
|
@@ -123,6 +69,22 @@ files:
|
|
123
69
|
- lib/rspec/given/natural_assertion.rb
|
124
70
|
- lib/rspec/given/rspec1_given.rb
|
125
71
|
- lib/rspec/given/version.rb
|
72
|
+
- spec/lib/rspec/given/evaluator_spec.rb
|
73
|
+
- spec/lib/rspec/given/ext/numeric_spec.rb
|
74
|
+
- spec/lib/rspec/given/ext/numeric_specifications.rb
|
75
|
+
- spec/lib/rspec/given/extensions_spec.rb
|
76
|
+
- spec/lib/rspec/given/failure_spec.rb
|
77
|
+
- spec/lib/rspec/given/file_cache_spec.rb
|
78
|
+
- spec/lib/rspec/given/fuzzy_number_spec.rb
|
79
|
+
- spec/lib/rspec/given/have_failed_spec.rb
|
80
|
+
- spec/lib/rspec/given/lexical_purity_spec.rb
|
81
|
+
- spec/lib/rspec/given/line_extractor_spec.rb
|
82
|
+
- spec/lib/rspec/given/module_methods_spec.rb
|
83
|
+
- spec/lib/rspec/given/natural_assertion_spec.rb
|
84
|
+
- spec/lib/rspec/given/options_spec.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
- spec/support/faux_then.rb
|
87
|
+
- spec/support/natural_assertion_control.rb
|
126
88
|
- examples/example_helper.rb
|
127
89
|
- examples/failing/natural_failing_spec.rb
|
128
90
|
- examples/failing/sample_spec.rb
|
@@ -140,34 +102,35 @@ files:
|
|
140
102
|
- examples/stack/stack.rb
|
141
103
|
- examples/stack/stack_spec.rb
|
142
104
|
- examples/stack/stack_spec1.rb
|
105
|
+
- doc/main.rdoc
|
143
106
|
homepage: http://github.com/jimweirich/rspec-given
|
144
|
-
licenses:
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
145
110
|
post_install_message:
|
146
111
|
rdoc_options:
|
147
112
|
- --line-numbers
|
148
113
|
- --inline-source
|
149
114
|
- --main
|
150
|
-
-
|
115
|
+
- doc/main.rdoc
|
151
116
|
- --title
|
152
117
|
- RSpec Given Extensions
|
153
118
|
require_paths:
|
154
119
|
- lib
|
155
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
-
none: false
|
157
121
|
requirements:
|
158
|
-
- -
|
122
|
+
- - '>='
|
159
123
|
- !ruby/object:Gem::Version
|
160
124
|
version: 1.9.2
|
161
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
126
|
requirements:
|
164
|
-
- -
|
127
|
+
- - '>='
|
165
128
|
- !ruby/object:Gem::Version
|
166
129
|
version: '0'
|
167
130
|
requirements: []
|
168
131
|
rubyforge_project: given
|
169
|
-
rubygems_version:
|
132
|
+
rubygems_version: 2.0.3
|
170
133
|
signing_key:
|
171
|
-
specification_version:
|
134
|
+
specification_version: 4
|
172
135
|
summary: Given/When/Then Specification Extensions for RSpec.
|
173
136
|
test_files: []
|