mcmire-shoulda-matchers 2.5.0 → 2.6.1.docs.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -0
- data/.yardopts +2 -1
- data/Appraisals +62 -22
- data/Gemfile +1 -1
- data/Gemfile.lock +3 -3
- data/NEWS.md +87 -4
- data/README.md +2 -2
- data/Rakefile +18 -0
- data/features/activemodel_integration.feature +15 -0
- data/features/rails_integration.feature +1 -1
- data/features/step_definitions/activemodel_steps.rb +21 -0
- data/features/step_definitions/rails_steps.rb +5 -4
- data/gemfiles/3.0.gemfile +6 -3
- data/gemfiles/3.0.gemfile.lock +14 -4
- data/gemfiles/3.1.gemfile +10 -4
- data/gemfiles/3.1.gemfile.lock +32 -5
- data/gemfiles/3.1_1.9.2.gemfile +21 -0
- data/gemfiles/3.1_1.9.2.gemfile.lock +191 -0
- data/gemfiles/3.2.gemfile +9 -4
- data/gemfiles/3.2.gemfile.lock +28 -5
- data/gemfiles/4.0.0.gemfile +11 -3
- data/gemfiles/4.0.0.gemfile.lock +42 -5
- data/gemfiles/4.0.1.gemfile +11 -3
- data/gemfiles/4.0.1.gemfile.lock +42 -5
- data/gemfiles/4.1.gemfile +37 -0
- data/gemfiles/4.1.gemfile.lock +216 -0
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +202 -0
- data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +1 -1
- data/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb +2 -1
- data/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb +165 -0
- data/lib/shoulda/matchers/action_controller.rb +2 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +26 -4
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +6 -0
- data/lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb +2 -0
- data/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb +60 -18
- data/lib/shoulda/matchers/active_model/errors.rb +43 -1
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +14 -3
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +2 -1
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +100 -45
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +38 -5
- data/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb +27 -20
- data/lib/shoulda/matchers/active_record/association_matcher.rb +12 -2
- data/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb +41 -0
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +24 -1
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +1 -1
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record.rb +1 -0
- data/lib/shoulda/matchers/assertion_error.rb +8 -3
- data/lib/shoulda/matchers/doublespeak/double.rb +75 -0
- data/lib/shoulda/matchers/doublespeak/double_collection.rb +55 -0
- data/lib/shoulda/matchers/doublespeak/double_implementation_registry.rb +28 -0
- data/lib/shoulda/matchers/doublespeak/object_double.rb +33 -0
- data/lib/shoulda/matchers/doublespeak/proxy_implementation.rb +31 -0
- data/lib/shoulda/matchers/doublespeak/structs.rb +10 -0
- data/lib/shoulda/matchers/doublespeak/stub_implementation.rb +35 -0
- data/lib/shoulda/matchers/doublespeak/world.rb +39 -0
- data/lib/shoulda/matchers/doublespeak.rb +28 -0
- data/lib/shoulda/matchers/error.rb +20 -1
- data/lib/shoulda/matchers/independent/delegate_matcher/stubbed_target.rb +35 -0
- data/lib/shoulda/matchers/independent/delegate_matcher.rb +293 -0
- data/lib/shoulda/matchers/independent.rb +10 -0
- data/lib/shoulda/matchers/integrations/nunit_test_case_detection.rb +38 -0
- data/lib/shoulda/matchers/integrations/rspec.rb +13 -14
- data/lib/shoulda/matchers/integrations/test_unit.rb +19 -15
- data/lib/shoulda/matchers/integrations.rb +13 -0
- data/lib/shoulda/matchers/rails_shim.rb +16 -0
- data/lib/shoulda/matchers/version.rb +1 -1
- data/lib/shoulda/matchers.rb +15 -3
- data/spec/shoulda/matchers/action_controller/callback_matcher_spec.rb +82 -0
- data/spec/shoulda/matchers/action_controller/redirect_to_matcher_spec.rb +2 -2
- data/spec/shoulda/matchers/action_controller/render_template_matcher_spec.rb +5 -5
- data/spec/shoulda/matchers/action_controller/render_with_layout_matcher_spec.rb +4 -4
- data/spec/shoulda/matchers/action_controller/rescue_from_matcher_spec.rb +38 -11
- data/spec/shoulda/matchers/action_controller/respond_with_matcher_spec.rb +1 -1
- data/spec/shoulda/matchers/action_controller/set_session_matcher_spec.rb +1 -1
- data/spec/shoulda/matchers/action_controller/set_the_flash_matcher_spec.rb +6 -6
- data/spec/shoulda/matchers/action_controller/strong_parameters_matcher_spec.rb +314 -0
- data/spec/shoulda/matchers/active_model/allow_value_matcher_spec.rb +32 -0
- data/spec/shoulda/matchers/active_model/ensure_inclusion_of_matcher_spec.rb +553 -211
- data/spec/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +22 -0
- data/spec/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +38 -0
- data/spec/shoulda/matchers/active_model/validate_uniqueness_of_matcher_spec.rb +42 -36
- data/spec/shoulda/matchers/active_record/association_matcher_spec.rb +15 -1
- data/spec/shoulda/matchers/active_record/association_matchers/model_reflection_spec.rb +4 -0
- data/spec/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +4 -0
- data/spec/shoulda/matchers/doublespeak/double_collection_spec.rb +102 -0
- data/spec/shoulda/matchers/doublespeak/double_implementation_registry_spec.rb +21 -0
- data/spec/shoulda/matchers/doublespeak/double_spec.rb +144 -0
- data/spec/shoulda/matchers/doublespeak/object_double_spec.rb +77 -0
- data/spec/shoulda/matchers/doublespeak/proxy_implementation_spec.rb +40 -0
- data/spec/shoulda/matchers/doublespeak/stub_implementation_spec.rb +88 -0
- data/spec/shoulda/matchers/doublespeak/world_spec.rb +88 -0
- data/spec/shoulda/matchers/doublespeak_spec.rb +19 -0
- data/spec/shoulda/matchers/independent/delegate_matcher/stubbed_target_spec.rb +43 -0
- data/spec/shoulda/matchers/independent/delegate_matcher_spec.rb +250 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/activemodel_helpers.rb +6 -2
- data/spec/support/controller_builder.rb +29 -1
- data/spec/support/rails_versions.rb +4 -0
- data/spec/support/test_application.rb +1 -1
- metadata +59 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 913c5859d7601cc8a162435e24a1f9d2362a773e
|
4
|
+
data.tar.gz: 6d4d4fe735c6a340e91af04d75f9607d6f7c6a7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edb31670937686252dbb02b9093101d5fde04eb831a078a20c9113da3c9951c1ba108566a49a89a1400c88334c2c4a81181397953c4f59cfde82a08efe952f9f
|
7
|
+
data.tar.gz: 1456edfcbcc05930e12c5b88b51b10483a18ced6056560c6cd2bf4a996472197afdad588b19b125f7afc0f52fb6226de69709ea87ddf23c0421869caa849fc26
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -16,17 +16,26 @@ matrix:
|
|
16
16
|
- rvm: rbx-19mode
|
17
17
|
- rvm: jruby-19mode
|
18
18
|
include:
|
19
|
+
- rvm: 1.9.2
|
20
|
+
gemfile: gemfiles/3.1_1.9.2.gemfile
|
19
21
|
- rvm: 1.9.3
|
20
22
|
gemfile: gemfiles/4.0.0.gemfile
|
21
23
|
- rvm: 1.9.3
|
22
24
|
gemfile: gemfiles/4.0.1.gemfile
|
25
|
+
- rvm: 1.9.3
|
26
|
+
gemfile: gemfiles/4.1.gemfile
|
23
27
|
- rvm: 2.0.0
|
24
28
|
gemfile: gemfiles/3.2.gemfile
|
25
29
|
- rvm: 2.0.0
|
26
30
|
gemfile: gemfiles/4.0.0.gemfile
|
27
31
|
- rvm: 2.0.0
|
28
32
|
gemfile: gemfiles/4.0.1.gemfile
|
33
|
+
- rvm: 2.0.0
|
34
|
+
gemfile: gemfiles/4.1.gemfile
|
29
35
|
- rvm: rbx-19mode
|
30
36
|
gemfile: gemfiles/3.2.gemfile
|
31
37
|
- rvm: jruby-19mode
|
32
38
|
gemfile: gemfiles/3.2.gemfile
|
39
|
+
exclude:
|
40
|
+
- rvm: 1.9.2
|
41
|
+
gemfile: gemfiles/3.1.gemfile
|
data/.yardopts
CHANGED
data/Appraisals
CHANGED
@@ -1,5 +1,26 @@
|
|
1
|
-
|
1
|
+
ruby_version = Gem::Version.new(RUBY_VERSION + '')
|
2
|
+
|
3
|
+
rails_3 = proc do
|
4
|
+
gem 'strong_parameters'
|
5
|
+
end
|
6
|
+
|
7
|
+
rails_3_1 = proc do
|
8
|
+
instance_eval(&rails_3)
|
9
|
+
gem 'rails', '~> 3.1.8'
|
10
|
+
gem 'bcrypt-ruby', '~> 3.0.0'
|
2
11
|
gem 'jquery-rails'
|
12
|
+
gem 'sass-rails', '~> 3.1.5'
|
13
|
+
gem 'coffee-rails', '~> 3.1.1'
|
14
|
+
gem 'uglifier', '>= 1.0.3'
|
15
|
+
end
|
16
|
+
|
17
|
+
rails_4 = proc do
|
18
|
+
gem 'uglifier', '>= 1.3.0'
|
19
|
+
gem 'coffee-rails', '~> 4.0.0'
|
20
|
+
gem 'jquery-rails'
|
21
|
+
gem 'turbolinks'
|
22
|
+
gem 'jbuilder', '~> 1.2'
|
23
|
+
gem 'sdoc'
|
3
24
|
gem 'activeresource', '4.0.0'
|
4
25
|
# Test suite makes heavy use of attr_accessible
|
5
26
|
gem 'protected_attributes'
|
@@ -7,39 +28,58 @@ end
|
|
7
28
|
|
8
29
|
#---
|
9
30
|
|
10
|
-
if
|
31
|
+
if Gem::Requirement.new('< 2').satisfied_by?(ruby_version)
|
11
32
|
appraise '3.0' do
|
33
|
+
instance_eval(&rails_3)
|
12
34
|
gem 'rails', '~> 3.0.17'
|
13
|
-
gem 'strong_parameters'
|
14
35
|
end
|
15
36
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
37
|
+
if Gem::Requirement.new('= 1.9.2').satisfied_by?(ruby_version)
|
38
|
+
appraise '3.1-1.9.2' do
|
39
|
+
instance_eval(&rails_3_1)
|
40
|
+
gem 'turn', '0.8.2'
|
41
|
+
end
|
42
|
+
else
|
43
|
+
appraise '3.1' do
|
44
|
+
instance_eval(&rails_3_1)
|
45
|
+
gem 'turn', '~> 0.8.3'
|
46
|
+
end
|
22
47
|
end
|
23
48
|
end
|
24
49
|
|
25
50
|
appraise '3.2' do
|
51
|
+
instance_eval(&rails_3)
|
26
52
|
gem 'rails', '~> 3.2.13'
|
27
53
|
gem 'bcrypt-ruby', '~> 3.0.0'
|
28
54
|
gem 'jquery-rails'
|
29
|
-
gem 'sass-rails'
|
30
|
-
gem '
|
55
|
+
gem 'sass-rails', '~> 3.2.3'
|
56
|
+
gem 'coffee-rails', '~> 3.2.1'
|
57
|
+
gem 'uglifier', '>= 1.0.3'
|
31
58
|
end
|
32
59
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
60
|
+
if Gem::Requirement.new('> 1.9.2').satisfied_by?(ruby_version)
|
61
|
+
appraise '4.0.0' do
|
62
|
+
instance_eval(&rails_4)
|
63
|
+
gem 'rails', '4.0.0'
|
64
|
+
gem 'sass-rails', '~> 4.0.0'
|
65
|
+
gem 'bcrypt-ruby', '~> 3.0.0'
|
66
|
+
end
|
67
|
+
|
68
|
+
appraise '4.0.1' do
|
69
|
+
instance_eval(&rails_4)
|
70
|
+
gem 'rails', '4.0.1'
|
71
|
+
gem 'sass-rails', '~> 4.0.0'
|
72
|
+
gem 'bcrypt-ruby', '~> 3.1.2'
|
73
|
+
end
|
39
74
|
|
40
|
-
appraise '4.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
75
|
+
appraise '4.1' do
|
76
|
+
instance_eval(&rails_4)
|
77
|
+
gem 'rails', '~> 4.1.0'
|
78
|
+
gem 'jbuilder', '~> 2.0'
|
79
|
+
gem 'sass-rails', '~> 4.0.3'
|
80
|
+
gem 'sdoc', '~> 0.4.0'
|
81
|
+
gem 'bcrypt', '~> 3.1.7'
|
82
|
+
gem 'protected_attributes', "~> 1.0.6"
|
83
|
+
gem 'spring'
|
84
|
+
end
|
45
85
|
end
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mcmire-shoulda-matchers (2.
|
4
|
+
mcmire-shoulda-matchers (2.6.1.docs.1)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -121,7 +121,7 @@ GEM
|
|
121
121
|
rspec-core (~> 2.14.0)
|
122
122
|
rspec-expectations (~> 2.14.0)
|
123
123
|
rspec-mocks (~> 2.14.0)
|
124
|
-
shoulda-context (1.
|
124
|
+
shoulda-context (1.2.0)
|
125
125
|
slop (3.4.7)
|
126
126
|
sprockets (2.2.2)
|
127
127
|
hike (~> 1.2)
|
@@ -159,7 +159,7 @@ DEPENDENCIES
|
|
159
159
|
rake (>= 0.9.2)
|
160
160
|
redcarpet
|
161
161
|
rspec-rails (>= 2.13.1, < 3)
|
162
|
-
shoulda-context (~> 1.
|
162
|
+
shoulda-context (~> 1.2.0)
|
163
163
|
sqlite3
|
164
164
|
therubyrhino
|
165
165
|
watchr
|
data/NEWS.md
CHANGED
@@ -1,5 +1,66 @@
|
|
1
1
|
# HEAD
|
2
2
|
|
3
|
+
* Revert change to `validate_uniqueness_of` made in 2.6.0 so that it no longer
|
4
|
+
provides default values for non-primary, non-nullable columns. This approach
|
5
|
+
was causing test failures because it makes the assumption that none of these
|
6
|
+
columns allow only specific values, which is not true. If you get an error
|
7
|
+
from `validate_uniqueness_of`, your best bet continues to be creating a record
|
8
|
+
manually and calling `validate_uniqueness_of` on that instead.
|
9
|
+
|
10
|
+
# 2.6.1
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
* Teach `with_message` qualifier on `allow_value` to accept a hash of i18n
|
15
|
+
interpolation values:
|
16
|
+
`allow_value('foo').for(:attr).with_message(:greater_than, values: { count: 20 })`.
|
17
|
+
|
18
|
+
### Bug fixes
|
19
|
+
|
20
|
+
* Revert changes to `validate_numericality_of` made in the last release, which
|
21
|
+
made it so that comparison qualifiers specified on the validation are tested
|
22
|
+
using a very small decimal number offset rather than a whole number by
|
23
|
+
default, except if the matcher was qualified with `only_integer`. This means
|
24
|
+
that prior to 2.6.0, if your validation specified `only_integer` and you did
|
25
|
+
not, then after 2.6.0 that test would fail. This is now fixed.
|
26
|
+
|
27
|
+
* Fix regression in previous release where ActiveRecord matchers would not be
|
28
|
+
included when ActiveRecord wasn't defined (i.e. if you were using ActiveModel
|
29
|
+
only).
|
30
|
+
|
31
|
+
* Revert the behavior of `allow_value` changed in 2.6.0 (it will no longer raise
|
32
|
+
CouldNotClearAttribute). This was originally done as a part of a fix for
|
33
|
+
`validate_presence_of` when used in conjunction with `has_secure_password`.
|
34
|
+
That fix has been updated so that it does not affect `allow_value`.
|
35
|
+
|
36
|
+
* Fix callback matchers and correct test coverage.
|
37
|
+
|
38
|
+
* Fix `permit` so that it does not interfere with different usages of `params`
|
39
|
+
in your controller action. Specifically, this will not raise an error:
|
40
|
+
`params.fetch(:foo, {}).permit(:bar, :baz)` (the `permit` will have no
|
41
|
+
problems recognizing that :bar and :baz are permitted params).
|
42
|
+
|
43
|
+
* Fix `permit` on Rails 4.1 to use PATCH by default for #update instead of PUT.
|
44
|
+
Previously you had to specify this manually.
|
45
|
+
|
46
|
+
* Fix `permit` so that it track multiple calls to #permit in your controller
|
47
|
+
action. Previously only the last usage of #permit would be considered in
|
48
|
+
determining whether the matcher matched.
|
49
|
+
|
50
|
+
* Fix `permit` so that if the route for your action requires params (such as id)
|
51
|
+
then you can now specify those params:
|
52
|
+
`permit(:first_name, :last_name).for(:update, params: { id: 42 })`.
|
53
|
+
|
54
|
+
* Fix `delegate_method` so that it does not stub the target method forever,
|
55
|
+
returning it to its original implementation after the match ends.
|
56
|
+
|
57
|
+
* Fix `validate_uniqueness_of` to work with Rails 4.1 enum columns.
|
58
|
+
|
59
|
+
# 2.6.0
|
60
|
+
|
61
|
+
* The boolean argument to `have_db_index`'s `unique` option is now optional, for
|
62
|
+
consistency with other matchers.
|
63
|
+
|
3
64
|
* Association matchers now test that the model being referred to (either
|
4
65
|
implicitly or explicitly, using `:class_name`) actually exists.
|
5
66
|
|
@@ -25,10 +86,9 @@
|
|
25
86
|
* Change `validate_uniqueness_of(...)` so that it provides default values for
|
26
87
|
non-nullable attributes.
|
27
88
|
|
28
|
-
* Running `rake` now installs Appraisals before running the test suite.
|
29
|
-
|
30
|
-
|
31
|
-
is coming in Appraisal 1.0.0 (we're using the beta for now).
|
89
|
+
* Running `rake` now installs Appraisals before running the test suite.
|
90
|
+
(Additionally, we now manage Appraisals using the `appraisal` executable in
|
91
|
+
Appraisal 1.0.0.)
|
32
92
|
|
33
93
|
* Add `allow_nil` option to `validate_numericality_of` so that you can validate
|
34
94
|
that numeric values are validated only if a value is supplied.
|
@@ -37,6 +97,29 @@
|
|
37
97
|
`greater_than`, `greater_than_or_equal_to`, `less_than`, `less_than_or_equal_
|
38
98
|
to` or `equal_to` is not appropriate.
|
39
99
|
|
100
|
+
* Change `validate_presence_of` under Rails 4 so that if you are using it with a
|
101
|
+
user whose model `has_secure_password` and whose password is set to a value,
|
102
|
+
you will be instructed to use a user whose password is blank instead. The
|
103
|
+
reason for this change is due to the fact that Rails 4's version of
|
104
|
+
`has_secure_password` defines #password= such that `nil` will be ignored,
|
105
|
+
which interferes with how `validate_presence_of` works.
|
106
|
+
|
107
|
+
* Add ability to test `belongs_to` associations defined with `:inverse_of`.
|
108
|
+
|
109
|
+
* Add back matchers that were removed in 2.0.0: `permit`, for testing strong
|
110
|
+
parameters, and `delegate_method`, for testing delegation.
|
111
|
+
|
112
|
+
* Add new matchers for testing controller filters: `before_filter`,
|
113
|
+
`after_filter`, and `around_filter` (aliased to `before_action`,
|
114
|
+
`after_action` and `around_action` for Rails 4).
|
115
|
+
|
116
|
+
* Fix `rescue_from` matcher so that it does not raise an error when testing
|
117
|
+
a method handler which has been marked as protected or private.
|
118
|
+
|
119
|
+
* Fix compatibility issues with Rails 4.1:
|
120
|
+
* `set_the_flash` and `have_and_belongs_to_many` no longer raise errors
|
121
|
+
* Minitest no longer prints warnings whenever shoulda-matchers is required
|
122
|
+
|
40
123
|
# v 2.5.0
|
41
124
|
|
42
125
|
* Fix Rails/Test::Unit integration to ensure that the test case classes we are
|
data/README.md
CHANGED
@@ -126,8 +126,8 @@ gem 'activemodel'
|
|
126
126
|
## Generating documentation
|
127
127
|
|
128
128
|
YARD is used to generate documentation, which can be viewed online at
|
129
|
-
<http://thoughtbot.github.com/shoulda-matchers
|
130
|
-
|
129
|
+
<http://thoughtbot.github.com/shoulda-matchers>. You can preview changes you
|
130
|
+
make to the documentation locally by running
|
131
131
|
|
132
132
|
yard doc
|
133
133
|
|
data/Rakefile
CHANGED
@@ -46,6 +46,12 @@ namespace :docs do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
desc 'Generate docs for a particular version'
|
50
|
+
task :generate, [:version, :is_latest] => :setup do |t, args|
|
51
|
+
latest = (args.is_latest == 'true')
|
52
|
+
generate_docs(args.version, latest: latest)
|
53
|
+
end
|
54
|
+
|
49
55
|
desc 'Generate docs for a particular version and push them to GitHub'
|
50
56
|
task :publish, [:version, :is_latest] => :setup do |t, args|
|
51
57
|
latest = (args.is_latest == 'true')
|
@@ -59,11 +65,23 @@ namespace :docs do
|
|
59
65
|
publish_docs(CURRENT_VERSION, latest: true)
|
60
66
|
end
|
61
67
|
|
68
|
+
def rewrite_index_to_inject_version(ref, version)
|
69
|
+
within_gh_pages do
|
70
|
+
filename = "#{ref}/index.html"
|
71
|
+
content = File.read(filename)
|
72
|
+
content.sub!(%r{<h1>shoulda-matchers.+</h1>}, "<h1>shoulda-matchers (#{version})</h1>")
|
73
|
+
File.open(filename, 'w') {|f| f.write(content) }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
62
77
|
def generate_docs(version, options = {})
|
63
78
|
ref = determine_ref_from(version)
|
64
79
|
|
80
|
+
sh "rm -rf #{GH_PAGES_DIR}/#{ref}"
|
65
81
|
sh "bundle exec yard -o #{GH_PAGES_DIR}/#{ref}"
|
66
82
|
|
83
|
+
rewrite_index_to_inject_version(ref, version)
|
84
|
+
|
67
85
|
within_gh_pages do
|
68
86
|
sh "git add #{ref}"
|
69
87
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: integration with ActiveModel
|
2
|
+
|
3
|
+
Scenario: create a new project using matchers
|
4
|
+
When I generate a new ActiveModel application
|
5
|
+
And I configure the application to use "shoulda-matchers" from this project
|
6
|
+
And I write to "load_dependencies.rb" with:
|
7
|
+
"""
|
8
|
+
require 'active_model'
|
9
|
+
require 'shoulda-matchers'
|
10
|
+
|
11
|
+
puts ActiveModel::VERSION::STRING
|
12
|
+
puts "Loaded all dependencies without errors"
|
13
|
+
"""
|
14
|
+
When I successfully run `bundle exec ruby load_dependencies.rb`
|
15
|
+
Then the output should contain "Loaded all dependencies without errors"
|
@@ -12,7 +12,7 @@ Feature: integrate with Rails
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
"""
|
15
|
-
When I successfully run `bundle exec rake db:migrate --trace`
|
15
|
+
When I successfully run `bundle exec rake db:migrate db:test:prepare --trace`
|
16
16
|
And I write to "app/models/user.rb" with:
|
17
17
|
"""
|
18
18
|
class User < ActiveRecord::Base
|
@@ -0,0 +1,21 @@
|
|
1
|
+
When 'I generate a new ActiveModel application' do
|
2
|
+
steps %{
|
3
|
+
When I run `mkdir #{APP_NAME}`
|
4
|
+
And I cd to "#{APP_NAME}"
|
5
|
+
And I run `bundle init`
|
6
|
+
}
|
7
|
+
|
8
|
+
# Figure out the ActiveModel version to use by reusing the Rails version from
|
9
|
+
# the Appraise gemfile.
|
10
|
+
if match = File.read(ENV['BUNDLE_GEMFILE']).match(/^gem "rails", "(.*)"/)
|
11
|
+
append_to_gemfile %(gem 'activemodel', '#{ match[1] }')
|
12
|
+
else
|
13
|
+
puts "Couldn't determine which ActiveModel version to load; using latest"
|
14
|
+
append_to_gemfile %(gem 'activemodel')
|
15
|
+
end
|
16
|
+
|
17
|
+
steps %{
|
18
|
+
And I set the "BUNDLE_GEMFILE" environment variable to "Gemfile"
|
19
|
+
And I install gems
|
20
|
+
}
|
21
|
+
end
|
@@ -67,7 +67,8 @@ When 'I configure the application to use rspec-rails in test and development' do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
When 'I configure the application to use shoulda-context' do
|
70
|
-
append_to_gemfile %q(gem 'shoulda-context', '~> 1.0')
|
70
|
+
append_to_gemfile %q(gem 'shoulda-context', '~> 1.2.0')
|
71
|
+
append_to_gemfile %q(gem 'pry')
|
71
72
|
steps %{And I install gems}
|
72
73
|
end
|
73
74
|
|
@@ -112,7 +113,7 @@ Then /^the output should indicate that (\d+) tests? (?:was|were) run/ do |number
|
|
112
113
|
# Rails 4 has slightly different output than Rails 3 due to
|
113
114
|
# Test::Unit::TestCase -> MiniTest
|
114
115
|
if rails_4?
|
115
|
-
steps %{Then the output should
|
116
|
+
steps %{Then the output should match /#{number} (tests|runs), #{number} assertions, 0 failures, 0 errors, 0 skips/}
|
116
117
|
else
|
117
118
|
steps %{Then the output should contain "#{number} tests, #{number} assertions, 0 failures, 0 errors"}
|
118
119
|
end
|
@@ -125,7 +126,7 @@ Then /^the output should indicate that (\d+) unit and (\d+) functional tests? we
|
|
125
126
|
# Rails 3 runs separate test suites in separate processes, but Rails 4 does
|
126
127
|
# not, so that's why we have to check for different things here
|
127
128
|
if rails_4?
|
128
|
-
steps %{Then the output should
|
129
|
+
steps %{Then the output should match /#{total} (tests|runs), #{total} assertions, 0 failures, 0 errors, 0 skips/}
|
129
130
|
else
|
130
131
|
steps %{Then the output should match /#{n1} tests, #{n1} assertions, 0 failures, 0 errors.+#{n2} tests, #{n2} assertions, 0 failures, 0 errors/}
|
131
132
|
end
|
@@ -154,7 +155,7 @@ module FileHelpers
|
|
154
155
|
end
|
155
156
|
|
156
157
|
def rails_4?
|
157
|
-
match = ORIGINAL_BUNDLE_VARS['BUNDLE_GEMFILE'].match(/(\d)\.\d\.(\d\.)?gemfile$/)
|
158
|
+
match = ORIGINAL_BUNDLE_VARS['BUNDLE_GEMFILE'].match(/(\d)\.\d\.(\d\.)?(\w+\.)?gemfile$/)
|
158
159
|
match.captures[0] == '4'
|
159
160
|
end
|
160
161
|
end
|
data/gemfiles/3.0.gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "appraisal", "~> 0.
|
5
|
+
gem "appraisal", "~> 1.0.0.beta2"
|
6
6
|
gem "aruba"
|
7
7
|
gem "bourne", "~> 1.3"
|
8
8
|
gem "bundler", "~> 1.1"
|
@@ -11,14 +11,17 @@ gem "pry"
|
|
11
11
|
gem "rake", ">= 0.9.2"
|
12
12
|
gem "rspec-rails", ">= 2.13.1", "< 3"
|
13
13
|
gem "yard"
|
14
|
-
gem "
|
14
|
+
gem "redcarpet"
|
15
|
+
gem "pygments.rb"
|
16
|
+
gem "watchr"
|
17
|
+
gem "shoulda-context", "~> 1.2.0"
|
15
18
|
gem "sqlite3", :platform=>:ruby
|
16
19
|
gem "activerecord-jdbc-adapter", :platform=>:jruby
|
17
20
|
gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
|
18
21
|
gem "jdbc-sqlite3", :platform=>:jruby
|
19
22
|
gem "jruby-openssl", :platform=>:jruby
|
20
23
|
gem "therubyrhino", :platform=>:jruby
|
21
|
-
gem "rails", "~> 3.0.17"
|
22
24
|
gem "strong_parameters"
|
25
|
+
gem "rails", "~> 3.0.17"
|
23
26
|
|
24
27
|
gemspec :path=>".././"
|
data/gemfiles/3.0.gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
shoulda-matchers (2.
|
4
|
+
shoulda-matchers (2.6.1)
|
5
5
|
activesupport (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -74,10 +74,14 @@ GEM
|
|
74
74
|
metaclass (~> 0.0.1)
|
75
75
|
multi_json (1.7.1)
|
76
76
|
polyglot (0.3.3)
|
77
|
+
posix-spawn (0.3.8)
|
77
78
|
pry (0.9.12.6)
|
78
79
|
coderay (~> 1.0)
|
79
80
|
method_source (~> 0.8)
|
80
81
|
slop (~> 3.4)
|
82
|
+
pygments.rb (0.5.4)
|
83
|
+
posix-spawn (~> 0.3.6)
|
84
|
+
yajl-ruby (~> 1.1.0)
|
81
85
|
rack (1.2.8)
|
82
86
|
rack-mount (0.6.14)
|
83
87
|
rack (>= 1.0.0)
|
@@ -100,6 +104,7 @@ GEM
|
|
100
104
|
rake (10.0.3)
|
101
105
|
rdoc (3.12.2)
|
102
106
|
json (~> 1.4)
|
107
|
+
redcarpet (3.1.1)
|
103
108
|
rspec-core (2.13.1)
|
104
109
|
rspec-expectations (2.13.0)
|
105
110
|
diff-lcs (>= 1.1.3, < 2.0)
|
@@ -111,7 +116,7 @@ GEM
|
|
111
116
|
rspec-core (~> 2.13.0)
|
112
117
|
rspec-expectations (~> 2.13.0)
|
113
118
|
rspec-mocks (~> 2.13.0)
|
114
|
-
shoulda-context (1.
|
119
|
+
shoulda-context (1.2.0)
|
115
120
|
slop (3.4.7)
|
116
121
|
sqlite3 (1.3.7)
|
117
122
|
strong_parameters (0.2.0)
|
@@ -123,7 +128,9 @@ GEM
|
|
123
128
|
polyglot
|
124
129
|
polyglot (>= 0.3.1)
|
125
130
|
tzinfo (0.3.37)
|
126
|
-
|
131
|
+
watchr (0.7)
|
132
|
+
yajl-ruby (1.1.0)
|
133
|
+
yard (0.8.7.4)
|
127
134
|
|
128
135
|
PLATFORMS
|
129
136
|
ruby
|
@@ -139,12 +146,15 @@ DEPENDENCIES
|
|
139
146
|
jdbc-sqlite3
|
140
147
|
jruby-openssl
|
141
148
|
pry
|
149
|
+
pygments.rb
|
142
150
|
rails (~> 3.0.17)
|
143
151
|
rake (>= 0.9.2)
|
152
|
+
redcarpet
|
144
153
|
rspec-rails (>= 2.13.1, < 3)
|
145
|
-
shoulda-context (~> 1.
|
154
|
+
shoulda-context (~> 1.2.0)
|
146
155
|
shoulda-matchers!
|
147
156
|
sqlite3
|
148
157
|
strong_parameters
|
149
158
|
therubyrhino
|
159
|
+
watchr
|
150
160
|
yard
|
data/gemfiles/3.1.gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "appraisal", "~> 0.
|
5
|
+
gem "appraisal", "~> 1.0.0.beta2"
|
6
6
|
gem "aruba"
|
7
7
|
gem "bourne", "~> 1.3"
|
8
8
|
gem "bundler", "~> 1.1"
|
@@ -11,17 +11,23 @@ gem "pry"
|
|
11
11
|
gem "rake", ">= 0.9.2"
|
12
12
|
gem "rspec-rails", ">= 2.13.1", "< 3"
|
13
13
|
gem "yard"
|
14
|
-
gem "
|
14
|
+
gem "redcarpet"
|
15
|
+
gem "pygments.rb"
|
16
|
+
gem "watchr"
|
17
|
+
gem "shoulda-context", "~> 1.2.0"
|
15
18
|
gem "sqlite3", :platform=>:ruby
|
16
19
|
gem "activerecord-jdbc-adapter", :platform=>:jruby
|
17
20
|
gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
|
18
21
|
gem "jdbc-sqlite3", :platform=>:jruby
|
19
22
|
gem "jruby-openssl", :platform=>:jruby
|
20
23
|
gem "therubyrhino", :platform=>:jruby
|
24
|
+
gem "strong_parameters"
|
21
25
|
gem "rails", "~> 3.1.8"
|
22
26
|
gem "bcrypt-ruby", "~> 3.0.0"
|
23
27
|
gem "jquery-rails"
|
24
|
-
gem "sass-rails"
|
25
|
-
gem "
|
28
|
+
gem "sass-rails", "~> 3.1.5"
|
29
|
+
gem "coffee-rails", "~> 3.1.1"
|
30
|
+
gem "uglifier", ">= 1.0.3"
|
31
|
+
gem "turn", "~> 0.8.3"
|
26
32
|
|
27
33
|
gemspec :path=>".././"
|