shoulda-callback-matchers 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Appraisals +3 -13
- data/Gemfile.lock +80 -84
- data/README.md +10 -4
- data/lib/shoulda/callback/matchers/active_model.rb +1 -1
- data/lib/shoulda/callback/matchers/version.rb +1 -1
- data/shoulda-callback-matchers.gemspec +1 -1
- data/spec/shoulda/active_model/callback_matcher_spec.rb +0 -4
- metadata +7 -7
- data/.rvmrc +0 -1
- data/shoulda-callback-matchers-0.1.0.gem +0 -0
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
should-callback-matchers
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3
|
data/Appraisals
CHANGED
@@ -1,15 +1,5 @@
|
|
1
|
-
appraise '
|
2
|
-
gem 'rails', '~>
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise '3.1' do
|
6
|
-
gem 'rails', '~>3.1.0'
|
1
|
+
appraise '4.0' do
|
2
|
+
gem 'rails', '~>4.0.0'
|
7
3
|
gem 'jquery-rails'
|
8
4
|
gem 'sass-rails'
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise '3.2' do
|
12
|
-
gem 'rails', '~>3.2.0'
|
13
|
-
gem 'jquery-rails'
|
14
|
-
gem 'sass-rails'
|
15
|
-
end
|
5
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,124 +1,120 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shoulda-callback-matchers (0.
|
5
|
-
activesupport (>=
|
4
|
+
shoulda-callback-matchers (0.2.0)
|
5
|
+
activesupport (>= 4.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionmailer (
|
11
|
-
actionpack (=
|
12
|
-
mail (~> 2.
|
13
|
-
actionpack (
|
14
|
-
|
15
|
-
|
16
|
-
builder (~> 3.0.0)
|
10
|
+
actionmailer (4.0.0)
|
11
|
+
actionpack (= 4.0.0)
|
12
|
+
mail (~> 2.5.3)
|
13
|
+
actionpack (4.0.0)
|
14
|
+
activesupport (= 4.0.0)
|
15
|
+
builder (~> 3.1.0)
|
17
16
|
erubis (~> 2.7.0)
|
18
|
-
|
19
|
-
rack (~>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
multi_json (~> 1.0)
|
37
|
-
appraisal (0.5.1)
|
17
|
+
rack (~> 1.5.2)
|
18
|
+
rack-test (~> 0.6.2)
|
19
|
+
activemodel (4.0.0)
|
20
|
+
activesupport (= 4.0.0)
|
21
|
+
builder (~> 3.1.0)
|
22
|
+
activerecord (4.0.0)
|
23
|
+
activemodel (= 4.0.0)
|
24
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
25
|
+
activesupport (= 4.0.0)
|
26
|
+
arel (~> 4.0.0)
|
27
|
+
activerecord-deprecated_finders (1.0.3)
|
28
|
+
activesupport (4.0.0)
|
29
|
+
i18n (~> 0.6, >= 0.6.4)
|
30
|
+
minitest (~> 4.2)
|
31
|
+
multi_json (~> 1.3)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
tzinfo (~> 0.3.37)
|
34
|
+
appraisal (0.5.2)
|
38
35
|
bundler
|
39
36
|
rake
|
40
|
-
arel (
|
41
|
-
aruba (0.5.
|
42
|
-
childprocess (
|
37
|
+
arel (4.0.0)
|
38
|
+
aruba (0.5.3)
|
39
|
+
childprocess (>= 0.3.6)
|
43
40
|
cucumber (>= 1.1.1)
|
44
41
|
rspec-expectations (>= 2.7.0)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
atomic (1.1.10)
|
43
|
+
bourne (1.3.2)
|
44
|
+
mocha (= 0.13.2)
|
45
|
+
builder (3.1.4)
|
46
|
+
childprocess (0.3.9)
|
47
|
+
ffi (~> 1.0, >= 1.0.11)
|
48
|
+
cucumber (1.3.4)
|
51
49
|
builder (>= 2.1.2)
|
52
50
|
diff-lcs (>= 1.1.3)
|
53
|
-
gherkin (~> 2.
|
54
|
-
|
51
|
+
gherkin (~> 2.12.0)
|
52
|
+
multi_json (~> 1.7.5)
|
53
|
+
multi_test (~> 0.0.1)
|
55
54
|
diff-lcs (1.1.3)
|
56
55
|
erubis (2.7.0)
|
57
|
-
ffi (1.
|
58
|
-
gherkin (2.
|
59
|
-
|
60
|
-
hike (1.2.
|
61
|
-
i18n (0.6.
|
62
|
-
|
63
|
-
json (1.7.5)
|
64
|
-
mail (2.4.4)
|
65
|
-
i18n (>= 0.4.0)
|
56
|
+
ffi (1.9.0)
|
57
|
+
gherkin (2.12.0)
|
58
|
+
multi_json (~> 1.3)
|
59
|
+
hike (1.2.3)
|
60
|
+
i18n (0.6.4)
|
61
|
+
mail (2.5.4)
|
66
62
|
mime-types (~> 1.16)
|
67
63
|
treetop (~> 1.4.8)
|
68
64
|
metaclass (0.0.1)
|
69
|
-
mime-types (1.
|
70
|
-
|
65
|
+
mime-types (1.23)
|
66
|
+
minitest (4.7.5)
|
67
|
+
mocha (0.13.2)
|
71
68
|
metaclass (~> 0.0.1)
|
72
|
-
multi_json (1.
|
69
|
+
multi_json (1.7.7)
|
70
|
+
multi_test (0.0.1)
|
73
71
|
polyglot (0.3.3)
|
74
|
-
rack (1.
|
75
|
-
rack-cache (1.2)
|
76
|
-
rack (>= 0.4)
|
77
|
-
rack-ssl (1.3.2)
|
78
|
-
rack
|
72
|
+
rack (1.5.2)
|
79
73
|
rack-test (0.6.2)
|
80
74
|
rack (>= 1.0)
|
81
|
-
rails (
|
82
|
-
actionmailer (=
|
83
|
-
actionpack (=
|
84
|
-
activerecord (=
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
railties (
|
90
|
-
actionpack (=
|
91
|
-
activesupport (=
|
92
|
-
rack-ssl (~> 1.3.2)
|
75
|
+
rails (4.0.0)
|
76
|
+
actionmailer (= 4.0.0)
|
77
|
+
actionpack (= 4.0.0)
|
78
|
+
activerecord (= 4.0.0)
|
79
|
+
activesupport (= 4.0.0)
|
80
|
+
bundler (>= 1.3.0, < 2.0)
|
81
|
+
railties (= 4.0.0)
|
82
|
+
sprockets-rails (~> 2.0.0)
|
83
|
+
railties (4.0.0)
|
84
|
+
actionpack (= 4.0.0)
|
85
|
+
activesupport (= 4.0.0)
|
93
86
|
rake (>= 0.8.7)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
json (~> 1.4)
|
99
|
-
rspec-core (2.12.1)
|
100
|
-
rspec-expectations (2.12.0)
|
87
|
+
thor (>= 0.18.1, < 2.0)
|
88
|
+
rake (10.0.4)
|
89
|
+
rspec-core (2.12.2)
|
90
|
+
rspec-expectations (2.12.1)
|
101
91
|
diff-lcs (~> 1.1.3)
|
102
|
-
rspec-mocks (2.12.
|
103
|
-
rspec-rails (2.12.
|
92
|
+
rspec-mocks (2.12.2)
|
93
|
+
rspec-rails (2.12.2)
|
104
94
|
actionpack (>= 3.0)
|
105
95
|
activesupport (>= 3.0)
|
106
96
|
railties (>= 3.0)
|
107
97
|
rspec-core (~> 2.12.0)
|
108
98
|
rspec-expectations (~> 2.12.0)
|
109
99
|
rspec-mocks (~> 2.12.0)
|
110
|
-
sprockets (2.
|
100
|
+
sprockets (2.10.0)
|
111
101
|
hike (~> 1.2)
|
112
102
|
multi_json (~> 1.0)
|
113
103
|
rack (~> 1.0)
|
114
104
|
tilt (~> 1.1, != 1.3.0)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
105
|
+
sprockets-rails (2.0.0)
|
106
|
+
actionpack (>= 3.0)
|
107
|
+
activesupport (>= 3.0)
|
108
|
+
sprockets (~> 2.8)
|
109
|
+
sqlite3 (1.3.7)
|
110
|
+
thor (0.18.1)
|
111
|
+
thread_safe (0.1.0)
|
112
|
+
atomic
|
113
|
+
tilt (1.4.1)
|
114
|
+
treetop (1.4.14)
|
119
115
|
polyglot
|
120
116
|
polyglot (>= 0.3.1)
|
121
|
-
tzinfo (0.3.
|
117
|
+
tzinfo (0.3.37)
|
122
118
|
|
123
119
|
PLATFORMS
|
124
120
|
ruby
|
data/README.md
CHANGED
@@ -15,14 +15,20 @@ Matchers to test before, after and around hooks:
|
|
15
15
|
|
16
16
|
Be aware that this tests for the method call and not the method itself. It makes testing via triggering the callback events (validation, save) unnecessary, but you should still test the called procedure seperately.
|
17
17
|
|
18
|
-
In Rails
|
18
|
+
In Rails 4 and Bundler, add the following to your Gemfile:
|
19
19
|
|
20
20
|
group :test do
|
21
|
-
gem "shoulda-callback-matchers"
|
21
|
+
gem "shoulda-callback-matchers", ">=0.3.0"
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
In Rails 3 and Bundler, add version 0.0.2 to your Gemfile:
|
25
|
+
|
26
|
+
group :test do
|
27
|
+
gem "shoulda-callback-matchers", "=0.2.0"
|
28
|
+
end
|
29
|
+
|
30
|
+
rspec-rails needs to be in the development group so that Rails generators work.
|
31
|
+
|
26
32
|
group :development, :test do
|
27
33
|
gem "rspec-rails"
|
28
34
|
end
|
@@ -89,7 +89,7 @@ module Shoulda # :nodoc:
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def matches_optional_lifecycle?(callback)
|
92
|
-
!@optional_lifecycle || callback.options[:if].include?("
|
92
|
+
!@optional_lifecycle || callback.options[:if].include?("[:#{@optional_lifecycle}].include? self.validation_context")
|
93
93
|
end
|
94
94
|
|
95
95
|
def condition_phrase
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency('activesupport', '>=
|
19
|
+
s.add_dependency('activesupport', '>= 4.0.0')
|
20
20
|
|
21
21
|
s.add_development_dependency('appraisal', '~> 0.5.0')
|
22
22
|
s.add_development_dependency('aruba')
|
@@ -6,7 +6,6 @@ describe Shoulda::Callback::Matchers::ActiveModel do
|
|
6
6
|
before do
|
7
7
|
@model = define_model(:example, :attr => :string,
|
8
8
|
:other => :integer) do
|
9
|
-
attr_accessible :attr, :other
|
10
9
|
before_create :dance!, :if => :evaluates_to_false!
|
11
10
|
after_save :shake!, :unless => :evaluates_to_true!
|
12
11
|
end.new
|
@@ -30,7 +29,6 @@ describe Shoulda::Callback::Matchers::ActiveModel do
|
|
30
29
|
before do
|
31
30
|
@model = define_model(:example, :attr => :string,
|
32
31
|
:other => :integer) do
|
33
|
-
attr_accessible :attr, :other
|
34
32
|
send(:"before_#{lifecycle}", :dance!, :if => :evaluates_to_false!)
|
35
33
|
send(:"after_#{lifecycle}", :shake!, :unless => :evaluates_to_true!)
|
36
34
|
send(:"around_#{lifecycle}", :giggle!)
|
@@ -79,7 +77,6 @@ describe Shoulda::Callback::Matchers::ActiveModel do
|
|
79
77
|
before do
|
80
78
|
@model = define_model(:example, :attr => :string,
|
81
79
|
:other => :integer) do
|
82
|
-
attr_accessible :attr, :other
|
83
80
|
before_validation :dance!, :if => :evaluates_to_false!
|
84
81
|
after_validation :shake!, :unless => :evaluates_to_true!
|
85
82
|
before_validation :dress!, :on => :create
|
@@ -171,7 +168,6 @@ describe Shoulda::Callback::Matchers::ActiveModel do
|
|
171
168
|
before do
|
172
169
|
@model = define_model(:example, :attr => :string,
|
173
170
|
:other => :integer) do
|
174
|
-
attr_accessible :attr, :other
|
175
171
|
send(:"after_#{lifecycle}", :dance!, :if => :evaluates_to_false!)
|
176
172
|
send(:"after_#{lifecycle}", :shake!, :unless => :evaluates_to_true!)
|
177
173
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda-callback-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: appraisal
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,8 @@ extensions: []
|
|
146
146
|
extra_rdoc_files: []
|
147
147
|
files:
|
148
148
|
- .gitignore
|
149
|
-
- .
|
149
|
+
- .ruby-gemset
|
150
|
+
- .ruby-version
|
150
151
|
- .travis.yml
|
151
152
|
- Appraisals
|
152
153
|
- CONTRIBUTING.md
|
@@ -168,7 +169,6 @@ files:
|
|
168
169
|
- lib/shoulda/callback/matchers/integrations/rspec.rb
|
169
170
|
- lib/shoulda/callback/matchers/integrations/test_unit.rb
|
170
171
|
- lib/shoulda/callback/matchers/version.rb
|
171
|
-
- shoulda-callback-matchers-0.1.0.gem
|
172
172
|
- shoulda-callback-matchers.gemspec
|
173
173
|
- spec/fixtures/users.yml
|
174
174
|
- spec/shoulda/active_model/callback_matcher_spec.rb
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
|
-
rubygems_version: 1.8.
|
199
|
+
rubygems_version: 1.8.25
|
200
200
|
signing_key:
|
201
201
|
specification_version: 3
|
202
202
|
summary: Making callback tests easy on the fingers and eyes
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.3@shoulda-callback-matchers
|
Binary file
|