minitest-rails-shoulda 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/License.txt +1 -1
- data/README.md +104 -0
- data/lib/minitest/rails/shoulda/version.rb +1 -1
- data/minitest-rails-shoulda.gemspec +1 -1
- metadata +11 -5
- data/README.rdoc +0 -74
data/License.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
(The MIT License)
|
2
2
|
|
3
|
-
Copyright (c) 2012 Robert Bousquet, Rafal Wrzochol
|
3
|
+
Copyright (c) 2012-2013 Robert Bousquet, Rafal Wrzochol
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# minitest-rails-shoulda
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
Make shoulda-matchers available for minitest-rails.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
In Rails 3 and Bundler, add the following to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
group :test do
|
13
|
+
gem "minitest-rails-shoulda"
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
Add the following to your test helper:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require "minitest/rails/shoulda"
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### ActiveRecord Matchers
|
26
|
+
|
27
|
+
Matchers to test associations:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
describe Post do
|
31
|
+
subject { Post.new }
|
32
|
+
it { must belong_to(:user) }
|
33
|
+
it { must have_many(:tags).through(:taggings) }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe User do
|
37
|
+
subject { User.new }
|
38
|
+
it { must have_many(:posts) }
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
### ActiveModel Matchers
|
43
|
+
|
44
|
+
Matchers to test validations and mass assignments:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
describe Post do
|
48
|
+
subject { Post.new }
|
49
|
+
it { must validate_uniqueness_of(:title) }
|
50
|
+
it { must validate_presence_of(:body).with_message(/wtf/) }
|
51
|
+
it { must validate_presence_of(:title) }
|
52
|
+
it { must validate_numericality_of(:user_id) }
|
53
|
+
end
|
54
|
+
|
55
|
+
describe User do
|
56
|
+
subject { User.new }
|
57
|
+
it { wont allow_value("blah").for(:email) }
|
58
|
+
it { must allow_value("a@b.com").for(:email) }
|
59
|
+
it { must ensure_inclusion_of(:age).in_range(1..100) }
|
60
|
+
it { wont allow_mass_assignment_of(:password) }
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
### ActionController Matchers
|
65
|
+
|
66
|
+
Matchers to test common patterns:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
describe PostsController, "#show" do
|
70
|
+
context "for a fictional user" do
|
71
|
+
before do
|
72
|
+
get :show, :id => 1
|
73
|
+
end
|
74
|
+
|
75
|
+
it { must assign_to(:user) }
|
76
|
+
it { must respond_with(:success) }
|
77
|
+
it { must render_template(:show) }
|
78
|
+
it { wont set_the_flash }
|
79
|
+
end
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
|
86
|
+
1. Fork it
|
87
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
88
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
89
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
90
|
+
5. Create new Pull Request
|
91
|
+
|
92
|
+
## Contributors
|
93
|
+
|
94
|
+
Many thanks go to the following who have contributed to making this library even better:
|
95
|
+
|
96
|
+
* **[@phlipper](https://github.com/phlipper)**
|
97
|
+
* **[@blowmage](https://github.com/blowmage)**
|
98
|
+
|
99
|
+
|
100
|
+
## License
|
101
|
+
|
102
|
+
**minitest-rails-shoulda**
|
103
|
+
|
104
|
+
* Freely distributable and licensed under the [MIT license](http://newleaders.mit-license.org/2012-2013/license.html).
|
@@ -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_runtime_dependency "minitest-rails", "~> 0.
|
20
|
+
s.add_runtime_dependency "minitest-rails", "~> 0.5.0"
|
21
21
|
s.add_runtime_dependency "minitest-matchers", "~> 1.2.0"
|
22
22
|
s.add_runtime_dependency "shoulda-matchers", "~> 1.4.1"
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-rails-shoulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-01-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: minitest-rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.5.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 0.
|
30
|
+
version: 0.5.0
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: minitest-matchers
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +73,7 @@ files:
|
|
73
73
|
- CHANGELOG.txt
|
74
74
|
- Gemfile
|
75
75
|
- License.txt
|
76
|
-
- README.
|
76
|
+
- README.md
|
77
77
|
- Rakefile
|
78
78
|
- lib/minitest-rails-shoulda.rb
|
79
79
|
- lib/minitest/rails/shoulda.rb
|
@@ -97,12 +97,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- - ! '>='
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
hash: 3134249334390949673
|
100
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
104
|
none: false
|
102
105
|
requirements:
|
103
106
|
- - ! '>='
|
104
107
|
- !ruby/object:Gem::Version
|
105
108
|
version: '0'
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
hash: 3134249334390949673
|
106
112
|
requirements: []
|
107
113
|
rubyforge_project: minitest-rails-shoulda
|
108
114
|
rubygems_version: 1.8.24
|
data/README.rdoc
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
= minitest-rails-shoulda
|
2
|
-
|
3
|
-
Make shoulda-matchers available for minitest-rails.
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
In Rails 3 and Bundler, add the following to your Gemfile:
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem "minitest-rails-shoulda"
|
11
|
-
end
|
12
|
-
|
13
|
-
Add the following to your test helper:
|
14
|
-
|
15
|
-
require "minitest/rails/shoulda"
|
16
|
-
|
17
|
-
== Usage
|
18
|
-
|
19
|
-
=== ActiveRecord Matchers
|
20
|
-
|
21
|
-
Matchers to test associations:
|
22
|
-
|
23
|
-
describe Post do
|
24
|
-
subject { Post.new }
|
25
|
-
it { must belong_to(:user) }
|
26
|
-
it { must have_many(:tags).through(:taggings) }
|
27
|
-
end
|
28
|
-
|
29
|
-
describe User do
|
30
|
-
subject { User.new }
|
31
|
-
it { must have_many(:posts) }
|
32
|
-
end
|
33
|
-
|
34
|
-
=== ActiveModel Matchers
|
35
|
-
|
36
|
-
Matchers to test validations and mass assignments:
|
37
|
-
|
38
|
-
describe Post do
|
39
|
-
subject { Post.new }
|
40
|
-
it { must validate_uniqueness_of(:title) }
|
41
|
-
it { must validate_presence_of(:body).with_message(/wtf/) }
|
42
|
-
it { must validate_presence_of(:title) }
|
43
|
-
it { must validate_numericality_of(:user_id) }
|
44
|
-
end
|
45
|
-
|
46
|
-
describe User do
|
47
|
-
subject { User.new }
|
48
|
-
it { wont allow_value("blah").for(:email) }
|
49
|
-
it { must allow_value("a@b.com").for(:email) }
|
50
|
-
it { must ensure_inclusion_of(:age).in_range(1..100) }
|
51
|
-
it { wont allow_mass_assignment_of(:password) }
|
52
|
-
end
|
53
|
-
|
54
|
-
=== ActionController Matchers
|
55
|
-
|
56
|
-
Matchers to test common patterns:
|
57
|
-
|
58
|
-
describe PostsController, "#show" do
|
59
|
-
context "for a fictional user" do
|
60
|
-
before do
|
61
|
-
get :show, :id => 1
|
62
|
-
end
|
63
|
-
|
64
|
-
it { must assign_to(:user) }
|
65
|
-
it { must respond_with(:success) }
|
66
|
-
it { must render_template(:show) }
|
67
|
-
it { wont set_the_flash }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
=== Contributors
|
72
|
-
|
73
|
-
* Phil Cohen <github@phlippers.net>
|
74
|
-
* Mike Moore <mike@blowmage.com>
|