shoulda-matchers 3.1.3 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound/ruby.yml +336 -316
- data/.python-version +1 -0
- data/.rubocop.yml +3 -1
- data/.travis.yml +7 -6
- data/Appraisals +76 -44
- data/CONTRIBUTING.md +137 -66
- data/Gemfile +5 -5
- data/Gemfile.lock +30 -35
- data/MAINTAINING.md +250 -0
- data/MIT-LICENSE +1 -1
- data/NEWS.md +176 -4
- data/README.md +138 -200
- data/Rakefile +7 -0
- data/bin/setup +190 -0
- data/doc_config/yard/templates/default/fulldoc/html/css/global.css +4 -0
- data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -6
- data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -17
- data/doc_config/yard/templates/default/fulldoc/html/setup.rb +27 -0
- data/gemfiles/4.2.gemfile +21 -20
- data/gemfiles/4.2.gemfile.lock +143 -140
- data/gemfiles/5.0.gemfile +37 -0
- data/gemfiles/5.0.gemfile.lock +238 -0
- data/gemfiles/5.1.gemfile +38 -0
- data/gemfiles/5.1.gemfile.lock +254 -0
- data/gemfiles/5.2.gemfile +40 -0
- data/gemfiles/5.2.gemfile.lock +273 -0
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +18 -6
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +6 -1
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +87 -27
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +1 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +0 -4
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +5 -0
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +5 -0
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +26 -11
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +39 -4
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +116 -47
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +127 -38
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +55 -37
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +30 -1
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +11 -4
- data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +11 -6
- data/lib/shoulda/matchers/active_record.rb +3 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +172 -22
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +11 -6
- data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +46 -0
- data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +51 -0
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +268 -38
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +111 -0
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +207 -79
- data/lib/shoulda/matchers/doublespeak/object_double.rb +5 -1
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +100 -21
- data/lib/shoulda/matchers/rails_shim.rb +133 -52
- data/lib/shoulda/matchers/routing.rb +2 -2
- data/lib/shoulda/matchers/util.rb +23 -1
- data/lib/shoulda/matchers/util/word_wrap.rb +6 -2
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/install_gems_in_all_appraisals +3 -1
- data/script/run_all_tests +3 -1
- data/script/supported_ruby_versions +7 -0
- data/script/update_gem_in_all_appraisals +3 -1
- data/script/update_gems_in_all_appraisals +3 -1
- data/shoulda-matchers.gemspec +3 -3
- data/spec/acceptance/independent_matchers_spec.rb +2 -2
- data/spec/acceptance/multiple_libraries_integration_spec.rb +1 -1
- data/spec/acceptance/rails_integration_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -3
- data/spec/support/acceptance/helpers.rb +2 -0
- data/spec/support/acceptance/helpers/command_helpers.rb +17 -4
- data/spec/support/acceptance/helpers/rails_migration_helpers.rb +21 -0
- data/spec/support/acceptance/helpers/step_helpers.rb +1 -1
- data/spec/support/tests/current_bundle.rb +3 -9
- data/spec/support/tests/filesystem.rb +2 -2
- data/spec/support/unit/attribute.rb +0 -2
- data/spec/support/unit/capture.rb +9 -3
- data/spec/support/unit/helpers/action_pack_versions.rb +22 -0
- data/spec/support/unit/helpers/active_model_versions.rb +4 -0
- data/spec/support/unit/helpers/active_record_versions.rb +22 -2
- data/spec/support/unit/helpers/active_resource_builder.rb +2 -2
- data/spec/support/unit/helpers/controller_builder.rb +1 -1
- data/spec/support/unit/helpers/message_helpers.rb +19 -0
- data/spec/support/unit/helpers/rails_versions.rb +14 -0
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +7 -5
- data/spec/support/unit/matchers/print_warning_including.rb +21 -13
- data/spec/support/unit/model_creation_strategies/active_record.rb +1 -1
- data/spec/support/unit/model_creators/active_record.rb +0 -1
- data/spec/support/unit/model_creators/basic.rb +7 -2
- data/spec/support/unit/rails_application.rb +25 -0
- data/spec/support/unit/record_validating_confirmation_builder.rb +5 -2
- data/spec/support/unit/validation_matcher_scenario.rb +0 -2
- data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +18 -18
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +33 -5
- data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +1 -1
- data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +80 -78
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +7 -9
- data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +28 -4
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +19 -1
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +27 -4
- data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +62 -5
- data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +52 -18
- data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +51 -4
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +99 -71
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +41 -15
- data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +445 -15
- data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +615 -93
- data/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +169 -0
- data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +167 -97
- data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +2 -4
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +152 -19
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +258 -94
- data/spec/unit_spec_helper.rb +9 -1
- data/zeus.json +1 -1
- metadata +31 -16
- data/gemfiles/4.0.0.gemfile +0 -38
- data/gemfiles/4.0.0.gemfile.lock +0 -223
- data/gemfiles/4.0.1.gemfile +0 -38
- data/gemfiles/4.0.1.gemfile.lock +0 -225
- data/gemfiles/4.1.gemfile +0 -38
- data/gemfiles/4.1.gemfile.lock +0 -220
- data/script/SUPPORTED_VERSIONS +0 -1
@@ -0,0 +1,40 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "2.2.0"
|
6
|
+
gem "bundler", "~> 1.1"
|
7
|
+
gem "pry"
|
8
|
+
gem "pry-byebug"
|
9
|
+
gem "rake", "12.3.0"
|
10
|
+
gem "rspec", "~> 3.6"
|
11
|
+
gem "zeus", require: false
|
12
|
+
gem "yard"
|
13
|
+
gem "redcarpet"
|
14
|
+
gem "pygments.rb"
|
15
|
+
gem "fssm"
|
16
|
+
gem "activerecord-jdbc-adapter", platform: :jruby
|
17
|
+
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
18
|
+
gem "jdbc-sqlite3", platform: :jruby
|
19
|
+
gem "jruby-openssl", platform: :jruby
|
20
|
+
gem "therubyrhino", platform: :jruby
|
21
|
+
gem "sqlite3", platform: :ruby
|
22
|
+
gem "pg", platform: :ruby
|
23
|
+
gem "spring"
|
24
|
+
gem "spring-commands-rspec"
|
25
|
+
gem "minitest-reporters"
|
26
|
+
gem "rspec-rails", "~> 3.6"
|
27
|
+
gem "shoulda-context", "~> 1.2.0"
|
28
|
+
gem "rails", "~> 5.2.1"
|
29
|
+
gem "rails-controller-testing", ">= 1.0.1"
|
30
|
+
gem "puma", "~> 3.11"
|
31
|
+
gem "bootsnap", ">= 1.1.0", require: false
|
32
|
+
gem "sass-rails", "~> 5.0"
|
33
|
+
gem "turbolinks", "~> 5"
|
34
|
+
gem "jbuilder", "~> 2.5"
|
35
|
+
gem "bcrypt", "~> 3.1.7"
|
36
|
+
gem "capybara", "~> 3.1.1"
|
37
|
+
gem "selenium-webdriver"
|
38
|
+
gem "chromedriver-helper"
|
39
|
+
gem "listen", ">= 3.0.5", "< 3.2"
|
40
|
+
gem "spring-watcher-listen", "~> 2.0.0"
|
@@ -0,0 +1,273 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actioncable (5.2.1)
|
5
|
+
actionpack (= 5.2.1)
|
6
|
+
nio4r (~> 2.0)
|
7
|
+
websocket-driver (>= 0.6.1)
|
8
|
+
actionmailer (5.2.1)
|
9
|
+
actionpack (= 5.2.1)
|
10
|
+
actionview (= 5.2.1)
|
11
|
+
activejob (= 5.2.1)
|
12
|
+
mail (~> 2.5, >= 2.5.4)
|
13
|
+
rails-dom-testing (~> 2.0)
|
14
|
+
actionpack (5.2.1)
|
15
|
+
actionview (= 5.2.1)
|
16
|
+
activesupport (= 5.2.1)
|
17
|
+
rack (~> 2.0)
|
18
|
+
rack-test (>= 0.6.3)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
21
|
+
actionview (5.2.1)
|
22
|
+
activesupport (= 5.2.1)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubi (~> 1.4)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
27
|
+
activejob (5.2.1)
|
28
|
+
activesupport (= 5.2.1)
|
29
|
+
globalid (>= 0.3.6)
|
30
|
+
activemodel (5.2.1)
|
31
|
+
activesupport (= 5.2.1)
|
32
|
+
activerecord (5.2.1)
|
33
|
+
activemodel (= 5.2.1)
|
34
|
+
activesupport (= 5.2.1)
|
35
|
+
arel (>= 9.0)
|
36
|
+
activestorage (5.2.1)
|
37
|
+
actionpack (= 5.2.1)
|
38
|
+
activerecord (= 5.2.1)
|
39
|
+
marcel (~> 0.3.1)
|
40
|
+
activesupport (5.2.1)
|
41
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
42
|
+
i18n (>= 0.7, < 2)
|
43
|
+
minitest (~> 5.1)
|
44
|
+
tzinfo (~> 1.1)
|
45
|
+
addressable (2.5.2)
|
46
|
+
public_suffix (>= 2.0.2, < 4.0)
|
47
|
+
ansi (1.5.0)
|
48
|
+
appraisal (2.2.0)
|
49
|
+
bundler
|
50
|
+
rake
|
51
|
+
thor (>= 0.14.0)
|
52
|
+
archive-zip (0.11.0)
|
53
|
+
io-like (~> 0.3.0)
|
54
|
+
arel (9.0.0)
|
55
|
+
bcrypt (3.1.12)
|
56
|
+
bootsnap (1.3.1)
|
57
|
+
msgpack (~> 1.0)
|
58
|
+
builder (3.2.3)
|
59
|
+
byebug (10.0.2)
|
60
|
+
capybara (3.1.1)
|
61
|
+
addressable
|
62
|
+
mini_mime (>= 0.1.3)
|
63
|
+
nokogiri (~> 1.8)
|
64
|
+
rack (>= 1.6.0)
|
65
|
+
rack-test (>= 0.6.3)
|
66
|
+
xpath (~> 3.0)
|
67
|
+
childprocess (0.9.0)
|
68
|
+
ffi (~> 1.0, >= 1.0.11)
|
69
|
+
chromedriver-helper (1.2.0)
|
70
|
+
archive-zip (~> 0.10)
|
71
|
+
nokogiri (~> 1.8)
|
72
|
+
coderay (1.1.2)
|
73
|
+
concurrent-ruby (1.0.5)
|
74
|
+
crass (1.0.4)
|
75
|
+
diff-lcs (1.3)
|
76
|
+
erubi (1.7.1)
|
77
|
+
ffi (1.9.25)
|
78
|
+
fssm (0.2.10)
|
79
|
+
globalid (0.4.1)
|
80
|
+
activesupport (>= 4.2.0)
|
81
|
+
i18n (1.1.0)
|
82
|
+
concurrent-ruby (~> 1.0)
|
83
|
+
io-like (0.3.0)
|
84
|
+
jbuilder (2.7.0)
|
85
|
+
activesupport (>= 4.2.0)
|
86
|
+
multi_json (>= 1.2)
|
87
|
+
listen (3.1.5)
|
88
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
89
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
90
|
+
ruby_dep (~> 1.2)
|
91
|
+
loofah (2.2.2)
|
92
|
+
crass (~> 1.0.2)
|
93
|
+
nokogiri (>= 1.5.9)
|
94
|
+
mail (2.7.0)
|
95
|
+
mini_mime (>= 0.1.1)
|
96
|
+
marcel (0.3.2)
|
97
|
+
mimemagic (~> 0.3.2)
|
98
|
+
method_source (0.9.0)
|
99
|
+
mimemagic (0.3.2)
|
100
|
+
mini_mime (1.0.1)
|
101
|
+
mini_portile2 (2.3.0)
|
102
|
+
minitest (5.11.3)
|
103
|
+
minitest-reporters (1.3.4)
|
104
|
+
ansi
|
105
|
+
builder
|
106
|
+
minitest (>= 5.0)
|
107
|
+
ruby-progressbar
|
108
|
+
msgpack (1.2.4)
|
109
|
+
multi_json (1.13.1)
|
110
|
+
nio4r (2.3.1)
|
111
|
+
nokogiri (1.8.4)
|
112
|
+
mini_portile2 (~> 2.3.0)
|
113
|
+
pg (1.1.2)
|
114
|
+
pry (0.11.3)
|
115
|
+
coderay (~> 1.1.0)
|
116
|
+
method_source (~> 0.9.0)
|
117
|
+
pry-byebug (3.6.0)
|
118
|
+
byebug (~> 10.0)
|
119
|
+
pry (~> 0.10)
|
120
|
+
public_suffix (3.0.3)
|
121
|
+
puma (3.12.0)
|
122
|
+
pygments.rb (1.2.1)
|
123
|
+
multi_json (>= 1.0.0)
|
124
|
+
rack (2.0.5)
|
125
|
+
rack-test (1.1.0)
|
126
|
+
rack (>= 1.0, < 3)
|
127
|
+
rails (5.2.1)
|
128
|
+
actioncable (= 5.2.1)
|
129
|
+
actionmailer (= 5.2.1)
|
130
|
+
actionpack (= 5.2.1)
|
131
|
+
actionview (= 5.2.1)
|
132
|
+
activejob (= 5.2.1)
|
133
|
+
activemodel (= 5.2.1)
|
134
|
+
activerecord (= 5.2.1)
|
135
|
+
activestorage (= 5.2.1)
|
136
|
+
activesupport (= 5.2.1)
|
137
|
+
bundler (>= 1.3.0)
|
138
|
+
railties (= 5.2.1)
|
139
|
+
sprockets-rails (>= 2.0.0)
|
140
|
+
rails-controller-testing (1.0.2)
|
141
|
+
actionpack (~> 5.x, >= 5.0.1)
|
142
|
+
actionview (~> 5.x, >= 5.0.1)
|
143
|
+
activesupport (~> 5.x)
|
144
|
+
rails-dom-testing (2.0.3)
|
145
|
+
activesupport (>= 4.2.0)
|
146
|
+
nokogiri (>= 1.6)
|
147
|
+
rails-html-sanitizer (1.0.4)
|
148
|
+
loofah (~> 2.2, >= 2.2.2)
|
149
|
+
railties (5.2.1)
|
150
|
+
actionpack (= 5.2.1)
|
151
|
+
activesupport (= 5.2.1)
|
152
|
+
method_source
|
153
|
+
rake (>= 0.8.7)
|
154
|
+
thor (>= 0.19.0, < 2.0)
|
155
|
+
rake (12.3.0)
|
156
|
+
rb-fsevent (0.10.3)
|
157
|
+
rb-inotify (0.9.10)
|
158
|
+
ffi (>= 0.5.0, < 2)
|
159
|
+
redcarpet (3.4.0)
|
160
|
+
rspec (3.8.0)
|
161
|
+
rspec-core (~> 3.8.0)
|
162
|
+
rspec-expectations (~> 3.8.0)
|
163
|
+
rspec-mocks (~> 3.8.0)
|
164
|
+
rspec-core (3.8.0)
|
165
|
+
rspec-support (~> 3.8.0)
|
166
|
+
rspec-expectations (3.8.1)
|
167
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
168
|
+
rspec-support (~> 3.8.0)
|
169
|
+
rspec-mocks (3.8.0)
|
170
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
171
|
+
rspec-support (~> 3.8.0)
|
172
|
+
rspec-rails (3.8.0)
|
173
|
+
actionpack (>= 3.0)
|
174
|
+
activesupport (>= 3.0)
|
175
|
+
railties (>= 3.0)
|
176
|
+
rspec-core (~> 3.8.0)
|
177
|
+
rspec-expectations (~> 3.8.0)
|
178
|
+
rspec-mocks (~> 3.8.0)
|
179
|
+
rspec-support (~> 3.8.0)
|
180
|
+
rspec-support (3.8.0)
|
181
|
+
ruby-progressbar (1.10.0)
|
182
|
+
ruby_dep (1.5.0)
|
183
|
+
rubyzip (1.2.2)
|
184
|
+
sass (3.5.7)
|
185
|
+
sass-listen (~> 4.0.0)
|
186
|
+
sass-listen (4.0.0)
|
187
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
188
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
189
|
+
sass-rails (5.0.7)
|
190
|
+
railties (>= 4.0.0, < 6)
|
191
|
+
sass (~> 3.1)
|
192
|
+
sprockets (>= 2.8, < 4.0)
|
193
|
+
sprockets-rails (>= 2.0, < 4.0)
|
194
|
+
tilt (>= 1.1, < 3)
|
195
|
+
selenium-webdriver (3.14.0)
|
196
|
+
childprocess (~> 0.5)
|
197
|
+
rubyzip (~> 1.2)
|
198
|
+
shoulda-context (1.2.2)
|
199
|
+
spring (2.0.2)
|
200
|
+
activesupport (>= 4.2)
|
201
|
+
spring-commands-rspec (1.0.4)
|
202
|
+
spring (>= 0.9.1)
|
203
|
+
spring-watcher-listen (2.0.1)
|
204
|
+
listen (>= 2.7, < 4.0)
|
205
|
+
spring (>= 1.2, < 3.0)
|
206
|
+
sprockets (3.7.2)
|
207
|
+
concurrent-ruby (~> 1.0)
|
208
|
+
rack (> 1, < 3)
|
209
|
+
sprockets-rails (3.2.1)
|
210
|
+
actionpack (>= 4.0)
|
211
|
+
activesupport (>= 4.0)
|
212
|
+
sprockets (>= 3.0.0)
|
213
|
+
sqlite3 (1.3.13)
|
214
|
+
thor (0.20.0)
|
215
|
+
thread_safe (0.3.6)
|
216
|
+
tilt (2.0.8)
|
217
|
+
turbolinks (5.2.0)
|
218
|
+
turbolinks-source (~> 5.2)
|
219
|
+
turbolinks-source (5.2.0)
|
220
|
+
tzinfo (1.2.5)
|
221
|
+
thread_safe (~> 0.1)
|
222
|
+
websocket-driver (0.7.0)
|
223
|
+
websocket-extensions (>= 0.1.0)
|
224
|
+
websocket-extensions (0.1.3)
|
225
|
+
xpath (3.1.0)
|
226
|
+
nokogiri (~> 1.8)
|
227
|
+
yard (0.9.16)
|
228
|
+
zeus (0.15.14)
|
229
|
+
method_source (>= 0.6.7)
|
230
|
+
|
231
|
+
PLATFORMS
|
232
|
+
ruby
|
233
|
+
|
234
|
+
DEPENDENCIES
|
235
|
+
activerecord-jdbc-adapter
|
236
|
+
activerecord-jdbcsqlite3-adapter
|
237
|
+
appraisal (= 2.2.0)
|
238
|
+
bcrypt (~> 3.1.7)
|
239
|
+
bootsnap (>= 1.1.0)
|
240
|
+
bundler (~> 1.1)
|
241
|
+
capybara (~> 3.1.1)
|
242
|
+
chromedriver-helper
|
243
|
+
fssm
|
244
|
+
jbuilder (~> 2.5)
|
245
|
+
jdbc-sqlite3
|
246
|
+
jruby-openssl
|
247
|
+
listen (>= 3.0.5, < 3.2)
|
248
|
+
minitest-reporters
|
249
|
+
pg
|
250
|
+
pry
|
251
|
+
pry-byebug
|
252
|
+
puma (~> 3.11)
|
253
|
+
pygments.rb
|
254
|
+
rails (~> 5.2.1)
|
255
|
+
rails-controller-testing (>= 1.0.1)
|
256
|
+
rake (= 12.3.0)
|
257
|
+
redcarpet
|
258
|
+
rspec (~> 3.6)
|
259
|
+
rspec-rails (~> 3.6)
|
260
|
+
sass-rails (~> 5.0)
|
261
|
+
selenium-webdriver
|
262
|
+
shoulda-context (~> 1.2.0)
|
263
|
+
spring
|
264
|
+
spring-commands-rspec
|
265
|
+
spring-watcher-listen (~> 2.0.0)
|
266
|
+
sqlite3
|
267
|
+
therubyrhino
|
268
|
+
turbolinks (~> 5)
|
269
|
+
yard
|
270
|
+
zeus
|
271
|
+
|
272
|
+
BUNDLED WITH
|
273
|
+
1.16.1
|
@@ -20,10 +20,14 @@ module Shoulda
|
|
20
20
|
# should_not use_before_filter(:prevent_ssl)
|
21
21
|
# end
|
22
22
|
#
|
23
|
+
# @note This method is only available when using shoulda-matchers under
|
24
|
+
# Rails 4.x.
|
23
25
|
# @return [CallbackMatcher]
|
24
26
|
#
|
25
|
-
|
26
|
-
|
27
|
+
if RailsShim.action_pack_lt_5?
|
28
|
+
def use_before_filter(callback)
|
29
|
+
CallbackMatcher.new(callback, :before, :filter)
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
# The `use_after_filter` matcher is used to test that an after_filter
|
@@ -45,10 +49,14 @@ module Shoulda
|
|
45
49
|
# should_not use_after_filter(:destroy_user)
|
46
50
|
# end
|
47
51
|
#
|
52
|
+
# @note This method is only available when using shoulda-matchers under
|
53
|
+
# Rails 4.x.
|
48
54
|
# @return [CallbackMatcher]
|
49
55
|
#
|
50
|
-
|
51
|
-
|
56
|
+
if RailsShim.action_pack_lt_5?
|
57
|
+
def use_after_filter(callback)
|
58
|
+
CallbackMatcher.new(callback, :after, :filter)
|
59
|
+
end
|
52
60
|
end
|
53
61
|
|
54
62
|
# The `use_before_action` matcher is used to test that a before_action
|
@@ -120,10 +128,14 @@ module Shoulda
|
|
120
128
|
# should_not use_around_filter(:save_view_context)
|
121
129
|
# end
|
122
130
|
#
|
131
|
+
# @note This method is only available when using shoulda-matchers under
|
132
|
+
# Rails 4.x.
|
123
133
|
# @return [CallbackMatcher]
|
124
134
|
#
|
125
|
-
|
126
|
-
|
135
|
+
if RailsShim.action_pack_lt_5?
|
136
|
+
def use_around_filter(callback)
|
137
|
+
CallbackMatcher.new(callback, :around, :filter)
|
138
|
+
end
|
127
139
|
end
|
128
140
|
|
129
141
|
# The `use_around_action` matcher is used to test that an around_action
|
@@ -250,7 +250,12 @@ module Shoulda
|
|
250
250
|
parameters_double_registry.register
|
251
251
|
|
252
252
|
Doublespeak.with_doubles_activated do
|
253
|
-
|
253
|
+
Shoulda::Matchers::RailsShim.make_controller_request(
|
254
|
+
context,
|
255
|
+
verb,
|
256
|
+
action,
|
257
|
+
request_params,
|
258
|
+
)
|
254
259
|
end
|
255
260
|
|
256
261
|
unpermitted_parameter_names.empty?
|
@@ -12,8 +12,8 @@ module Shoulda
|
|
12
12
|
# routing test case. For instance, given these routes:
|
13
13
|
#
|
14
14
|
# My::Application.routes.draw do
|
15
|
-
# get '/posts',
|
16
|
-
# get '/posts/:id'
|
15
|
+
# get '/posts', to: 'posts#index'
|
16
|
+
# get '/posts/:id', to: 'posts#show'
|
17
17
|
# end
|
18
18
|
#
|
19
19
|
# You could choose to write tests for these routes alongside other tests
|
@@ -64,6 +64,42 @@ module Shoulda
|
|
64
64
|
# this controller. In the latter case we specify this using the
|
65
65
|
# `controller` key passed to the `to` qualifier.
|
66
66
|
#
|
67
|
+
# #### Specifying a port
|
68
|
+
#
|
69
|
+
# If the route you're testing has a constraint on it that limits the route
|
70
|
+
# to a particular port, you can specify it by passing a `port` option to
|
71
|
+
# the matcher:
|
72
|
+
#
|
73
|
+
# class PortConstraint
|
74
|
+
# def initialize(port)
|
75
|
+
# @port = port
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# def matches?(request)
|
79
|
+
# request.port == @port
|
80
|
+
# end
|
81
|
+
# end
|
82
|
+
#
|
83
|
+
# My::Application.routes.draw do
|
84
|
+
# get '/posts',
|
85
|
+
# to: 'posts#index',
|
86
|
+
# constraints: PortConstraint.new(12345)
|
87
|
+
# end
|
88
|
+
#
|
89
|
+
# # RSpec
|
90
|
+
# describe 'Routing', type: :routing do
|
91
|
+
# it do
|
92
|
+
# should route(:get, '/posts', port: 12345).
|
93
|
+
# to('posts#index')
|
94
|
+
# end
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
# # Minitest (Shoulda)
|
98
|
+
# class RoutesTest < ActionController::IntegrationTest
|
99
|
+
# should route(:get, '/posts', port: 12345).
|
100
|
+
# to('posts#index')
|
101
|
+
# end
|
102
|
+
#
|
67
103
|
# #### Qualifiers
|
68
104
|
#
|
69
105
|
# ##### to
|
@@ -71,7 +107,9 @@ module Shoulda
|
|
71
107
|
# Use `to` to specify the action (along with the controller, if needed)
|
72
108
|
# that the route resolves to.
|
73
109
|
#
|
74
|
-
#
|
110
|
+
# `to` takes either keyword arguments (`controller` and `action`) or a
|
111
|
+
# string that represents the controller/action pair:
|
112
|
+
#
|
75
113
|
# route(:get, '/posts').to(action: index)
|
76
114
|
# route(:get, '/posts').to(controller: :posts, action: index)
|
77
115
|
# route(:get, '/posts').to('posts#index')
|
@@ -86,19 +124,20 @@ module Shoulda
|
|
86
124
|
#
|
87
125
|
# @return [RouteMatcher]
|
88
126
|
#
|
89
|
-
def route(method, path)
|
90
|
-
RouteMatcher.new(method, path,
|
127
|
+
def route(method, path, port: nil)
|
128
|
+
RouteMatcher.new(self, method, path, port: port)
|
91
129
|
end
|
92
130
|
|
93
131
|
# @private
|
94
132
|
class RouteMatcher
|
95
|
-
def initialize(method, path,
|
96
|
-
@method = method
|
97
|
-
@path = path
|
133
|
+
def initialize(context, method, path, port: nil)
|
98
134
|
@context = context
|
135
|
+
@method = method
|
136
|
+
@path = add_port_to_path(normalize_path(path), port)
|
137
|
+
@params = {}
|
99
138
|
end
|
100
139
|
|
101
|
-
attr_reader :failure_message
|
140
|
+
attr_reader :failure_message
|
102
141
|
|
103
142
|
def to(*args)
|
104
143
|
@params = RouteParams.new(args).normalize
|
@@ -111,36 +150,57 @@ module Shoulda
|
|
111
150
|
end
|
112
151
|
|
113
152
|
def matches?(controller)
|
114
|
-
|
153
|
+
guess_controller_if_necessary(controller)
|
154
|
+
|
115
155
|
route_recognized?
|
116
156
|
end
|
117
157
|
|
118
158
|
def description
|
119
|
-
"route #{
|
159
|
+
"route #{method.to_s.upcase} #{path} to/from #{params.inspect}"
|
160
|
+
end
|
161
|
+
|
162
|
+
def failure_message_when_negated
|
163
|
+
"Didn't expect to #{description}"
|
120
164
|
end
|
121
165
|
|
122
166
|
private
|
123
167
|
|
124
|
-
|
125
|
-
|
168
|
+
attr_reader :context, :method, :path, :params
|
169
|
+
|
170
|
+
def normalize_path(path)
|
171
|
+
if path.start_with?('/')
|
172
|
+
path
|
173
|
+
else
|
174
|
+
"/#{path}"
|
175
|
+
end
|
126
176
|
end
|
127
177
|
|
178
|
+
def add_port_to_path(path, port)
|
179
|
+
if port
|
180
|
+
"http://example.com:#{port}" + path
|
181
|
+
else
|
182
|
+
path
|
183
|
+
end
|
184
|
+
end
|
128
185
|
|
129
|
-
def route_recognized?
|
130
|
-
begin
|
131
|
-
@context.__send__(:assert_routing,
|
132
|
-
{ method: @method, path: @path },
|
133
|
-
@params)
|
134
186
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
187
|
+
def guess_controller_if_necessary(controller)
|
188
|
+
params[:controller] ||= controller.controller_path
|
189
|
+
end
|
190
|
+
|
191
|
+
def route_recognized?
|
192
|
+
context.send(
|
193
|
+
:assert_routing,
|
194
|
+
{ method: method, path: path },
|
195
|
+
params,
|
196
|
+
)
|
197
|
+
true
|
198
|
+
rescue ::ActionController::RoutingError => error
|
199
|
+
@failure_message = error.message
|
200
|
+
false
|
201
|
+
rescue Shoulda::Matchers.assertion_exception_class => error
|
202
|
+
@failure_message = error.message
|
203
|
+
false
|
144
204
|
end
|
145
205
|
end
|
146
206
|
end
|