data_plane_api 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +6 -3
- data/Gemfile.lock +89 -60
- data/README.md +8 -1
- data/data_plane_api.gemspec +3 -1
- data/lib/data_plane_api/configuration.rb +51 -28
- data/lib/data_plane_api/server.rb +31 -36
- data/lib/data_plane_api/version.rb +1 -2
- data/lib/data_plane_api.rb +3 -3
- data/rbi/data_plane_api.rbi +135 -0
- data/sorbet/config +6 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/faraday.rbi +17 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/annotations/webmock.rbi +9 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +509 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +8 -0
- data/sorbet/rbi/gems/booleans@0.1.3.rbi +28 -0
- data/sorbet/rbi/gems/byebug@12.0.0.rbi +37 -0
- data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
- data/sorbet/rbi/gems/faraday-net_http@3.0.2.rbi +147 -0
- data/sorbet/rbi/gems/faraday@2.7.2.rbi +2519 -0
- data/sorbet/rbi/gems/hashdiff@1.1.2.rbi +353 -0
- data/sorbet/rbi/gems/json@2.10.2.rbi +2112 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +86 -0
- data/sorbet/rbi/gems/minitest@5.25.5.rbi +1547 -0
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
- data/sorbet/rbi/gems/public_suffix@6.0.1.rbi +936 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +160 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +3030 -0
- data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
- data/sorbet/rbi/gems/rubocop-espago@1.1.8.rbi +9 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
- data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +563 -0
- data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
- data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
- data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
- data/sorbet/rbi/shims/gems/faraday.rbi +21 -0
- data/sorbet/rbi/shims/gems/shoulda-context@2.0.0.rbi +15 -0
- data/sorbet/tapioca/config.yml +28 -0
- data/sorbet/tapioca/extensions/load_gem.rb +1 -0
- data/sorbet/tapioca/require.rb +6 -0
- metadata +72 -7
@@ -0,0 +1,9 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `ruby2_keywords` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem ruby2_keywords`.
|
6
|
+
|
7
|
+
|
8
|
+
# THIS IS AN EMPTY RBI FILE.
|
9
|
+
# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
|
@@ -0,0 +1,563 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `shoulda-context` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem shoulda-context`.
|
6
|
+
|
7
|
+
|
8
|
+
class Minitest::Test < ::Minitest::Runnable
|
9
|
+
include ::Shoulda::Context::DSL
|
10
|
+
include ::Shoulda::Context::Assertions
|
11
|
+
include ::Shoulda::Context::DSL::InstanceMethods
|
12
|
+
extend ::Shoulda::Context::DSL::ClassMethods
|
13
|
+
end
|
14
|
+
|
15
|
+
# Stolen straight from ActiveSupport
|
16
|
+
#
|
17
|
+
# source://shoulda-context//lib/shoulda/context/proc_extensions.rb#3
|
18
|
+
class Proc
|
19
|
+
# source://shoulda-context//lib/shoulda/context/proc_extensions.rb#4
|
20
|
+
def bind(object); end
|
21
|
+
end
|
22
|
+
|
23
|
+
# source://shoulda-context//lib/shoulda/context/autoload_macros.rb#1
|
24
|
+
module Shoulda
|
25
|
+
class << self
|
26
|
+
# Call autoload_macros when you want to load test macros automatically in a non-Rails
|
27
|
+
# project (it's done automatically for Rails projects).
|
28
|
+
# You don't need to specify ROOT/test/shoulda_macros explicitly. Your custom macros
|
29
|
+
# are loaded automatically when you call autoload_macros.
|
30
|
+
#
|
31
|
+
# The first argument is the path to you application's root directory.
|
32
|
+
# All following arguments are directories relative to your root, which contain
|
33
|
+
# shoulda_macros subdirectories. These directories support the same kinds of globs as the
|
34
|
+
# Dir class.
|
35
|
+
#
|
36
|
+
# Basic usage (from a test_helper):
|
37
|
+
# Shoulda.autoload_macros(File.dirname(__FILE__) + '/..')
|
38
|
+
# will load everything in
|
39
|
+
# - your_app/test/shoulda_macros
|
40
|
+
#
|
41
|
+
# To load vendored macros as well:
|
42
|
+
# Shoulda.autoload_macros(APP_ROOT, 'vendor/*')
|
43
|
+
# will load everything in
|
44
|
+
# - APP_ROOT/vendor/*/shoulda_macros
|
45
|
+
# - APP_ROOT/test/shoulda_macros
|
46
|
+
#
|
47
|
+
# To load macros in an app with a vendor directory laid out like Rails':
|
48
|
+
# Shoulda.autoload_macros(APP_ROOT, 'vendor/{plugins,gems}/*')
|
49
|
+
# or
|
50
|
+
# Shoulda.autoload_macros(APP_ROOT, 'vendor/plugins/*', 'vendor/gems/*')
|
51
|
+
# will load everything in
|
52
|
+
# - APP_ROOT/vendor/plugins/*/shoulda_macros
|
53
|
+
# - APP_ROOT/vendor/gems/*/shoulda_macros
|
54
|
+
# - APP_ROOT/test/shoulda_macros
|
55
|
+
#
|
56
|
+
# If you prefer to stick testing dependencies away from your production dependencies:
|
57
|
+
# Shoulda.autoload_macros(APP_ROOT, 'vendor/*', 'test/vendor/*')
|
58
|
+
# will load everything in
|
59
|
+
# - APP_ROOT/vendor/*/shoulda_macros
|
60
|
+
# - APP_ROOT/test/vendor/*/shoulda_macros
|
61
|
+
# - APP_ROOT/test/shoulda_macros
|
62
|
+
#
|
63
|
+
# source://shoulda-context//lib/shoulda/context/autoload_macros.rb#38
|
64
|
+
def autoload_macros(root, *dirs); end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# source://shoulda-context//lib/shoulda/context/configuration.rb#2
|
69
|
+
module Shoulda::Context
|
70
|
+
class << self
|
71
|
+
# source://shoulda-context//lib/shoulda/context/world.rb#13
|
72
|
+
def add_context(context); end
|
73
|
+
|
74
|
+
# @yield [_self]
|
75
|
+
# @yieldparam _self [Shoulda::Context] the object that the method was called on
|
76
|
+
#
|
77
|
+
# source://shoulda-context//lib/shoulda/context/configuration.rb#3
|
78
|
+
def configure; end
|
79
|
+
|
80
|
+
# source://shoulda-context//lib/shoulda/context/world.rb#4
|
81
|
+
def contexts; end
|
82
|
+
|
83
|
+
# Sets the attribute contexts
|
84
|
+
#
|
85
|
+
# @param value the value to set the attribute contexts to.
|
86
|
+
#
|
87
|
+
# source://shoulda-context//lib/shoulda/context/world.rb#7
|
88
|
+
def contexts=(_arg0); end
|
89
|
+
|
90
|
+
# source://shoulda-context//lib/shoulda/context/world.rb#9
|
91
|
+
def current_context; end
|
92
|
+
|
93
|
+
# source://shoulda-context//lib/shoulda/context/configuration.rb#13
|
94
|
+
def extend(mod); end
|
95
|
+
|
96
|
+
# source://shoulda-context//lib/shoulda/context/configuration.rb#7
|
97
|
+
def include(mod); end
|
98
|
+
|
99
|
+
# source://shoulda-context//lib/shoulda/context/world.rb#17
|
100
|
+
def remove_context; end
|
101
|
+
|
102
|
+
# source://shoulda-context//lib/shoulda/context/test_framework_detection.rb#29
|
103
|
+
def test_framework_test_cases; end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#3
|
108
|
+
module Shoulda::Context::Assertions
|
109
|
+
# Asserts that the given matcher returns true when +target+ is passed to
|
110
|
+
# #matches?
|
111
|
+
#
|
112
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#50
|
113
|
+
def assert_accepts(matcher, target, options = T.unsafe(nil)); end
|
114
|
+
|
115
|
+
# Asserts that the given collection contains item x. If x is a regular expression, ensure that
|
116
|
+
# at least one element from the collection matches x. +extra_msg+ is appended to the error message if the assertion fails.
|
117
|
+
#
|
118
|
+
# assert_contains(['a', '1'], /\d/) => passes
|
119
|
+
# assert_contains(['a', '1'], 'a') => passes
|
120
|
+
# assert_contains(['a', '1'], /not there/) => fails
|
121
|
+
#
|
122
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#24
|
123
|
+
def assert_contains(collection, x, extra_msg = T.unsafe(nil)); end
|
124
|
+
|
125
|
+
# Asserts that the given collection does not contain item x. If x is a regular expression, ensure that
|
126
|
+
# none of the elements from the collection match x.
|
127
|
+
#
|
128
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#37
|
129
|
+
def assert_does_not_contain(collection, x, extra_msg = T.unsafe(nil)); end
|
130
|
+
|
131
|
+
# Asserts that the given matcher returns true when +target+ is passed to
|
132
|
+
# #does_not_match? or false when +target+ is passed to #matches? if
|
133
|
+
# #does_not_match? is not implemented
|
134
|
+
#
|
135
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#68
|
136
|
+
def assert_rejects(matcher, target, options = T.unsafe(nil)); end
|
137
|
+
|
138
|
+
# Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered.
|
139
|
+
#
|
140
|
+
# assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes)
|
141
|
+
#
|
142
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#7
|
143
|
+
def assert_same_elements(a1, a2, msg = T.unsafe(nil)); end
|
144
|
+
|
145
|
+
# source://shoulda-context//lib/shoulda/context/assertions.rb#90
|
146
|
+
def safe_assert_block(message = T.unsafe(nil), &block); end
|
147
|
+
end
|
148
|
+
|
149
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#3
|
150
|
+
class Shoulda::Context::Context
|
151
|
+
# @return [Context] a new instance of Context
|
152
|
+
#
|
153
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#19
|
154
|
+
def initialize(name, parent, &blk); end
|
155
|
+
|
156
|
+
# @return [Boolean]
|
157
|
+
#
|
158
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#93
|
159
|
+
def am_subcontext?; end
|
160
|
+
|
161
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#190
|
162
|
+
def build; end
|
163
|
+
|
164
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#142
|
165
|
+
def build_test_name_from(should); end
|
166
|
+
|
167
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#47
|
168
|
+
def context(name, &blk); end
|
169
|
+
|
170
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#107
|
171
|
+
def create_test_from_should_hash(should); end
|
172
|
+
|
173
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#88
|
174
|
+
def full_name; end
|
175
|
+
|
176
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#38
|
177
|
+
def merge_block(&blk); end
|
178
|
+
|
179
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#208
|
180
|
+
def method_missing(method, *args, &blk); end
|
181
|
+
|
182
|
+
# my name
|
183
|
+
#
|
184
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#4
|
185
|
+
def name; end
|
186
|
+
|
187
|
+
# my name
|
188
|
+
#
|
189
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#4
|
190
|
+
def name=(_arg0); end
|
191
|
+
|
192
|
+
# may be another context, or the original test::unit class.
|
193
|
+
#
|
194
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#5
|
195
|
+
def parent; end
|
196
|
+
|
197
|
+
# may be another context, or the original test::unit class.
|
198
|
+
#
|
199
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#5
|
200
|
+
def parent=(_arg0); end
|
201
|
+
|
202
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#183
|
203
|
+
def print_should_eventuallys; end
|
204
|
+
|
205
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#151
|
206
|
+
def run_all_setup_blocks(binding); end
|
207
|
+
|
208
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#171
|
209
|
+
def run_all_teardown_blocks(binding); end
|
210
|
+
|
211
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#160
|
212
|
+
def run_current_setup_blocks(binding); end
|
213
|
+
|
214
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#156
|
215
|
+
def run_parent_setup_blocks(binding); end
|
216
|
+
|
217
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#51
|
218
|
+
def setup(&blk); end
|
219
|
+
|
220
|
+
# blocks given via setup methods
|
221
|
+
#
|
222
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#7
|
223
|
+
def setup_blocks; end
|
224
|
+
|
225
|
+
# blocks given via setup methods
|
226
|
+
#
|
227
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#7
|
228
|
+
def setup_blocks=(_arg0); end
|
229
|
+
|
230
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#59
|
231
|
+
def should(name_or_matcher, options = T.unsafe(nil), &blk); end
|
232
|
+
|
233
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#80
|
234
|
+
def should_eventually(name, &blk); end
|
235
|
+
|
236
|
+
# array of hashes representing the should eventually statements
|
237
|
+
#
|
238
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#10
|
239
|
+
def should_eventuallys; end
|
240
|
+
|
241
|
+
# array of hashes representing the should eventually statements
|
242
|
+
#
|
243
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#10
|
244
|
+
def should_eventuallys=(_arg0); end
|
245
|
+
|
246
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#74
|
247
|
+
def should_not(matcher); end
|
248
|
+
|
249
|
+
# array of hashes representing the should statements
|
250
|
+
#
|
251
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#9
|
252
|
+
def shoulds; end
|
253
|
+
|
254
|
+
# array of hashes representing the should statements
|
255
|
+
#
|
256
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#9
|
257
|
+
def shoulds=(_arg0); end
|
258
|
+
|
259
|
+
# array of contexts nested under myself
|
260
|
+
#
|
261
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#6
|
262
|
+
def subcontexts; end
|
263
|
+
|
264
|
+
# array of contexts nested under myself
|
265
|
+
#
|
266
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#6
|
267
|
+
def subcontexts=(_arg0); end
|
268
|
+
|
269
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#84
|
270
|
+
def subject(&block); end
|
271
|
+
|
272
|
+
# accessor with cache
|
273
|
+
#
|
274
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#13
|
275
|
+
def subject_block; end
|
276
|
+
|
277
|
+
# Sets the attribute subject_block
|
278
|
+
#
|
279
|
+
# @param value the value to set the attribute subject_block to.
|
280
|
+
#
|
281
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#17
|
282
|
+
def subject_block=(_arg0); end
|
283
|
+
|
284
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#55
|
285
|
+
def teardown(&blk); end
|
286
|
+
|
287
|
+
# blocks given via teardown methods
|
288
|
+
#
|
289
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#8
|
290
|
+
def teardown_blocks; end
|
291
|
+
|
292
|
+
# blocks given via teardown methods
|
293
|
+
#
|
294
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#8
|
295
|
+
def teardown_blocks=(_arg0); end
|
296
|
+
|
297
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#101
|
298
|
+
def test_methods; end
|
299
|
+
|
300
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#200
|
301
|
+
def test_name_prefix; end
|
302
|
+
|
303
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#97
|
304
|
+
def test_unit_class; end
|
305
|
+
end
|
306
|
+
|
307
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#5
|
308
|
+
module Shoulda::Context::DSL
|
309
|
+
include ::Shoulda::Context::Assertions
|
310
|
+
include ::Shoulda::Context::DSL::InstanceMethods
|
311
|
+
|
312
|
+
mixes_in_class_methods ::Shoulda::Context::DSL::ClassMethods
|
313
|
+
|
314
|
+
class << self
|
315
|
+
# @private
|
316
|
+
#
|
317
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#6
|
318
|
+
def included(base); end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#14
|
323
|
+
module Shoulda::Context::DSL::ClassMethods
|
324
|
+
# == Before statements
|
325
|
+
#
|
326
|
+
# Before statements are should statements that run before the current
|
327
|
+
# context's setup. These are especially useful when setting expectations.
|
328
|
+
#
|
329
|
+
# === Example:
|
330
|
+
#
|
331
|
+
# class UserControllerTest < Test::Unit::TestCase
|
332
|
+
# context "the index action" do
|
333
|
+
# setup do
|
334
|
+
# @users = [Factory(:user)]
|
335
|
+
# User.stubs(:find).returns(@users)
|
336
|
+
# end
|
337
|
+
#
|
338
|
+
# context "on GET" do
|
339
|
+
# setup { get :index }
|
340
|
+
#
|
341
|
+
# should respond_with(:success)
|
342
|
+
#
|
343
|
+
# # runs before "get :index"
|
344
|
+
# before_should "find all users" do
|
345
|
+
# User.expects(:find).with(:all).returns(@users)
|
346
|
+
# end
|
347
|
+
# end
|
348
|
+
# end
|
349
|
+
# end
|
350
|
+
#
|
351
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#121
|
352
|
+
def before_should(name, &blk); end
|
353
|
+
|
354
|
+
# == Contexts
|
355
|
+
#
|
356
|
+
# A context block groups should statements under a common set of setup/teardown methods.
|
357
|
+
# Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability
|
358
|
+
# and readability of your test code.
|
359
|
+
#
|
360
|
+
# A context block can contain setup, should, should_eventually, and teardown blocks.
|
361
|
+
#
|
362
|
+
# class UserTest < Test::Unit::TestCase
|
363
|
+
# context "A User instance" do
|
364
|
+
# setup do
|
365
|
+
# @user = User.find(:first)
|
366
|
+
# end
|
367
|
+
#
|
368
|
+
# should "return its full name"
|
369
|
+
# assert_equal 'John Doe', @user.full_name
|
370
|
+
# end
|
371
|
+
# end
|
372
|
+
# end
|
373
|
+
#
|
374
|
+
# This code will produce the method <tt>"test: A User instance should return its full name. "</tt>.
|
375
|
+
#
|
376
|
+
# Contexts may be nested. Nested contexts run their setup blocks from out to in before each
|
377
|
+
# should statement. They then run their teardown blocks from in to out after each should statement.
|
378
|
+
#
|
379
|
+
# class UserTest < Test::Unit::TestCase
|
380
|
+
# context "A User instance" do
|
381
|
+
# setup do
|
382
|
+
# @user = User.find(:first)
|
383
|
+
# end
|
384
|
+
#
|
385
|
+
# should "return its full name"
|
386
|
+
# assert_equal 'John Doe', @user.full_name
|
387
|
+
# end
|
388
|
+
#
|
389
|
+
# context "with a profile" do
|
390
|
+
# setup do
|
391
|
+
# @user.profile = Profile.find(:first)
|
392
|
+
# end
|
393
|
+
#
|
394
|
+
# should "return true when sent :has_profile?"
|
395
|
+
# assert @user.has_profile?
|
396
|
+
# end
|
397
|
+
# end
|
398
|
+
# end
|
399
|
+
# end
|
400
|
+
#
|
401
|
+
# This code will produce the following methods
|
402
|
+
# * <tt>"test: A User instance should return its full name. "</tt>
|
403
|
+
# * <tt>"test: A User instance with a profile should return true when sent :has_profile?. "</tt>
|
404
|
+
#
|
405
|
+
# <b>Just like should statements, a context block can exist next to normal <tt>def test_the_old_way; end</tt>
|
406
|
+
# tests</b>. This means you do not have to fully commit to the context/should syntax in a test file.
|
407
|
+
#
|
408
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#188
|
409
|
+
def context(name, &blk); end
|
410
|
+
|
411
|
+
# Returns the class being tested, as determined by the test class name.
|
412
|
+
#
|
413
|
+
# class UserTest; described_type; end
|
414
|
+
# # => User
|
415
|
+
#
|
416
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#201
|
417
|
+
def described_type; end
|
418
|
+
|
419
|
+
# == Should statements
|
420
|
+
#
|
421
|
+
# Should statements are just syntactic sugar over normal Test::Unit test
|
422
|
+
# methods. A should block contains all the normal code and assertions
|
423
|
+
# you're used to seeing, with the added benefit that they can be wrapped
|
424
|
+
# inside context blocks (see below).
|
425
|
+
#
|
426
|
+
# === Example:
|
427
|
+
#
|
428
|
+
# class UserTest < Test::Unit::TestCase
|
429
|
+
#
|
430
|
+
# def setup
|
431
|
+
# @user = User.new("John", "Doe")
|
432
|
+
# end
|
433
|
+
#
|
434
|
+
# should "return its full name"
|
435
|
+
# assert_equal 'John Doe', @user.full_name
|
436
|
+
# end
|
437
|
+
#
|
438
|
+
# end
|
439
|
+
#
|
440
|
+
# ...will produce the following test:
|
441
|
+
# * <tt>"test: User should return its full name. "</tt>
|
442
|
+
#
|
443
|
+
# Note: The part before <tt>should</tt> in the test name is gleamed from the name of the Test::Unit class.
|
444
|
+
#
|
445
|
+
# Should statements can also take a Proc as a <tt>:before </tt>option. This proc runs after any
|
446
|
+
# parent context's setups but before the current context's setup.
|
447
|
+
#
|
448
|
+
# === Example:
|
449
|
+
#
|
450
|
+
# context "Some context" do
|
451
|
+
# setup { puts("I run after the :before proc") }
|
452
|
+
#
|
453
|
+
# should "run a :before proc", :before => lambda { puts("I run before the setup") } do
|
454
|
+
# assert true
|
455
|
+
# end
|
456
|
+
# end
|
457
|
+
#
|
458
|
+
# Should statements can also wrap matchers, making virtually any matcher
|
459
|
+
# usable in a macro style. The matcher's description is used to generate a
|
460
|
+
# test name and failure message, and the test will pass if the matcher
|
461
|
+
# matches the subject.
|
462
|
+
#
|
463
|
+
# === Example:
|
464
|
+
#
|
465
|
+
# should validate_presence_of(:first_name).with_message(/gotta be there/)
|
466
|
+
#
|
467
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#64
|
468
|
+
def should(name_or_matcher, options = T.unsafe(nil), &blk); end
|
469
|
+
|
470
|
+
# Just like should, but never runs, and instead prints an 'X' in the Test::Unit output.
|
471
|
+
#
|
472
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#126
|
473
|
+
def should_eventually(name, options = T.unsafe(nil), &blk); end
|
474
|
+
|
475
|
+
# Allows negative tests using matchers. The matcher's description is used
|
476
|
+
# to generate a test name and negative failure message, and the test will
|
477
|
+
# pass unless the matcher matches the subject.
|
478
|
+
#
|
479
|
+
# === Example:
|
480
|
+
#
|
481
|
+
# should_not set_the_flash
|
482
|
+
#
|
483
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#83
|
484
|
+
def should_not(matcher); end
|
485
|
+
|
486
|
+
# Sets the return value of the subject instance method:
|
487
|
+
#
|
488
|
+
# class UserTest < Test::Unit::TestCase
|
489
|
+
# subject { User.first }
|
490
|
+
#
|
491
|
+
# # uses the existing user
|
492
|
+
# should validate_uniqueness_of(:email)
|
493
|
+
# end
|
494
|
+
#
|
495
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#218
|
496
|
+
def subject(&block); end
|
497
|
+
|
498
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#222
|
499
|
+
def subject_block; end
|
500
|
+
end
|
501
|
+
|
502
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#227
|
503
|
+
module Shoulda::Context::DSL::InstanceMethods
|
504
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#255
|
505
|
+
def get_instance_of(object_or_klass); end
|
506
|
+
|
507
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#263
|
508
|
+
def instance_variable_name_for(klass); end
|
509
|
+
|
510
|
+
# Returns an instance of the class under test.
|
511
|
+
#
|
512
|
+
# class UserTest
|
513
|
+
# should "be a user" do
|
514
|
+
# assert_kind_of User, subject # passes
|
515
|
+
# end
|
516
|
+
# end
|
517
|
+
#
|
518
|
+
# The subject can be explicitly set using the subject class method:
|
519
|
+
#
|
520
|
+
# class UserTest
|
521
|
+
# subject { User.first }
|
522
|
+
# should "be an existing user" do
|
523
|
+
# assert !subject.new_record? # uses the first user
|
524
|
+
# end
|
525
|
+
# end
|
526
|
+
#
|
527
|
+
# The subject is used by all macros that require an instance of the class
|
528
|
+
# being tested.
|
529
|
+
#
|
530
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#247
|
531
|
+
def subject; end
|
532
|
+
|
533
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#251
|
534
|
+
def subject_block; end
|
535
|
+
|
536
|
+
private
|
537
|
+
|
538
|
+
# source://shoulda-context//lib/shoulda/context/dsl.rb#269
|
539
|
+
def construct_subject; end
|
540
|
+
end
|
541
|
+
|
542
|
+
# source://shoulda-context//lib/shoulda/context/context.rb#213
|
543
|
+
class Shoulda::Context::DuplicateTestError < ::RuntimeError; end
|
544
|
+
|
545
|
+
# source://shoulda-context//lib/shoulda/context/test_framework_detection.rb#3
|
546
|
+
module Shoulda::Context::TestFrameworkDetection
|
547
|
+
class << self
|
548
|
+
# source://shoulda-context//lib/shoulda/context/test_framework_detection.rb#18
|
549
|
+
def detected_test_framework_test_cases; end
|
550
|
+
|
551
|
+
# source://shoulda-context//lib/shoulda/context/test_framework_detection.rb#4
|
552
|
+
def possible_test_frameworks; end
|
553
|
+
|
554
|
+
# source://shoulda-context//lib/shoulda/context/test_framework_detection.rb#12
|
555
|
+
def resolve_framework(future_framework); end
|
556
|
+
|
557
|
+
# source://shoulda-context//lib/shoulda/context/test_framework_detection.rb#24
|
558
|
+
def test_framework_test_cases; end
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
562
|
+
# source://shoulda-context//lib/shoulda/context/version.rb#3
|
563
|
+
Shoulda::Context::VERSION = T.let(T.unsafe(nil), String)
|