shoulda 3.3.1 → 3.3.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.
- data/README.md +42 -30
- data/gemfiles/3.0.gemfile.lock +3 -3
- data/gemfiles/3.1.gemfile.lock +4 -4
- data/gemfiles/3.2.gemfile.lock +4 -4
- data/lib/shoulda/version.rb +1 -1
- data/shoulda.gemspec +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -17,39 +17,47 @@ rspec with shoulda-matchers
|
|
17
17
|
|
18
18
|
This is what thoughtbot currently does. We write tests like:
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
```ruby
|
21
|
+
describe Post do
|
22
|
+
it { should belong_to(:user) }
|
23
|
+
it { should validate_presence_of(:title) }
|
24
|
+
end
|
25
|
+
```
|
24
26
|
|
25
27
|
The belong_to and validate_presence_of methods are the matchers.
|
26
28
|
All matchers are Rails 3-specific.
|
27
29
|
|
28
30
|
Add rspec-rails and shoulda-matchers to the project's Gemfile:
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
```ruby
|
33
|
+
group :test do
|
34
|
+
gem 'rspec-rails'
|
35
|
+
gem 'shoulda-matchers'
|
36
|
+
end
|
37
|
+
```
|
34
38
|
|
35
39
|
test/unit with shoulda
|
36
40
|
----------------------
|
37
41
|
|
38
42
|
For the folks who prefer Test::Unit, they'd write tests like:
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
+
```ruby
|
45
|
+
class UserTest < Test::Unit::TestCase
|
46
|
+
should have_many(:posts)
|
47
|
+
should_not allow_value("blah").for(:email)
|
48
|
+
end
|
49
|
+
```
|
44
50
|
|
45
51
|
The have_many and allow_value methods are the same kind of matchers
|
46
52
|
seen in the RSpec example. They come from the shoulda-matchers gem.
|
47
53
|
|
48
54
|
Add shoulda to the project's Gemfile:
|
49
55
|
|
50
|
-
|
51
|
-
|
52
|
-
|
56
|
+
```ruby
|
57
|
+
group :test do
|
58
|
+
gem 'shoulda'
|
59
|
+
end
|
60
|
+
```
|
53
61
|
|
54
62
|
test/unit with shoulda-context
|
55
63
|
------------------------------
|
@@ -57,27 +65,31 @@ test/unit with shoulda-context
|
|
57
65
|
If you're not testing a Rails project or don't want to use the matchers,
|
58
66
|
you can use shoulda-context independently to write tests like:
|
59
67
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
68
|
+
```ruby
|
69
|
+
class CalculatorTest < Test::Unit::TestCase
|
70
|
+
context "a calculator" do
|
71
|
+
setup do
|
72
|
+
@calculator = Calculator.new
|
73
|
+
end
|
65
74
|
|
66
|
-
|
67
|
-
|
68
|
-
|
75
|
+
should "add two numbers for the sum" do
|
76
|
+
assert_equal 4, @calculator.sum(2, 2)
|
77
|
+
end
|
69
78
|
|
70
|
-
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
79
|
+
should "multiply two numbers for the product" do
|
80
|
+
assert_equal 10, @calculator.product(2, 5)
|
74
81
|
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
```
|
75
85
|
|
76
86
|
Add shoulda-context to the project's Gemfile:
|
77
87
|
|
78
|
-
|
79
|
-
|
80
|
-
|
88
|
+
```ruby
|
89
|
+
group :test do
|
90
|
+
gem 'shoulda-context'
|
91
|
+
end
|
92
|
+
```
|
81
93
|
|
82
94
|
Credits
|
83
95
|
-------
|
data/gemfiles/3.0.gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: /Users/draper/Dropbox/Development/shoulda
|
3
3
|
specs:
|
4
4
|
shoulda (3.3.1)
|
5
|
-
shoulda-context (~> 1.0)
|
5
|
+
shoulda-context (~> 1.0.1)
|
6
6
|
shoulda-matchers (~> 1.4.1)
|
7
7
|
|
8
8
|
GEM
|
@@ -45,7 +45,7 @@ GEM
|
|
45
45
|
ffi (>= 1.0.11)
|
46
46
|
rspec (>= 2.7.0)
|
47
47
|
builder (2.1.2)
|
48
|
-
childprocess (0.3.
|
48
|
+
childprocess (0.3.6)
|
49
49
|
ffi (~> 1.0, >= 1.0.6)
|
50
50
|
cucumber (1.1.9)
|
51
51
|
builder (>= 2.1.2)
|
@@ -103,7 +103,7 @@ GEM
|
|
103
103
|
activesupport (~> 3.0)
|
104
104
|
railties (~> 3.0)
|
105
105
|
rspec (~> 2.7.0)
|
106
|
-
shoulda-context (1.0.
|
106
|
+
shoulda-context (1.0.1)
|
107
107
|
shoulda-matchers (1.4.1)
|
108
108
|
activesupport (>= 3.0.0)
|
109
109
|
sqlite3 (1.3.6)
|
data/gemfiles/3.1.gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: /Users/draper/Dropbox/Development/shoulda
|
3
3
|
specs:
|
4
4
|
shoulda (3.3.1)
|
5
|
-
shoulda-context (~> 1.0)
|
5
|
+
shoulda-context (~> 1.0.1)
|
6
6
|
shoulda-matchers (~> 1.4.1)
|
7
7
|
|
8
8
|
GEM
|
@@ -45,8 +45,8 @@ GEM
|
|
45
45
|
cucumber (>= 1.1.1)
|
46
46
|
ffi (>= 1.0.11)
|
47
47
|
rspec (>= 2.7.0)
|
48
|
-
builder (3.0.
|
49
|
-
childprocess (0.3.
|
48
|
+
builder (3.0.4)
|
49
|
+
childprocess (0.3.6)
|
50
50
|
ffi (~> 1.0, >= 1.0.6)
|
51
51
|
cucumber (1.1.9)
|
52
52
|
builder (>= 2.1.2)
|
@@ -118,7 +118,7 @@ GEM
|
|
118
118
|
railties (~> 3.1.0)
|
119
119
|
sass (>= 3.1.10)
|
120
120
|
tilt (~> 1.3.2)
|
121
|
-
shoulda-context (1.0.
|
121
|
+
shoulda-context (1.0.1)
|
122
122
|
shoulda-matchers (1.4.1)
|
123
123
|
activesupport (>= 3.0.0)
|
124
124
|
sprockets (2.0.4)
|
data/gemfiles/3.2.gemfile.lock
CHANGED
@@ -2,7 +2,7 @@ PATH
|
|
2
2
|
remote: /Users/draper/Dropbox/Development/shoulda
|
3
3
|
specs:
|
4
4
|
shoulda (3.3.1)
|
5
|
-
shoulda-context (~> 1.0)
|
5
|
+
shoulda-context (~> 1.0.1)
|
6
6
|
shoulda-matchers (~> 1.4.1)
|
7
7
|
|
8
8
|
GEM
|
@@ -44,8 +44,8 @@ GEM
|
|
44
44
|
cucumber (>= 1.1.1)
|
45
45
|
ffi (>= 1.0.11)
|
46
46
|
rspec (>= 2.7.0)
|
47
|
-
builder (3.0.
|
48
|
-
childprocess (0.3.
|
47
|
+
builder (3.0.4)
|
48
|
+
childprocess (0.3.6)
|
49
49
|
ffi (~> 1.0, >= 1.0.6)
|
50
50
|
cucumber (1.1.9)
|
51
51
|
builder (>= 2.1.2)
|
@@ -115,7 +115,7 @@ GEM
|
|
115
115
|
railties (~> 3.2.0)
|
116
116
|
sass (>= 3.1.10)
|
117
117
|
tilt (~> 1.3)
|
118
|
-
shoulda-context (1.0.
|
118
|
+
shoulda-context (1.0.1)
|
119
119
|
shoulda-matchers (1.4.1)
|
120
120
|
activesupport (>= 3.0.0)
|
121
121
|
sprockets (2.1.3)
|
data/lib/shoulda/version.rb
CHANGED
data/shoulda.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.add_dependency("shoulda-context", "~> 1.0")
|
20
|
+
s.add_dependency("shoulda-context", "~> 1.0.1")
|
21
21
|
s.add_dependency("shoulda-matchers", "~> 1.4.1")
|
22
22
|
|
23
23
|
s.add_development_dependency('appraisal', '~> 0.4.0')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2012-10-
|
16
|
+
date: 2012-10-19 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: shoulda-context
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
requirements:
|
23
23
|
- - ~>
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
25
|
+
version: 1.0.1
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.0.1
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: shoulda-matchers
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
version: '0'
|
185
185
|
segments:
|
186
186
|
- 0
|
187
|
-
hash: -
|
187
|
+
hash: -3923337022578121273
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
none: false
|
190
190
|
requirements:
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
segments:
|
195
195
|
- 0
|
196
|
-
hash: -
|
196
|
+
hash: -3923337022578121273
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
199
|
rubygems_version: 1.8.24
|