shoulda-context 2.0.0 → 3.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/.github/workflows/ci.yml +47 -0
- data/.github/workflows/dynamic-readme.yml +17 -0
- data/.github/workflows/rubocop.yml +30 -0
- data/.rubocop.yml +3 -1
- data/.rubocop_todo.yml +338 -0
- data/.ruby-version +1 -1
- data/Appraisals +28 -75
- data/CHANGELOG.md +50 -0
- data/Gemfile.lock +2 -2
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/MAINTAINING.md +104 -0
- data/README.md +60 -26
- data/bin/supported_ruby_versions +3 -3
- data/exe/convert_to_should_syntax +1 -1
- data/gemfiles/rails_6_0.gemfile.lock +148 -125
- data/gemfiles/{rails_5_1.gemfile → rails_6_1.gemfile} +17 -14
- data/gemfiles/rails_6_1.gemfile.lock +306 -0
- data/lib/shoulda/context/context.rb +16 -6
- data/lib/shoulda/context/dsl.rb +8 -6
- data/lib/shoulda/context/version.rb +1 -1
- data/lib/shoulda/context.rb +0 -1
- data/test/shoulda/helpers_test.rb +2 -4
- data/test/shoulda/rerun_snippet_test.rb +29 -10
- data/test/shoulda/should_test.rb +1 -1
- data/test/shoulda/test_framework_detection_test.rb +0 -24
- metadata +14 -35
- data/.hound.yml +0 -3
- data/.travis.yml +0 -37
- data/CONTRIBUTING.md +0 -38
- data/gemfiles/rails_4_2.gemfile +0 -35
- data/gemfiles/rails_4_2.gemfile.lock +0 -234
- data/gemfiles/rails_5_0.gemfile +0 -33
- data/gemfiles/rails_5_0.gemfile.lock +0 -226
- data/gemfiles/rails_5_1.gemfile.lock +0 -242
- data/gemfiles/rails_5_2.gemfile +0 -36
- data/gemfiles/rails_5_2.gemfile.lock +0 -261
- data/lib/shoulda/context/rails_test_unit_reporter_patch.rb +0 -21
@@ -3,32 +3,35 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
+
gem "bcrypt", "~> 3.1.7"
|
7
|
+
gem "bootsnap", ">= 1.4.2", require: false
|
6
8
|
gem "bundler", "~> 1.0"
|
7
9
|
gem "byebug"
|
10
|
+
gem "capybara", ">= 2.15"
|
11
|
+
gem "jbuilder", "~> 2.7"
|
12
|
+
gem "listen", ">= 3.0.5", "< 3.2"
|
8
13
|
gem "m"
|
9
14
|
gem "minitest"
|
15
|
+
gem "minitest-reporters"
|
10
16
|
gem "mocha"
|
17
|
+
gem "pg", ">= 0.18", "< 2.0"
|
11
18
|
gem "pry", "~> 0.12.0"
|
12
19
|
gem "pry-byebug", "~> 3.6.0"
|
20
|
+
gem "puma", "~> 5.0"
|
21
|
+
gem "rails", "~> 6.1.3.2"
|
22
|
+
gem "rails-controller-testing", ">= 1.0.4"
|
13
23
|
gem "rake"
|
14
24
|
gem "rubocop", "0.71.0"
|
25
|
+
gem "sass-rails", ">= 6"
|
26
|
+
gem "selenium-webdriver"
|
15
27
|
gem "snowglobe", ">= 0.3.0"
|
16
|
-
gem "test-unit"
|
17
|
-
gem "warnings_logger"
|
18
|
-
gem "sqlite3", "~> 1.3.6"
|
19
28
|
gem "spring"
|
20
29
|
gem "spring-commands-rspec"
|
21
|
-
gem "minitest-reporters"
|
22
|
-
gem "rails", "~> 5.1.6"
|
23
|
-
gem "rails-controller-testing", ">= 1.0.1"
|
24
|
-
gem "puma", "~> 3.7"
|
25
|
-
gem "sass-rails", "~> 5.0"
|
26
|
-
gem "turbolinks", "~> 5"
|
27
|
-
gem "jbuilder", "~> 2.5"
|
28
|
-
gem "bcrypt", "~> 3.1.7"
|
29
|
-
gem "capybara", "~> 2.13"
|
30
|
-
gem "selenium-webdriver"
|
31
|
-
gem "listen", ">= 3.0.5", "< 3.2"
|
32
30
|
gem "spring-watcher-listen", "~> 2.0.0"
|
31
|
+
gem "sqlite3", "~> 1.4.0"
|
32
|
+
gem "test-unit"
|
33
|
+
gem "turbolinks", "~> 5"
|
34
|
+
gem "warnings_logger"
|
35
|
+
gem "webdrivers"
|
33
36
|
|
34
37
|
gemspec path: "../"
|
@@ -0,0 +1,306 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
shoulda-context (2.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actioncable (6.1.3.2)
|
10
|
+
actionpack (= 6.1.3.2)
|
11
|
+
activesupport (= 6.1.3.2)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailbox (6.1.3.2)
|
15
|
+
actionpack (= 6.1.3.2)
|
16
|
+
activejob (= 6.1.3.2)
|
17
|
+
activerecord (= 6.1.3.2)
|
18
|
+
activestorage (= 6.1.3.2)
|
19
|
+
activesupport (= 6.1.3.2)
|
20
|
+
mail (>= 2.7.1)
|
21
|
+
actionmailer (6.1.3.2)
|
22
|
+
actionpack (= 6.1.3.2)
|
23
|
+
actionview (= 6.1.3.2)
|
24
|
+
activejob (= 6.1.3.2)
|
25
|
+
activesupport (= 6.1.3.2)
|
26
|
+
mail (~> 2.5, >= 2.5.4)
|
27
|
+
rails-dom-testing (~> 2.0)
|
28
|
+
actionpack (6.1.3.2)
|
29
|
+
actionview (= 6.1.3.2)
|
30
|
+
activesupport (= 6.1.3.2)
|
31
|
+
rack (~> 2.0, >= 2.0.9)
|
32
|
+
rack-test (>= 0.6.3)
|
33
|
+
rails-dom-testing (~> 2.0)
|
34
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
+
actiontext (6.1.3.2)
|
36
|
+
actionpack (= 6.1.3.2)
|
37
|
+
activerecord (= 6.1.3.2)
|
38
|
+
activestorage (= 6.1.3.2)
|
39
|
+
activesupport (= 6.1.3.2)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
actionview (6.1.3.2)
|
42
|
+
activesupport (= 6.1.3.2)
|
43
|
+
builder (~> 3.1)
|
44
|
+
erubi (~> 1.4)
|
45
|
+
rails-dom-testing (~> 2.0)
|
46
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
+
activejob (6.1.3.2)
|
48
|
+
activesupport (= 6.1.3.2)
|
49
|
+
globalid (>= 0.3.6)
|
50
|
+
activemodel (6.1.3.2)
|
51
|
+
activesupport (= 6.1.3.2)
|
52
|
+
activerecord (6.1.3.2)
|
53
|
+
activemodel (= 6.1.3.2)
|
54
|
+
activesupport (= 6.1.3.2)
|
55
|
+
activestorage (6.1.3.2)
|
56
|
+
actionpack (= 6.1.3.2)
|
57
|
+
activejob (= 6.1.3.2)
|
58
|
+
activerecord (= 6.1.3.2)
|
59
|
+
activesupport (= 6.1.3.2)
|
60
|
+
marcel (~> 1.0.0)
|
61
|
+
mini_mime (~> 1.0.2)
|
62
|
+
activesupport (6.1.3.2)
|
63
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
64
|
+
i18n (>= 1.6, < 2)
|
65
|
+
minitest (>= 5.1)
|
66
|
+
tzinfo (~> 2.0)
|
67
|
+
zeitwerk (~> 2.3)
|
68
|
+
addressable (2.8.4)
|
69
|
+
public_suffix (>= 2.0.2, < 6.0)
|
70
|
+
ansi (1.5.0)
|
71
|
+
appraisal (2.5.0)
|
72
|
+
bundler
|
73
|
+
rake
|
74
|
+
thor (>= 0.14.0)
|
75
|
+
ast (2.4.2)
|
76
|
+
bcrypt (3.1.19)
|
77
|
+
bootsnap (1.16.0)
|
78
|
+
msgpack (~> 1.2)
|
79
|
+
builder (3.2.4)
|
80
|
+
byebug (10.0.2)
|
81
|
+
capybara (3.39.2)
|
82
|
+
addressable
|
83
|
+
matrix
|
84
|
+
mini_mime (>= 0.1.3)
|
85
|
+
nokogiri (~> 1.8)
|
86
|
+
rack (>= 1.6.0)
|
87
|
+
rack-test (>= 0.6.3)
|
88
|
+
regexp_parser (>= 1.5, < 3.0)
|
89
|
+
xpath (~> 3.2)
|
90
|
+
coderay (1.1.3)
|
91
|
+
concurrent-ruby (1.2.2)
|
92
|
+
crass (1.0.6)
|
93
|
+
date (3.3.3)
|
94
|
+
erubi (1.12.0)
|
95
|
+
ffi (1.15.5)
|
96
|
+
globalid (1.1.0)
|
97
|
+
activesupport (>= 5.0)
|
98
|
+
i18n (1.14.1)
|
99
|
+
concurrent-ruby (~> 1.0)
|
100
|
+
jaro_winkler (1.5.6)
|
101
|
+
jbuilder (2.11.5)
|
102
|
+
actionview (>= 5.0.0)
|
103
|
+
activesupport (>= 5.0.0)
|
104
|
+
listen (3.1.5)
|
105
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
106
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
107
|
+
ruby_dep (~> 1.2)
|
108
|
+
loofah (2.21.3)
|
109
|
+
crass (~> 1.0.2)
|
110
|
+
nokogiri (>= 1.12.0)
|
111
|
+
m (1.6.1)
|
112
|
+
method_source (>= 0.6.7)
|
113
|
+
rake (>= 0.9.2.2)
|
114
|
+
mail (2.8.1)
|
115
|
+
mini_mime (>= 0.1.1)
|
116
|
+
net-imap
|
117
|
+
net-pop
|
118
|
+
net-smtp
|
119
|
+
marcel (1.0.2)
|
120
|
+
matrix (0.4.2)
|
121
|
+
method_source (0.9.2)
|
122
|
+
mini_mime (1.0.3)
|
123
|
+
mini_portile2 (2.8.2)
|
124
|
+
minitest (5.18.1)
|
125
|
+
minitest-reporters (1.6.0)
|
126
|
+
ansi
|
127
|
+
builder
|
128
|
+
minitest (>= 5.0)
|
129
|
+
ruby-progressbar
|
130
|
+
mocha (2.0.4)
|
131
|
+
ruby2_keywords (>= 0.0.5)
|
132
|
+
msgpack (1.7.1)
|
133
|
+
net-imap (0.3.6)
|
134
|
+
date
|
135
|
+
net-protocol
|
136
|
+
net-pop (0.1.2)
|
137
|
+
net-protocol
|
138
|
+
net-protocol (0.2.1)
|
139
|
+
timeout
|
140
|
+
net-smtp (0.3.3)
|
141
|
+
net-protocol
|
142
|
+
nio4r (2.5.9)
|
143
|
+
nokogiri (1.15.3)
|
144
|
+
mini_portile2 (~> 2.8.2)
|
145
|
+
racc (~> 1.4)
|
146
|
+
parallel (1.23.0)
|
147
|
+
parser (3.2.2.3)
|
148
|
+
ast (~> 2.4.1)
|
149
|
+
racc
|
150
|
+
pg (1.5.3)
|
151
|
+
power_assert (2.0.3)
|
152
|
+
pry (0.12.2)
|
153
|
+
coderay (~> 1.1.0)
|
154
|
+
method_source (~> 0.9.0)
|
155
|
+
pry-byebug (3.6.0)
|
156
|
+
byebug (~> 10.0)
|
157
|
+
pry (~> 0.10)
|
158
|
+
public_suffix (5.0.3)
|
159
|
+
puma (5.6.6)
|
160
|
+
nio4r (~> 2.0)
|
161
|
+
racc (1.7.1)
|
162
|
+
rack (2.2.7)
|
163
|
+
rack-test (2.1.0)
|
164
|
+
rack (>= 1.3)
|
165
|
+
rails (6.1.3.2)
|
166
|
+
actioncable (= 6.1.3.2)
|
167
|
+
actionmailbox (= 6.1.3.2)
|
168
|
+
actionmailer (= 6.1.3.2)
|
169
|
+
actionpack (= 6.1.3.2)
|
170
|
+
actiontext (= 6.1.3.2)
|
171
|
+
actionview (= 6.1.3.2)
|
172
|
+
activejob (= 6.1.3.2)
|
173
|
+
activemodel (= 6.1.3.2)
|
174
|
+
activerecord (= 6.1.3.2)
|
175
|
+
activestorage (= 6.1.3.2)
|
176
|
+
activesupport (= 6.1.3.2)
|
177
|
+
bundler (>= 1.15.0)
|
178
|
+
railties (= 6.1.3.2)
|
179
|
+
sprockets-rails (>= 2.0.0)
|
180
|
+
rails-controller-testing (1.0.5)
|
181
|
+
actionpack (>= 5.0.1.rc1)
|
182
|
+
actionview (>= 5.0.1.rc1)
|
183
|
+
activesupport (>= 5.0.1.rc1)
|
184
|
+
rails-dom-testing (2.1.1)
|
185
|
+
activesupport (>= 5.0.0)
|
186
|
+
minitest
|
187
|
+
nokogiri (>= 1.6)
|
188
|
+
rails-html-sanitizer (1.6.0)
|
189
|
+
loofah (~> 2.21)
|
190
|
+
nokogiri (~> 1.14)
|
191
|
+
railties (6.1.3.2)
|
192
|
+
actionpack (= 6.1.3.2)
|
193
|
+
activesupport (= 6.1.3.2)
|
194
|
+
method_source
|
195
|
+
rake (>= 0.8.7)
|
196
|
+
thor (~> 1.0)
|
197
|
+
rainbow (3.1.1)
|
198
|
+
rake (13.0.6)
|
199
|
+
rb-fsevent (0.11.2)
|
200
|
+
rb-inotify (0.10.1)
|
201
|
+
ffi (~> 1.0)
|
202
|
+
regexp_parser (2.8.1)
|
203
|
+
rexml (3.2.5)
|
204
|
+
rubocop (0.71.0)
|
205
|
+
jaro_winkler (~> 1.5.1)
|
206
|
+
parallel (~> 1.10)
|
207
|
+
parser (>= 2.6)
|
208
|
+
rainbow (>= 2.2.2, < 4.0)
|
209
|
+
ruby-progressbar (~> 1.7)
|
210
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
211
|
+
ruby-progressbar (1.13.0)
|
212
|
+
ruby2_keywords (0.0.5)
|
213
|
+
ruby_dep (1.5.0)
|
214
|
+
rubyzip (2.3.2)
|
215
|
+
sass-rails (6.0.0)
|
216
|
+
sassc-rails (~> 2.1, >= 2.1.1)
|
217
|
+
sassc (2.4.0)
|
218
|
+
ffi (~> 1.9)
|
219
|
+
sassc-rails (2.1.2)
|
220
|
+
railties (>= 4.0.0)
|
221
|
+
sassc (>= 2.0)
|
222
|
+
sprockets (> 3.0)
|
223
|
+
sprockets-rails
|
224
|
+
tilt
|
225
|
+
selenium-webdriver (4.9.0)
|
226
|
+
rexml (~> 3.2, >= 3.2.5)
|
227
|
+
rubyzip (>= 1.2.2, < 3.0)
|
228
|
+
websocket (~> 1.0)
|
229
|
+
snowglobe (0.3.0)
|
230
|
+
spring (2.1.1)
|
231
|
+
spring-commands-rspec (1.0.4)
|
232
|
+
spring (>= 0.9.1)
|
233
|
+
spring-watcher-listen (2.0.1)
|
234
|
+
listen (>= 2.7, < 4.0)
|
235
|
+
spring (>= 1.2, < 3.0)
|
236
|
+
sprockets (4.2.0)
|
237
|
+
concurrent-ruby (~> 1.0)
|
238
|
+
rack (>= 2.2.4, < 4)
|
239
|
+
sprockets-rails (3.4.2)
|
240
|
+
actionpack (>= 5.2)
|
241
|
+
activesupport (>= 5.2)
|
242
|
+
sprockets (>= 3.0.0)
|
243
|
+
sqlite3 (1.4.4)
|
244
|
+
test-unit (3.6.1)
|
245
|
+
power_assert
|
246
|
+
thor (1.2.2)
|
247
|
+
tilt (2.2.0)
|
248
|
+
timeout (0.4.0)
|
249
|
+
turbolinks (5.2.1)
|
250
|
+
turbolinks-source (~> 5.2)
|
251
|
+
turbolinks-source (5.2.0)
|
252
|
+
tzinfo (2.0.6)
|
253
|
+
concurrent-ruby (~> 1.0)
|
254
|
+
unicode-display_width (1.6.1)
|
255
|
+
warnings_logger (0.1.1)
|
256
|
+
webdrivers (5.2.0)
|
257
|
+
nokogiri (~> 1.6)
|
258
|
+
rubyzip (>= 1.3.0)
|
259
|
+
selenium-webdriver (~> 4.0)
|
260
|
+
websocket (1.2.9)
|
261
|
+
websocket-driver (0.7.5)
|
262
|
+
websocket-extensions (>= 0.1.0)
|
263
|
+
websocket-extensions (0.1.5)
|
264
|
+
xpath (3.2.0)
|
265
|
+
nokogiri (~> 1.8)
|
266
|
+
zeitwerk (2.6.8)
|
267
|
+
|
268
|
+
PLATFORMS
|
269
|
+
ruby
|
270
|
+
|
271
|
+
DEPENDENCIES
|
272
|
+
appraisal
|
273
|
+
bcrypt (~> 3.1.7)
|
274
|
+
bootsnap (>= 1.4.2)
|
275
|
+
bundler (~> 1.0)
|
276
|
+
byebug
|
277
|
+
capybara (>= 2.15)
|
278
|
+
jbuilder (~> 2.7)
|
279
|
+
listen (>= 3.0.5, < 3.2)
|
280
|
+
m
|
281
|
+
minitest
|
282
|
+
minitest-reporters
|
283
|
+
mocha
|
284
|
+
pg (>= 0.18, < 2.0)
|
285
|
+
pry (~> 0.12.0)
|
286
|
+
pry-byebug (~> 3.6.0)
|
287
|
+
puma (~> 5.0)
|
288
|
+
rails (~> 6.1.3.2)
|
289
|
+
rails-controller-testing (>= 1.0.4)
|
290
|
+
rake
|
291
|
+
rubocop (= 0.71.0)
|
292
|
+
sass-rails (>= 6)
|
293
|
+
selenium-webdriver
|
294
|
+
shoulda-context!
|
295
|
+
snowglobe (>= 0.3.0)
|
296
|
+
spring
|
297
|
+
spring-commands-rspec
|
298
|
+
spring-watcher-listen (~> 2.0.0)
|
299
|
+
sqlite3 (~> 1.4.0)
|
300
|
+
test-unit
|
301
|
+
turbolinks (~> 5)
|
302
|
+
warnings_logger
|
303
|
+
webdrivers
|
304
|
+
|
305
|
+
BUNDLED WITH
|
306
|
+
1.17.3
|
@@ -56,10 +56,20 @@ module Shoulda
|
|
56
56
|
self.teardown_blocks << blk
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
class LambdaWithLocation < Proc
|
60
|
+
attr_reader :source_location
|
61
|
+
|
62
|
+
def initialize(source_location, &blk)
|
63
|
+
@source_location = source_location
|
64
|
+
super(&blk)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def should(name_or_matcher, options = {}, source_location = (loc = caller_locations(1, 1)[0]
|
69
|
+
[loc.path, loc.lineno]), &blk)
|
60
70
|
if name_or_matcher.respond_to?(:description) && name_or_matcher.respond_to?(:matches?)
|
61
71
|
name = name_or_matcher.description
|
62
|
-
blk = lambda { assert_accepts name_or_matcher, subject }
|
72
|
+
blk = LambdaWithLocation.new(source_location, &lambda { assert_accepts name_or_matcher, subject })
|
63
73
|
else
|
64
74
|
name = name_or_matcher
|
65
75
|
end
|
@@ -71,9 +81,10 @@ module Shoulda
|
|
71
81
|
end
|
72
82
|
end
|
73
83
|
|
74
|
-
def should_not(matcher)
|
84
|
+
def should_not(matcher, source_location = (loc = caller_locations(1, 1)[0]
|
85
|
+
[loc.path, loc.lineno]))
|
75
86
|
name = matcher.description
|
76
|
-
blk = lambda { assert_rejects matcher, subject }
|
87
|
+
blk = LambdaWithLocation.new(source_location, &lambda { assert_rejects matcher, subject })
|
77
88
|
self.shoulds << { :name => "not #{name}", :block => blk }
|
78
89
|
end
|
79
90
|
|
@@ -100,7 +111,7 @@ module Shoulda
|
|
100
111
|
|
101
112
|
def test_methods
|
102
113
|
@test_methods ||= Hash.new { |h,k|
|
103
|
-
h[k] =
|
114
|
+
h[k] = k.instance_methods.each_with_object({}) { |n, a| a[n] = true }
|
104
115
|
}
|
105
116
|
end
|
106
117
|
|
@@ -213,4 +224,3 @@ module Shoulda
|
|
213
224
|
class DuplicateTestError < RuntimeError; end
|
214
225
|
end
|
215
226
|
end
|
216
|
-
|
data/lib/shoulda/context/dsl.rb
CHANGED
@@ -61,13 +61,14 @@ module Shoulda
|
|
61
61
|
# should validate_presence_of(:first_name).with_message(/gotta be there/)
|
62
62
|
#
|
63
63
|
|
64
|
-
def should(name_or_matcher, options = {},
|
64
|
+
def should(name_or_matcher, options = {}, source_location = (loc = caller_locations(1, 1)[0]
|
65
|
+
[loc.path, loc.lineno]), &blk)
|
65
66
|
if Shoulda::Context.current_context
|
66
|
-
Shoulda::Context.current_context.should(name_or_matcher, options, &blk)
|
67
|
+
Shoulda::Context.current_context.should(name_or_matcher, options, source_location, &blk)
|
67
68
|
else
|
68
69
|
context_name = self.name.gsub(/Test$/, "") if name
|
69
70
|
context = Shoulda::Context::Context.new(context_name, self) do
|
70
|
-
should(name_or_matcher, options, &blk)
|
71
|
+
should(name_or_matcher, options, source_location, &blk)
|
71
72
|
end
|
72
73
|
context.build
|
73
74
|
end
|
@@ -80,13 +81,14 @@ module Shoulda
|
|
80
81
|
# === Example:
|
81
82
|
#
|
82
83
|
# should_not set_the_flash
|
83
|
-
def should_not(matcher)
|
84
|
+
def should_not(matcher, source_location = (loc = caller_locations(1, 1)[0]
|
85
|
+
[loc.path, loc.lineno]))
|
84
86
|
if Shoulda::Context.current_context
|
85
|
-
Shoulda::Context.current_context.should_not(matcher)
|
87
|
+
Shoulda::Context.current_context.should_not(matcher, source_location)
|
86
88
|
else
|
87
89
|
context_name = self.name.gsub(/Test$/, "") if name
|
88
90
|
context = Shoulda::Context::Context.new(context_name, self) do
|
89
|
-
should_not(matcher)
|
91
|
+
should_not(matcher, source_location)
|
90
92
|
end
|
91
93
|
context.build
|
92
94
|
end
|
data/lib/shoulda/context.rb
CHANGED
@@ -125,10 +125,8 @@ class HelpersTest < PARENT_TEST_CASE
|
|
125
125
|
|
126
126
|
context "when given to assert_accepts" do
|
127
127
|
setup do
|
128
|
-
|
129
|
-
|
130
|
-
rescue ASSERTION_CLASS => @error
|
131
|
-
end
|
128
|
+
assert_accepts @matcher, 'target'
|
129
|
+
rescue ASSERTION_CLASS => @error
|
132
130
|
end
|
133
131
|
|
134
132
|
should "fail" do
|
@@ -11,25 +11,44 @@ class RerunSnippetTest < PARENT_TEST_CASE
|
|
11
11
|
require_relative "../../config/environment"
|
12
12
|
|
13
13
|
class FailingTest < #{PARENT_TEST_CASE}
|
14
|
+
class FakeMatcher
|
15
|
+
attr_reader :subject
|
16
|
+
attr_accessor :fail
|
17
|
+
|
18
|
+
def description
|
19
|
+
"be a fake matcher"
|
20
|
+
end
|
21
|
+
|
22
|
+
def matches?(subject)
|
23
|
+
@subject = subject
|
24
|
+
!@fail
|
25
|
+
end
|
26
|
+
|
27
|
+
def failure_message
|
28
|
+
"positive failure message"
|
29
|
+
end
|
30
|
+
|
31
|
+
def failure_message_when_negated
|
32
|
+
"negative failure message"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
14
36
|
should "fail" do
|
15
37
|
assert false
|
16
38
|
end
|
39
|
+
|
40
|
+
should_not FakeMatcher.new.tap { |m| m.fail = false }
|
41
|
+
should FakeMatcher.new.tap { |m| m.fail = true }
|
17
42
|
end
|
18
43
|
RUBY
|
19
44
|
|
20
45
|
command_runner = app.run_n_unit_test_suite
|
21
46
|
|
22
|
-
|
23
|
-
if rails_version >= 6
|
24
|
-
"rails test test/models/failing_test.rb:5"
|
25
|
-
else
|
26
|
-
"bin/rails test test/models/failing_test.rb:5"
|
27
|
-
end
|
47
|
+
expected_executable = rails_version >= 6 ? "rails test" : "bin/rails test"
|
28
48
|
|
29
|
-
assert_includes(
|
30
|
-
|
31
|
-
|
32
|
-
)
|
49
|
+
assert_includes(command_runner.output, "#{expected_executable} test/models/failing_test.rb:27")
|
50
|
+
assert_includes(command_runner.output, "#{expected_executable} test/models/failing_test.rb:31")
|
51
|
+
assert_includes(command_runner.output, "#{expected_executable} test/models/failing_test.rb:32")
|
33
52
|
end
|
34
53
|
end
|
35
54
|
end
|
data/test/shoulda/should_test.rb
CHANGED
@@ -271,7 +271,7 @@ class ShouldTest < PARENT_TEST_CASE
|
|
271
271
|
|
272
272
|
def test_should_create_a_one_off_context_and_build_it_on_test_case_should
|
273
273
|
s = mock("test")
|
274
|
-
Shoulda::Context::Context.any_instance.expects(:should).with("rock", {}).returns(s)
|
274
|
+
Shoulda::Context::Context.any_instance.expects(:should).with("rock", {}, [__FILE__, __LINE__ + 2]).returns(s)
|
275
275
|
Shoulda::Context::Context.any_instance.expects(:build)
|
276
276
|
self.class.should "rock" do; end
|
277
277
|
end
|
@@ -2,30 +2,6 @@ require "test_helper"
|
|
2
2
|
require "tempfile"
|
3
3
|
|
4
4
|
class TestFrameworkDetectionTest < PARENT_TEST_CASE
|
5
|
-
if Tests::CurrentBundle.instance.current_appraisal == "rails_5_2"
|
6
|
-
should "detect Minitest 5.x w/ Rails 5.2" do
|
7
|
-
assert_integration_with_rails_and "Minitest::Test"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
if Tests::CurrentBundle.instance.current_appraisal == "rails_5_1"
|
12
|
-
should "detect Minitest 5.x w/ Rails 5.1" do
|
13
|
-
assert_integration_with_rails_and "Minitest::Test"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
if Tests::CurrentBundle.instance.current_appraisal == "rails_5_0"
|
18
|
-
should "detect Minitest 5.x w/ Rails 5.0" do
|
19
|
-
assert_integration_with_rails_and "Minitest::Test"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
if Tests::CurrentBundle.instance.current_appraisal == "rails_4_2"
|
24
|
-
should "detect ActiveSupport::TestCase and Minitest 4.x w/ Rails 4.2" do
|
25
|
-
assert_integration_with_rails_and "Minitest::Test"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
5
|
if TEST_FRAMEWORK == "minitest"
|
30
6
|
should "detect Minitest 5.x when it is loaded standalone" do
|
31
7
|
assert_integration_with "Minitest::Test", setup: <<-RUBY
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot, inc.
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: exe
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2024-04-23 00:00:00.000000000 Z
|
17
17
|
dependencies: []
|
18
18
|
description: Context framework extracted from Shoulda
|
19
19
|
email: support@thoughtbot.com
|
@@ -22,17 +22,19 @@ executables:
|
|
22
22
|
extensions: []
|
23
23
|
extra_rdoc_files: []
|
24
24
|
files:
|
25
|
+
- ".github/workflows/ci.yml"
|
26
|
+
- ".github/workflows/dynamic-readme.yml"
|
27
|
+
- ".github/workflows/rubocop.yml"
|
25
28
|
- ".gitignore"
|
26
|
-
- ".hound.yml"
|
27
29
|
- ".rubocop.yml"
|
30
|
+
- ".rubocop_todo.yml"
|
28
31
|
- ".ruby-version"
|
29
|
-
- ".travis.yml"
|
30
32
|
- Appraisals
|
31
33
|
- CHANGELOG.md
|
32
|
-
- CONTRIBUTING.md
|
33
34
|
- Gemfile
|
34
35
|
- Gemfile.lock
|
35
|
-
-
|
36
|
+
- LICENSE
|
37
|
+
- MAINTAINING.md
|
36
38
|
- README.md
|
37
39
|
- Rakefile
|
38
40
|
- bin/install_gems_in_all_appraisals
|
@@ -42,16 +44,10 @@ files:
|
|
42
44
|
- bin/update_gem_in_all_appraisals
|
43
45
|
- bin/update_gems_in_all_appraisals
|
44
46
|
- exe/convert_to_should_syntax
|
45
|
-
- gemfiles/rails_4_2.gemfile
|
46
|
-
- gemfiles/rails_4_2.gemfile.lock
|
47
|
-
- gemfiles/rails_5_0.gemfile
|
48
|
-
- gemfiles/rails_5_0.gemfile.lock
|
49
|
-
- gemfiles/rails_5_1.gemfile
|
50
|
-
- gemfiles/rails_5_1.gemfile.lock
|
51
|
-
- gemfiles/rails_5_2.gemfile
|
52
|
-
- gemfiles/rails_5_2.gemfile.lock
|
53
47
|
- gemfiles/rails_6_0.gemfile
|
54
48
|
- gemfiles/rails_6_0.gemfile.lock
|
49
|
+
- gemfiles/rails_6_1.gemfile
|
50
|
+
- gemfiles/rails_6_1.gemfile.lock
|
55
51
|
- lib/shoulda-context.rb
|
56
52
|
- lib/shoulda/context.rb
|
57
53
|
- lib/shoulda/context/assertions.rb
|
@@ -60,7 +56,6 @@ files:
|
|
60
56
|
- lib/shoulda/context/context.rb
|
61
57
|
- lib/shoulda/context/dsl.rb
|
62
58
|
- lib/shoulda/context/proc_extensions.rb
|
63
|
-
- lib/shoulda/context/rails_test_unit_reporter_patch.rb
|
64
59
|
- lib/shoulda/context/railtie.rb
|
65
60
|
- lib/shoulda/context/tasks.rb
|
66
61
|
- lib/shoulda/context/tasks/list_tests.rake
|
@@ -101,28 +96,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
96
|
version: '0'
|
102
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
98
|
requirements:
|
104
|
-
- - "
|
99
|
+
- - ">"
|
105
100
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
101
|
+
version: 1.3.1
|
107
102
|
requirements: []
|
108
|
-
rubygems_version: 3.1.
|
103
|
+
rubygems_version: 3.1.6
|
109
104
|
signing_key:
|
110
105
|
specification_version: 4
|
111
106
|
summary: Context framework extracted from Shoulda
|
112
|
-
test_files:
|
113
|
-
- test/fake_rails_root/test/shoulda_macros/custom_macro.rb
|
114
|
-
- test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb
|
115
|
-
- test/fake_rails_root/vendor/plugins/.keep
|
116
|
-
- test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb
|
117
|
-
- test/shoulda/autoload_macro_test.rb
|
118
|
-
- test/shoulda/context_test.rb
|
119
|
-
- test/shoulda/convert_to_should_syntax_test.rb
|
120
|
-
- test/shoulda/helpers_test.rb
|
121
|
-
- test/shoulda/railtie_test.rb
|
122
|
-
- test/shoulda/rerun_snippet_test.rb
|
123
|
-
- test/shoulda/should_test.rb
|
124
|
-
- test/shoulda/test_framework_detection_test.rb
|
125
|
-
- test/support/current_bundle.rb
|
126
|
-
- test/support/rails_application_with_shoulda_context.rb
|
127
|
-
- test/support/snowglobe.rb
|
128
|
-
- test/test_helper.rb
|
107
|
+
test_files: []
|
data/.hound.yml
DELETED