test_unit-given 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -3
- data/lib/test/unit/given/simple.rb +2 -2
- data/lib/test/unit/given/version.rb +1 -1
- data/test/test_simple_given.rb +1 -1
- metadata +54 -71
data/README.rdoc
CHANGED
@@ -166,14 +166,14 @@ Mocks create an interesting issue, because the "assertions" are the mock expecta
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
This is somewhat confusing. We could solve it using two blocks provided by this library, +
|
169
|
+
This is somewhat confusing. We could solve it using two blocks provided by this library, +the_test_runs+, and +mocks_shouldve_been_called+, like so:
|
170
170
|
|
171
171
|
class CircleTest < Test::Unit::Given::TestCase
|
172
172
|
test_that "our external diameter service is being used" do
|
173
173
|
Given {
|
174
174
|
@diameter_service = mock()
|
175
175
|
}
|
176
|
-
When
|
176
|
+
When the_test_runs
|
177
177
|
Then {
|
178
178
|
@diameter_service.expects(:get_diameter).with(10).returns(400)
|
179
179
|
}
|
@@ -187,7 +187,7 @@ This is somewhat confusing. We could solve it using two blocks provided by this
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
-
Although both <tt>
|
190
|
+
Although both <tt>the_test_runs</tt> and <tt>mocks_shouldve_been_called</tt> are no-ops,
|
191
191
|
they allow our tests to be readable and make clear what the assertions are that we are making.
|
192
192
|
|
193
193
|
Yes, this makes our test a bit longer, but it's *much* more clear.
|
@@ -136,7 +136,7 @@ module Test
|
|
136
136
|
# Given {
|
137
137
|
# @google = mock()
|
138
138
|
# }
|
139
|
-
# When
|
139
|
+
# When the_test_runs
|
140
140
|
# Then {
|
141
141
|
# @google.expects(:search).with('foo').returns('bar')
|
142
142
|
# }
|
@@ -150,7 +150,7 @@ module Test
|
|
150
150
|
# assert_equal 'Found bar',@result
|
151
151
|
# }
|
152
152
|
# And mocks_shouldve_been_called
|
153
|
-
def
|
153
|
+
def the_test_runs
|
154
154
|
lambda {}
|
155
155
|
end
|
156
156
|
|
data/test/test_simple_given.rb
CHANGED
metadata
CHANGED
@@ -1,68 +1,57 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_unit-given
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 1
|
9
|
-
version: 0.9.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- David Copeland
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-21 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rdoc
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
16
|
+
requirement: &70228336766580 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
30
22
|
type: :development
|
31
|
-
version_requirements: *id001
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: rake
|
34
23
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
24
|
+
version_requirements: *70228336766580
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &70228336766140 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
42
33
|
type: :development
|
43
|
-
version_requirements: *id002
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: simplecov
|
46
34
|
prerelease: false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
35
|
+
version_requirements: *70228336766140
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: simplecov
|
38
|
+
requirement: &70228336765720 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
54
44
|
type: :development
|
55
|
-
|
56
|
-
|
57
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70228336765720
|
47
|
+
description: We don't need no stinkin' RSpec! Get all the fluency you want in your
|
48
|
+
Test::Unit tests, with no magic required, using straight Ruby syntax
|
49
|
+
email:
|
58
50
|
- davetron5000@gmail.com
|
59
51
|
executables: []
|
60
|
-
|
61
52
|
extensions: []
|
62
|
-
|
63
53
|
extra_rdoc_files: []
|
64
|
-
|
65
|
-
files:
|
54
|
+
files:
|
66
55
|
- .gitignore
|
67
56
|
- .rvmrc
|
68
57
|
- Gemfile
|
@@ -79,37 +68,31 @@ files:
|
|
79
68
|
- test/test_simple_given.rb
|
80
69
|
- test/test_test_that.rb
|
81
70
|
- test_unit-given.gemspec
|
82
|
-
|
83
|
-
homepage: ""
|
71
|
+
homepage: ''
|
84
72
|
licenses: []
|
85
|
-
|
86
73
|
post_install_message:
|
87
74
|
rdoc_options: []
|
88
|
-
|
89
|
-
require_paths:
|
75
|
+
require_paths:
|
90
76
|
- lib
|
91
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
|
103
|
-
- 0
|
104
|
-
version: "0"
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
105
89
|
requirements: []
|
106
|
-
|
107
90
|
rubyforge_project: test_unit-given
|
108
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.8.10
|
109
92
|
signing_key:
|
110
93
|
specification_version: 3
|
111
94
|
summary: Use Given/When/Then in your Test::Unit tests
|
112
|
-
test_files:
|
95
|
+
test_files:
|
113
96
|
- test/bootstrap.rb
|
114
97
|
- test/test_circle.rb
|
115
98
|
- test/test_simple_given.rb
|