shared_should 0.8.3 → 0.9.0
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.
- data/.gitignore +43 -0
- data/.rvmrc +1 -0
- data/Gemfile +1 -11
- data/Gemfile.lock +19 -12
- data/README.md +193 -171
- data/Rakefile +10 -42
- data/lib/shared_should/test_unit_hooks.rb +8 -3
- data/lib/shared_should/version.rb +3 -0
- data/shared_should.gemspec +15 -68
- metadata +53 -125
- data/VERSION +0 -1
data/.gitignore
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
18
|
+
#
|
19
|
+
# * Create a file at ~/.gitignore
|
20
|
+
# * Include files you want ignored
|
21
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
22
|
+
#
|
23
|
+
# After doing this, these files will be ignored in all your git projects,
|
24
|
+
# saving you from having to 'pollute' every project you touch with them
|
25
|
+
#
|
26
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
27
|
+
#
|
28
|
+
# For MacOS:
|
29
|
+
|
30
|
+
.DS_Store
|
31
|
+
|
32
|
+
# For TextMate
|
33
|
+
*.tmproj
|
34
|
+
tmtags
|
35
|
+
.tmtags
|
36
|
+
|
37
|
+
# For emacs:
|
38
|
+
*~
|
39
|
+
\#*
|
40
|
+
.\#*
|
41
|
+
|
42
|
+
# For vim:
|
43
|
+
*.swp
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.3-p125@shared_should
|
data/Gemfile
CHANGED
@@ -1,13 +1,3 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "shoulda", ">= 0"
|
10
|
-
gem "bundler", "~> 1.0.0"
|
11
|
-
gem "jeweler", "~> 1.5.2"
|
12
|
-
gem "rcov", ">= 0"
|
13
|
-
end
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
shared_should (0.9.0)
|
5
|
+
shoulda
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: http://rubygems.org/
|
3
9
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
activesupport (3.2.8)
|
11
|
+
i18n (~> 0.6)
|
12
|
+
multi_json (~> 1.0)
|
13
|
+
i18n (0.6.1)
|
14
|
+
multi_json (1.3.6)
|
15
|
+
shoulda (3.1.1)
|
16
|
+
shoulda-context (~> 1.0)
|
17
|
+
shoulda-matchers (~> 1.2)
|
18
|
+
shoulda-context (1.0.0)
|
19
|
+
shoulda-matchers (1.3.0)
|
20
|
+
activesupport (>= 3.0.0)
|
12
21
|
|
13
22
|
PLATFORMS
|
14
23
|
ruby
|
15
24
|
|
16
25
|
DEPENDENCIES
|
17
|
-
|
18
|
-
|
19
|
-
rcov
|
20
|
-
shoulda
|
26
|
+
shared_should!
|
27
|
+
shoulda (= 3.1.1)
|
data/README.md
CHANGED
@@ -11,103 +11,109 @@ Some quick examples to get you started using Shared Should. The domain of the ex
|
|
11
11
|
|
12
12
|
Sharing shoulds is easy.
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
### ...or DRY it with chaining
|
36
|
-
setup("with a rentable book") { @book.rentable = true }.use_should("be available for checkout")
|
37
|
-
setup("with a purchasable book") { @book.purchasable = true }.use_should("be available for checkout")
|
38
|
-
end
|
14
|
+
```ruby
|
15
|
+
context "Book" do
|
16
|
+
context "with an in-stock book" do
|
17
|
+
setup { @book = Book.new(:quantity => 1, :price => 10_00 }
|
18
|
+
|
19
|
+
### Define a shared should
|
20
|
+
share_should "be available for checkout" { assert @book.available_for_checkout? }
|
21
|
+
|
22
|
+
context "with a rentable book" do
|
23
|
+
setup { @book.rentable = true }
|
24
|
+
|
25
|
+
### Use the "be available for checkout" share_should
|
26
|
+
use_should "be available for checkout"
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with a purchasable book" do
|
30
|
+
setup { @book.purchasable = true }
|
31
|
+
|
32
|
+
### Use the "be available for checkout" share_should in this context too
|
33
|
+
use_should "be available for checkout"
|
39
34
|
end
|
35
|
+
|
36
|
+
### ...or DRY it with chaining
|
37
|
+
setup("with a rentable book") { @book.rentable = true }.use_should("be available for checkout")
|
38
|
+
setup("with a purchasable book") { @book.purchasable = true }.use_should("be available for checkout")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
```
|
40
42
|
|
41
43
|
### Shared Setup
|
42
44
|
|
43
45
|
Sharing setups is easy, too.
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
### Do some additional setup after the shared setup
|
54
|
-
setup { @book.rentable = true }
|
55
|
-
|
56
|
-
should "be available for checkout" { assert @book.available_for_checkout? }
|
57
|
-
end
|
58
|
-
|
59
|
-
context "with an in-stock purchasable book" do
|
60
|
-
### Use the shared setup again
|
61
|
-
use_setup "for an in-stock book"
|
62
|
-
|
63
|
-
setup { @book.purchasable = true }
|
64
|
-
|
65
|
-
should "be available for checkout" { assert @book.available_for_checkout? }
|
66
|
-
end
|
67
|
-
|
68
|
-
### ...or DRY it with chaining
|
69
|
-
use_setup("for an in-stock book").
|
70
|
-
setup("with a rentable book") { @book.rentable = true }.
|
71
|
-
should "be available for checkout" { assert @book.available_for_checkout? }
|
72
|
-
use_setup("for an in-stock book").
|
73
|
-
setup("with a purchasable book") { @book.purchasable = true }.
|
74
|
-
should "be available for checkout" { assert @book.available_for_checkout? }
|
75
|
-
end
|
47
|
+
```ruby
|
48
|
+
context "Book" do
|
49
|
+
### Define a shared setup
|
50
|
+
share_setup "for an in-stock book" { @book = Book.new(:quantity => 1, :price => 10_00) }
|
51
|
+
|
52
|
+
context "with an in-stock rentable book" do
|
53
|
+
### Use the shared setup here
|
54
|
+
use_setup "for an in-stock book"
|
76
55
|
|
56
|
+
### Do some additional setup after the shared setup
|
57
|
+
setup { @book.rentable = true }
|
58
|
+
|
59
|
+
should "be available for checkout" { assert @book.available_for_checkout? }
|
60
|
+
end
|
61
|
+
|
62
|
+
context "with an in-stock purchasable book" do
|
63
|
+
### Use the shared setup again
|
64
|
+
use_setup "for an in-stock book"
|
65
|
+
|
66
|
+
setup { @book.purchasable = true }
|
67
|
+
|
68
|
+
should "be available for checkout" { assert @book.available_for_checkout? }
|
69
|
+
end
|
70
|
+
|
71
|
+
### ...or DRY it with chaining
|
72
|
+
use_setup("for an in-stock book").
|
73
|
+
setup("with a rentable book") { @book.rentable = true }.
|
74
|
+
should "be available for checkout" { assert @book.available_for_checkout? }
|
75
|
+
use_setup("for an in-stock book").
|
76
|
+
setup("with a purchasable book") { @book.purchasable = true }.
|
77
|
+
should "be available for checkout" { assert @book.available_for_checkout? }
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
77
81
|
### Shared Context
|
78
82
|
|
79
83
|
Sharing whole contexts? Schmeasy!
|
80
84
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
### ...or DRY it up with chaining
|
107
|
-
setup("with a rentable book") { @book.rentable = true }.use_context("for a book available for checkout")
|
108
|
-
setup("with a purchasable book") { @book.purchasable = true }.use_context("for a book available for checkout")
|
109
|
-
end
|
85
|
+
```ruby
|
86
|
+
context "Book" do
|
87
|
+
context "with an in-stock book" do
|
88
|
+
setup { @book = Book.new(:quantity => 1, :price => 10_00) }
|
89
|
+
|
90
|
+
### Define a shared context
|
91
|
+
share_context "for a book available for checkout" do
|
92
|
+
should "be in stock" { assert @book.quantity > 0 }
|
93
|
+
should "have a non-negative price" { assert @book.price > 0 }
|
94
|
+
should "be rentable or purchasable" { assert @book.rentable || @book.purchasable }
|
95
|
+
end
|
96
|
+
|
97
|
+
context "with a rentable book" do
|
98
|
+
setup { @book.rentable = true }
|
99
|
+
|
100
|
+
### Run the shoulds inside the shared context with a rentable book
|
101
|
+
use_context "for a book available for checkout"
|
102
|
+
end
|
103
|
+
|
104
|
+
context "with a purchasable book" do
|
105
|
+
setup { @book.purchasable = true }
|
106
|
+
|
107
|
+
### Run the shoulds inside the shared context again with a purchasable book
|
108
|
+
use_context "for a book available for checkout"
|
110
109
|
end
|
110
|
+
|
111
|
+
### ...or DRY it up with chaining
|
112
|
+
setup("with a rentable book") { @book.rentable = true }.use_context("for a book available for checkout")
|
113
|
+
setup("with a purchasable book") { @book.purchasable = true }.use_context("for a book available for checkout")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
```
|
111
117
|
|
112
118
|
## More Information on Syntax and Usage
|
113
119
|
|
@@ -125,132 +131,148 @@ Shared Should provides powerful chaining capabilities.
|
|
125
131
|
|
126
132
|
Chained setups and use\_setups are applied to their parent context.
|
127
133
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
134
|
+
```ruby
|
135
|
+
context "Book" do
|
136
|
+
share_setup "for an in-stock book" do
|
137
|
+
@book = Book.new(:quantity => 1, :price => 10_00
|
138
|
+
end
|
132
139
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
140
|
+
context "with a rentable book" do
|
141
|
+
use_setup("for an in-stock book").setup { @book.rentable = true }
|
142
|
+
|
143
|
+
should "be available for checkout" { assert @book.available_for_checkout? }
|
144
|
+
end
|
145
|
+
end
|
146
|
+
```
|
139
147
|
|
140
148
|
Or chained setups and use\_setups can be chained to a <tt>should</tt>, <tt>use\_should</tt>, <tt>context</tt>, or <tt>use\_context</tt>. These setups will not be applied to the parent context.
|
141
149
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
150
|
+
```ruby
|
151
|
+
context "Book" do
|
152
|
+
share_setup "for an in-stock book" do
|
153
|
+
@book = Book.new(:quantity => 1, :price => 10_00
|
154
|
+
end
|
146
155
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
156
|
+
use_setup("for an in-stock book").
|
157
|
+
setup("for a rentable book") { @book.rentable = true }.
|
158
|
+
should("be available for checkout") { assert @book.available_for_checkout? }
|
159
|
+
end
|
160
|
+
```
|
151
161
|
|
152
162
|
### Parameterizing Shares
|
153
163
|
|
154
164
|
Shared functions can also be parameterized using block parameters. This can be done for shared setups, shared shoulds, and the setups and shoulds contained within a shared context. The value passed to the shared function is the return value of the <tt>given</tt> parameterization block. The below example parameterizes a shared setup.
|
155
165
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
```ruby
|
167
|
+
context "Book" do
|
168
|
+
share_setup "for an in-stock book" do |rentable|
|
169
|
+
@book = Book.new(:quantity => 1, :price => 10_00, :rentable => rentable, :purchasable => false)
|
170
|
+
end
|
171
|
+
|
172
|
+
context "with rentable book" do
|
173
|
+
# the return value of the block is "true" which will be passed as the block parameter "rentable"
|
174
|
+
use_setup("for an in-stock book").given { true }
|
175
|
+
|
176
|
+
should "be available for checkout" { assert @book.available_for_checkout? }
|
177
|
+
end
|
178
|
+
end
|
179
|
+
```
|
168
180
|
|
169
181
|
Here is a parameterized shared should.
|
170
182
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
use_should("be unavailable for checkout for price").given("zero") { 0 }
|
181
|
-
use_should("be unavailable for checkout for price").given("a negative price") { -1 }
|
182
|
-
end
|
183
|
+
```ruby
|
184
|
+
context "Book" do
|
185
|
+
context "with in-stock book" do
|
186
|
+
setup { @book = Book.new(:quantity => 1) }
|
187
|
+
|
188
|
+
share_should "be unavailable for checkout for price" do |price|
|
189
|
+
@book.price = price
|
190
|
+
assert_false @book.available_for_checkout?
|
183
191
|
end
|
184
192
|
|
193
|
+
use_should("be unavailable for checkout for price").given("zero") { 0 }
|
194
|
+
use_should("be unavailable for checkout for price").given("a negative price") { -1 }
|
195
|
+
end
|
196
|
+
end
|
197
|
+
```
|
198
|
+
|
185
199
|
And a parameterized shared context.
|
186
200
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
use_context("for a book available for checkout at price").given("a positive price") { 10_00 }
|
202
|
-
end
|
201
|
+
```ruby
|
202
|
+
context "Book" do
|
203
|
+
context "with in-stock book" do
|
204
|
+
setup { @book = Book.new(:quantity => 1) }
|
205
|
+
|
206
|
+
share_context "for a book available for checkout at price" do
|
207
|
+
# parameters are on the setup and shoulds, not on the context
|
208
|
+
setup { |price| @book.price = price }
|
209
|
+
|
210
|
+
# we could also access price in the should blocks, but we don't need it again
|
211
|
+
should "be in stock" { assert @book.quantity > 0 }
|
212
|
+
should "have a non-negative price" { assert @book.price > 0 }
|
213
|
+
should "be rentable or purchasable" { assert @book.rentable || @book.purchasable }
|
203
214
|
end
|
204
215
|
|
216
|
+
use_context("for a book available for checkout at price").given("a positive price") { 10_00 }
|
217
|
+
end
|
218
|
+
end
|
219
|
+
```
|
220
|
+
|
205
221
|
The shared functions also accept multiple parameters when the parameterization block returns an array.
|
206
222
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
use_should("be unavailable for checkout for quantity and price").given("a zero quantity") { [0, 10_00] }
|
218
|
-
use_should("be unavailable for checkout for quantity and price").given("a zero price") { [1, 0] }
|
219
|
-
end
|
223
|
+
```ruby
|
224
|
+
context "Book" do
|
225
|
+
context "with rentable book" do
|
226
|
+
setup { @book = Book.new(:rentable => true) }
|
227
|
+
|
228
|
+
share_should "be unavailable for checkout for quantity and price" do |quantity, price|
|
229
|
+
@book.quantity = quantity
|
230
|
+
@book.price = price
|
231
|
+
assert_false @book.available_for_checkout?
|
220
232
|
end
|
221
233
|
|
234
|
+
use_should("be unavailable for checkout for quantity and price").given("a zero quantity") { [0, 10_00] }
|
235
|
+
use_should("be unavailable for checkout for quantity and price").given("a zero price") { [1, 0] }
|
236
|
+
end
|
237
|
+
end
|
238
|
+
```
|
239
|
+
|
222
240
|
### Creating a Library of Shared Functionality
|
223
241
|
|
224
242
|
The shared functions can also be re-usable across multiple test cases.
|
225
243
|
|
226
244
|
In your test helper file:
|
227
245
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
246
|
+
```ruby
|
247
|
+
class Test::Unit::TestCase
|
248
|
+
share_setup "for an in-stock book" do |rentable, purchasable|
|
249
|
+
@book = Book.new(:quantity => 1, :price => 10_00, :rentable => rentable, :purchasable => purchasable)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
```
|
233
253
|
|
234
254
|
In your test file:
|
235
255
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
256
|
+
```ruby
|
257
|
+
class BookTest < Test::Unit::TestCase
|
258
|
+
context "with an in-stock book" do
|
259
|
+
use_setup("for an in-stock book").given { [true, true] }
|
260
|
+
|
261
|
+
should "be in stock" { assert @book.quantity > 0 }
|
262
|
+
end
|
263
|
+
end
|
264
|
+
```
|
243
265
|
|
244
266
|
|
245
267
|
# Credits
|
246
268
|
|
247
|
-
Shared Shoulda is maintained by [Michael Pearce](http://github.com/michaelgpearce) and is funded by [
|
269
|
+
Shared Shoulda is maintained by [Michael Pearce](http://github.com/michaelgpearce) and is funded by [Rafter.com](http://www.rafter.com "BookRenter.com"). Many of the ideas that have inspired Shared Should come
|
248
270
|
from practical usage by the Bookrenter software development team and conversations with Bookrenter developers [Andrew Wheeler](http://github.com/jawheeler), [Ben Somers](http://github.com/bensomers), and [Philippe Huibonhoa](http://github.com/phuibonhoa).
|
249
271
|
|
250
|
-

|
251
273
|
|
252
274
|
|
253
275
|
# Copyright
|
254
276
|
|
255
|
-
Copyright (c) 2011 Michael Pearce,
|
277
|
+
Copyright (c) 2011-2012 Michael Pearce, Rafter.com. See LICENSE.txt for further details.
|
256
278
|
|
data/Rakefile
CHANGED
@@ -1,30 +1,6 @@
|
|
1
|
-
require '
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
1
|
+
require 'bundler/gem_tasks'
|
11
2
|
|
12
|
-
require '
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "shared_should"
|
16
|
-
gem.homepage = "http://github.com/michaelgpearce/shared_should"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{Share and reuse shoulds, contexts, and setup in Shoulda.}
|
19
|
-
gem.description = %Q{Share and reuse shoulds, contexts, and setup in Shoulda.}
|
20
|
-
gem.email = "michael.pearce@bookrenter.com"
|
21
|
-
gem.authors = ["Michael Pearce"]
|
22
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
gem.add_runtime_dependency 'shoulda', '>= 0'
|
25
|
-
gem.add_development_dependency 'shoulda', '>= 0'
|
26
|
-
end
|
27
|
-
Jeweler::RubygemsDotOrgTasks.new
|
3
|
+
require 'rake'
|
28
4
|
|
29
5
|
require 'rake/testtask'
|
30
6
|
Rake::TestTask.new(:test) do |test|
|
@@ -33,21 +9,13 @@ Rake::TestTask.new(:test) do |test|
|
|
33
9
|
test.verbose = true
|
34
10
|
end
|
35
11
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
12
|
+
task 'testversions' do
|
13
|
+
ENV['SHOULDA_VERSION'] = '2.11.3'
|
14
|
+
fail unless system "bundle update"
|
15
|
+
fail unless system "rake test"
|
16
|
+
ENV['SHOULDA_VERSION'] = '3.1.1'
|
17
|
+
fail unless system "bundle update"
|
18
|
+
fail unless system "rake test"
|
41
19
|
end
|
42
20
|
|
43
|
-
task :default => :
|
44
|
-
|
45
|
-
require 'rake/rdoctask'
|
46
|
-
Rake::RDocTask.new do |rdoc|
|
47
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
-
|
49
|
-
rdoc.rdoc_dir = 'rdoc'
|
50
|
-
rdoc.title = "shared_should #{version}"
|
51
|
-
rdoc.rdoc_files.include('README*')
|
52
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
-
end
|
21
|
+
task :default => :testversions
|
@@ -40,11 +40,16 @@ if defined?(Test::Unit::TestCase.suite)
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
43
|
class Test::Unit::TestCase
|
45
44
|
extend SharedShould::SharedContext
|
46
45
|
end
|
47
46
|
|
48
|
-
|
49
|
-
|
47
|
+
if defined?(Shoulda::Context::Context)
|
48
|
+
class Shoulda::Context::Context
|
49
|
+
include SharedShould::SharedContext
|
50
|
+
end
|
51
|
+
elsif defined?(Shoulda::Context)
|
52
|
+
class Shoulda::Context
|
53
|
+
include SharedShould::SharedContext
|
54
|
+
end
|
50
55
|
end
|
data/shared_should.gemspec
CHANGED
@@ -1,75 +1,22 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
require "shared_should/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
7
|
+
s.name = "shared_should"
|
8
|
+
s.version = SharedShould::VERSION
|
9
|
+
s.authors = ["Michael Pearce"]
|
10
|
+
s.email = ["michaelgpearce@yahoo.com"]
|
11
|
+
s.homepage = "http://github.com/michaelgpearce/shared_should"
|
12
|
+
s.summary = "Share and reuse shoulds, contexts, and setup in Shoulda."
|
9
13
|
|
10
|
-
s.
|
11
|
-
s.authors = ["Michael Pearce"]
|
12
|
-
s.date = "2012-01-06"
|
13
|
-
s.description = "Share and reuse shoulds, contexts, and setup in Shoulda."
|
14
|
-
s.email = "michael.pearce@bookrenter.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.md",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"lib/shared_should.rb",
|
28
|
-
"lib/shared_should/shared_context.rb",
|
29
|
-
"lib/shared_should/shared_proxy.rb",
|
30
|
-
"lib/shared_should/test_class_helper.rb",
|
31
|
-
"lib/shared_should/test_unit_hooks.rb",
|
32
|
-
"shared_should.gemspec",
|
33
|
-
"test/helper.rb",
|
34
|
-
"test/test_shared_should.rb",
|
35
|
-
"test/test_shared_should_helper.rb"
|
36
|
-
]
|
37
|
-
s.homepage = "http://github.com/michaelgpearce/shared_should"
|
38
|
-
s.licenses = ["MIT"]
|
39
|
-
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = "1.8.10"
|
41
|
-
s.summary = "Share and reuse shoulds, contexts, and setup in Shoulda."
|
42
|
-
s.test_files = [
|
43
|
-
"test/helper.rb",
|
44
|
-
"test/test_shared_should.rb",
|
45
|
-
"test/test_shared_should_helper.rb"
|
46
|
-
]
|
14
|
+
s.rubyforge_project = "shared_should"
|
47
15
|
|
48
|
-
|
49
|
-
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.require_paths = ["lib"]
|
50
19
|
|
51
|
-
|
52
|
-
|
53
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
55
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
56
|
-
s.add_runtime_dependency(%q<shoulda>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
58
|
-
else
|
59
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
60
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
62
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
63
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
64
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
65
|
-
end
|
66
|
-
else
|
67
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
68
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
69
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
70
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
71
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
72
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
73
|
-
end
|
20
|
+
s.add_development_dependency('shoulda', ENV['SHOULDA_VERSION'] || "= 3.1.1") # Use SHOULDA_VERSION when testing different versions
|
21
|
+
s.add_dependency 'shoulda'
|
74
22
|
end
|
75
|
-
|
metadata
CHANGED
@@ -1,170 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: shared_should
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 8
|
9
|
-
- 3
|
10
|
-
version: 0.8.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Michael Pearce
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 3
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
version: "0"
|
12
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
30
15
|
name: shoulda
|
31
|
-
|
32
|
-
type: :development
|
33
|
-
requirement: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
36
17
|
none: false
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
segments:
|
42
|
-
- 1
|
43
|
-
- 0
|
44
|
-
- 0
|
45
|
-
version: 1.0.0
|
46
|
-
name: bundler
|
47
|
-
prerelease: false
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.1
|
48
22
|
type: :development
|
49
|
-
requirement: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
hash: 7
|
57
|
-
segments:
|
58
|
-
- 1
|
59
|
-
- 5
|
60
|
-
- 2
|
61
|
-
version: 1.5.2
|
62
|
-
name: jeweler
|
63
23
|
prerelease: false
|
64
|
-
|
65
|
-
requirement: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
|
-
requirements:
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
76
|
-
name: rcov
|
77
|
-
prerelease: false
|
78
|
-
type: :development
|
79
|
-
requirement: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
25
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
|
88
|
-
- 0
|
89
|
-
version: "0"
|
26
|
+
requirements:
|
27
|
+
- - '='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
90
31
|
name: shoulda
|
91
|
-
|
92
|
-
type: :runtime
|
93
|
-
requirement: *id005
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
96
33
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
|
102
|
-
- 0
|
103
|
-
version: "0"
|
104
|
-
name: shoulda
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
105
39
|
prerelease: false
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description:
|
47
|
+
email:
|
48
|
+
- michaelgpearce@yahoo.com
|
110
49
|
executables: []
|
111
|
-
|
112
50
|
extensions: []
|
113
|
-
|
114
|
-
|
115
|
-
- LICENSE.txt
|
116
|
-
- README.md
|
117
|
-
files:
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
118
53
|
- .document
|
54
|
+
- .gitignore
|
55
|
+
- .rvmrc
|
119
56
|
- Gemfile
|
120
57
|
- Gemfile.lock
|
121
58
|
- LICENSE.txt
|
122
59
|
- README.md
|
123
60
|
- Rakefile
|
124
|
-
- VERSION
|
125
61
|
- lib/shared_should.rb
|
126
62
|
- lib/shared_should/shared_context.rb
|
127
63
|
- lib/shared_should/shared_proxy.rb
|
128
64
|
- lib/shared_should/test_class_helper.rb
|
129
65
|
- lib/shared_should/test_unit_hooks.rb
|
66
|
+
- lib/shared_should/version.rb
|
130
67
|
- shared_should.gemspec
|
131
68
|
- test/helper.rb
|
132
69
|
- test/test_shared_should.rb
|
133
70
|
- test/test_shared_should_helper.rb
|
134
71
|
homepage: http://github.com/michaelgpearce/shared_should
|
135
|
-
licenses:
|
136
|
-
- MIT
|
72
|
+
licenses: []
|
137
73
|
post_install_message:
|
138
74
|
rdoc_options: []
|
139
|
-
|
140
|
-
require_paths:
|
75
|
+
require_paths:
|
141
76
|
- lib
|
142
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
78
|
none: false
|
144
|
-
requirements:
|
145
|
-
- -
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
|
148
|
-
|
149
|
-
- 0
|
150
|
-
version: "0"
|
151
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
84
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
|
157
|
-
segments:
|
158
|
-
- 0
|
159
|
-
version: "0"
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
160
89
|
requirements: []
|
161
|
-
|
162
|
-
|
163
|
-
rubygems_version: 1.8.10
|
90
|
+
rubyforge_project: shared_should
|
91
|
+
rubygems_version: 1.8.24
|
164
92
|
signing_key:
|
165
93
|
specification_version: 3
|
166
94
|
summary: Share and reuse shoulds, contexts, and setup in Shoulda.
|
167
|
-
test_files:
|
95
|
+
test_files:
|
168
96
|
- test/helper.rb
|
169
97
|
- test/test_shared_should.rb
|
170
98
|
- test/test_shared_should_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.8.3
|