radius-spec 0.1.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 +7 -0
- data/.gitignore +37 -0
- data/.rspec +1 -0
- data/.rubocop.yml +10 -0
- data/.travis.yml +12 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +26 -0
- data/LICENSE.txt +201 -0
- data/README.md +474 -0
- data/Rakefile +8 -0
- data/bin/ci +23 -0
- data/bin/console +12 -0
- data/bin/pry +29 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +8 -0
- data/bin/travis +29 -0
- data/bin/yard +29 -0
- data/common_rubocop.yml +290 -0
- data/common_rubocop_rails.yml +113 -0
- data/lib/radius/spec/model_factory.rb +472 -0
- data/lib/radius/spec/rails.rb +49 -0
- data/lib/radius/spec/rspec.rb +141 -0
- data/lib/radius/spec/version.rb +7 -0
- data/lib/radius/spec.rb +11 -0
- data/radius-spec.gemspec +32 -0
- metadata +115 -0
data/README.md
ADDED
@@ -0,0 +1,474 @@
|
|
1
|
+
# Common RSpec Setup and Plug-ins
|
2
|
+
|
3
|
+
[](https://travis-ci.org/RadiusNetworks/radius-spec)
|
4
|
+
[](https://codeclimate.com/github/RadiusNetworks/radius-spec/maintainability)
|
5
|
+
[](https://badge.fury.io/rb/radius-spec)
|
6
|
+
|
7
|
+
Basic RSpec setup and plug-ins for use with Radius Networks Ruby / Rails
|
8
|
+
projects.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'radius-spec'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
```console
|
21
|
+
$ bundle
|
22
|
+
```
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
```console
|
27
|
+
$ gem install radius-spec
|
28
|
+
```
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
If you do not already have a project `.rspec` file we suggest creating one with
|
33
|
+
at least the following:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
--require spec_helper
|
37
|
+
```
|
38
|
+
|
39
|
+
You _should_ check this `.rspec` file into version control. See the [RSpec
|
40
|
+
`Configuration` docs](https://rspec.info/documentation/3.7/rspec-core/RSpec/Core/Configuration.html)
|
41
|
+
and [Relish examples](https://relishapp.com/rspec/rspec-core/v/3-7/docs/configuration/read-command-line-configuration-options-from-files)
|
42
|
+
for more on loading configuration options.
|
43
|
+
|
44
|
+
To load the default suggested RSpec configuration, require this gem at the top
|
45
|
+
of your `spec/spec_helper.rb` file. After requiring the gem you can include any
|
46
|
+
custom RSpec configuration in a `RSpec.configure` block as usual:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# /spec/spec_helper.rb
|
50
|
+
# frozen_string_literal: true
|
51
|
+
|
52
|
+
require 'radius/spec'
|
53
|
+
|
54
|
+
RSpec.configure do |config|
|
55
|
+
# Your project specific custom settings here
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
For Rails apps, we suggest a similar approach to your Rails helper:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
# /spec/rails_helper.rb
|
63
|
+
# frozen_string_literal: true
|
64
|
+
|
65
|
+
require 'spec_helper'
|
66
|
+
ENV['RAILS_ENV'] ||= 'test'
|
67
|
+
require File.expand_path('../../config/environment', __FILE__)
|
68
|
+
# Prevent database truncation if the environment is production
|
69
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
70
|
+
require 'radius/spec/rails'
|
71
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
72
|
+
|
73
|
+
# Checks for pending migration and applies them before tests are run.
|
74
|
+
# If you are not using ActiveRecord, you can remove this line.
|
75
|
+
ActiveRecord::Migration.maintain_test_schema!
|
76
|
+
|
77
|
+
RSpec.configure do |config|
|
78
|
+
# Your project specific custom settings here
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
## Features
|
83
|
+
|
84
|
+
### Common Rubocop Config
|
85
|
+
|
86
|
+
Projects can inherit from the [base Rubocop config](.rubocop.yml) by using
|
87
|
+
either the remote raw URL or dependency gem formats:
|
88
|
+
|
89
|
+
```yaml
|
90
|
+
# Recommended Method
|
91
|
+
inherit_gem:
|
92
|
+
radius-spec:
|
93
|
+
- common_rubocop.yml
|
94
|
+
# Use the following instead if it is a Rails project
|
95
|
+
- common_rubocop_rails.yml
|
96
|
+
```
|
97
|
+
|
98
|
+
```yaml
|
99
|
+
# Available for projects which cannot include this gem (i.e. Ruby < 2.5)
|
100
|
+
inherit_from:
|
101
|
+
- https://raw.githubusercontent.com/RadiusNetworks/radius-spec/master/common_rubocop.yml
|
102
|
+
# Use the following instead if it is a Rails project
|
103
|
+
- https://raw.githubusercontent.com/RadiusNetworks/radius-spec/master/common_rubocop_rails.yml
|
104
|
+
```
|
105
|
+
|
106
|
+
When using the raw URL you may need to add the following to the project's
|
107
|
+
`.gitignore` file:
|
108
|
+
|
109
|
+
```
|
110
|
+
.rubocop-https---raw-githubusercontent-com-RadiusNetworks-radius-spec-master-common-rubocop-rails-yml
|
111
|
+
.rubocop-https---raw-githubusercontent-com-RadiusNetworks-radius-spec-master-common-rubocop-yml
|
112
|
+
```
|
113
|
+
|
114
|
+
Be sure to include the project's local `.rubocop_todo.yml` **after** inheriting
|
115
|
+
the base configuration so that they take precedence. Also, use the directive
|
116
|
+
`inherit_mode` to specify which array configurations to merge together instead
|
117
|
+
of overriding the inherited value. This can be set both globally and for
|
118
|
+
specific cops:
|
119
|
+
|
120
|
+
```yaml
|
121
|
+
inherit_gem:
|
122
|
+
radius-spec:
|
123
|
+
- .rubocop.yml
|
124
|
+
# Use the following instead if it is a Rails project
|
125
|
+
- .rubocop_rails.yml
|
126
|
+
inherit_from: .rubocop_todo.yml
|
127
|
+
|
128
|
+
inherit_mode:
|
129
|
+
merge:
|
130
|
+
- Exclude
|
131
|
+
|
132
|
+
Style/For:
|
133
|
+
inherit_mode:
|
134
|
+
override:
|
135
|
+
- Exclude
|
136
|
+
Exclude:
|
137
|
+
- bar.rb
|
138
|
+
```
|
139
|
+
|
140
|
+
Consult the [Rubocop documentation](https://rubocop.readthedocs.io/en/latest/configuration/#inheriting-configuration-from-a-remote-url)
|
141
|
+
for the most up-to-date syntax for including the [.rubocop.yml](.rubocop.yml)
|
142
|
+
config.
|
143
|
+
|
144
|
+
### Basic Model Factory
|
145
|
+
|
146
|
+
This factory is **not** Rails specific. It works for any object type that
|
147
|
+
responds to `new` with a hash of attributes or keywords; including `Struct`
|
148
|
+
using the new Ruby 2.5 `keyword_init` flag.
|
149
|
+
|
150
|
+
#### Defining Factory Templates
|
151
|
+
|
152
|
+
You can use the model factory directly to define a factory template:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
require 'radius/spec/model_factory'
|
156
|
+
|
157
|
+
Radius::Spec::ModelFactory.define_factory(
|
158
|
+
"AnyClass",
|
159
|
+
attr1: :any_value,
|
160
|
+
attr2: :another_value,
|
161
|
+
)
|
162
|
+
```
|
163
|
+
|
164
|
+
Most projects end up needing to specify multiple factories. Having to reference
|
165
|
+
the full module every time you want to define a factory is tedious. When you
|
166
|
+
need to define multiple factories we recommended using the factory catalog:
|
167
|
+
|
168
|
+
```ruby
|
169
|
+
require 'radius/spec/model_factory'
|
170
|
+
|
171
|
+
Radius::Spec::ModelFactory.catalog do |c|
|
172
|
+
c.factory "AnyClass", attr1: :any_value, attr2: :another_value
|
173
|
+
|
174
|
+
c.factory "AnotherClass",
|
175
|
+
attr1: :any_value,
|
176
|
+
attr2: :another_value,
|
177
|
+
attr3: %i[any list of values]
|
178
|
+
end
|
179
|
+
```
|
180
|
+
|
181
|
+
##### Storing Factory Templates
|
182
|
+
|
183
|
+
Our convention is to store all of a project's factory templates in the file
|
184
|
+
`spec/support/model_factories.rb`. As this is our convention, when the model
|
185
|
+
factory is required it will attempt to load this file automatically as a
|
186
|
+
convenience.
|
187
|
+
|
188
|
+
##### Lazy Class Loading
|
189
|
+
|
190
|
+
When testing in isolation we often don't want to wait a long time for a lot of
|
191
|
+
unnecessary project/app code to load. With that in mind we want to keep loading
|
192
|
+
the model factory and all factory templates as fast as possible. This mean not
|
193
|
+
loading the associated project/app code at factory template definition time.
|
194
|
+
This way if you only need one or two factories your remaining domain model code
|
195
|
+
won't be loaded.
|
196
|
+
|
197
|
+
To utilize this lazy loading define your template using either a string or
|
198
|
+
symbol class name:
|
199
|
+
|
200
|
+
```ruby
|
201
|
+
Radius::Spec::ModelFactory.catalog do |c|
|
202
|
+
c.factory :AnyClass, attr1: :any_value, attr2: :another_value
|
203
|
+
|
204
|
+
c.factory "AnotherClass",
|
205
|
+
attr1: :any_value,
|
206
|
+
attr2: :another_value,
|
207
|
+
attr3: %i[any list of values]
|
208
|
+
|
209
|
+
c.factory "Nested::Module::SomeClass", attr1: :any_value
|
210
|
+
end
|
211
|
+
```
|
212
|
+
|
213
|
+
The only requirement for this feature is that the class must be loaded by the
|
214
|
+
project/app, or it uses an auto-loading mechanism, by the time the first
|
215
|
+
instance is built by the factory.
|
216
|
+
|
217
|
+
Also, this still supports defining the factory template using the class
|
218
|
+
constant so no changes need to be made if that's your preference.
|
219
|
+
|
220
|
+
##### Template Attribute Keys
|
221
|
+
|
222
|
+
Attribute keys may be defined using either strings or symbols. However, they
|
223
|
+
will be stored internally as symbols. This means that when an object instance
|
224
|
+
is create using the factory the attribute hash will be provided to `new` with
|
225
|
+
symbol keys.
|
226
|
+
|
227
|
+
##### Dynamic Attribute Values (i.e. Generators)
|
228
|
+
|
229
|
+
We try to keep the special cases / rules to a minimum. To support dynamic
|
230
|
+
attributes we need to special case templates which define a `Proc` for an
|
231
|
+
attribute value. For any template attribute which has a `Proc` for a value
|
232
|
+
making an instance through the factory will send `call` to the proc with no
|
233
|
+
args.
|
234
|
+
|
235
|
+
> _NOTE: This only applies to instances of `Proc`. If you define a template
|
236
|
+
> value with another object which responds to `call` that object will be set as
|
237
|
+
> the attribute value without receiving `call`._
|
238
|
+
|
239
|
+
You can use this to define generators in a number of ways:
|
240
|
+
|
241
|
+
```ruby
|
242
|
+
Radius::Spec::ModelFactory.catalog do |c|
|
243
|
+
# This is not thread safe.
|
244
|
+
gid_counter = 0
|
245
|
+
usually_gid_generator = -> { gid_counter += 1 }
|
246
|
+
|
247
|
+
c.factory :AnyClass,
|
248
|
+
gid: usually_gid_counter,
|
249
|
+
temp: -> { rand(0..100) }
|
250
|
+
|
251
|
+
c.factory "AnotherClass",
|
252
|
+
gid: usually_gid_counter,
|
253
|
+
uuid: -> { SecureRandom.uuid }
|
254
|
+
end
|
255
|
+
```
|
256
|
+
|
257
|
+
> _NOTE: As of Ruby 2.5 `-> {}`, `lambda {}`, `proc {}`, and `Proc.new` are all
|
258
|
+
> instances of `Proc`._
|
259
|
+
|
260
|
+
While this is a powerful technique we suggest keeping it's use to a minimum.
|
261
|
+
There's a lot of benefit to generative, mutation, and fuzzy testing. We just
|
262
|
+
aren't convinced it should be the default when you generate unit / general
|
263
|
+
integration test data.
|
264
|
+
|
265
|
+
##### Self Documenting Attributes
|
266
|
+
|
267
|
+
Factory templates may use the special symbols `:optional` and `:required` as a
|
268
|
+
means of self documenting attributes. These are meant as descriptive
|
269
|
+
placeholders for developers reading the factory definition. Any template
|
270
|
+
attribute with a value of `:optional`, which is not overwritten by a custom
|
271
|
+
value, will be removed just prior to building a new instance.
|
272
|
+
|
273
|
+
Those attributes marked as `:required` will not be removed. Instead the symbol
|
274
|
+
`:required` will be set as the attribute's value if it isn't overwritten by the
|
275
|
+
custom data. This way, if it's considered an invalid, it will helpfully produce
|
276
|
+
a more descriptive error message. And if it's considered a valid value, will
|
277
|
+
provide some contextual information when used else where.
|
278
|
+
|
279
|
+
For Rails projects, we suggest using `:required` for any association that is
|
280
|
+
necessary for the object to be valid. We do not recommend attempting to
|
281
|
+
generate default records within the factory as this can lead to unexpected
|
282
|
+
database state; and hide relevant information away from the specs which may
|
283
|
+
depend on it.
|
284
|
+
|
285
|
+
##### "Safe" Attribute Duplication
|
286
|
+
|
287
|
+
In an effort to help limit accidental state leak between instances the factory
|
288
|
+
will duplicate all non-frozen template values prior to building the instance.
|
289
|
+
Duplication is only applied to the values registered for the templates. Custom
|
290
|
+
values provided when building the instance are not duplicated.
|
291
|
+
|
292
|
+
#### Usage
|
293
|
+
|
294
|
+
There are multiple ways you can build object instances using the model factory.
|
295
|
+
Which method you choose depends on how much perceived magic/syntactic sugar you
|
296
|
+
want:
|
297
|
+
|
298
|
+
- Call the model factory directly to instantiate instances:
|
299
|
+
|
300
|
+
```ruby
|
301
|
+
require 'radius/spec/model_factory'
|
302
|
+
|
303
|
+
Radius::Spec::ModelFactory.define_factory "AnyClass", name: "Any Name"
|
304
|
+
|
305
|
+
AnyClass = Struct.new(:name, keyword_init: true)
|
306
|
+
|
307
|
+
default_instance = Radius::Spec::ModelFactory.build("AnyClass")
|
308
|
+
# => #<struct AnyClass name="Any Name">
|
309
|
+
|
310
|
+
default_instance.name
|
311
|
+
# => "Any Name"
|
312
|
+
|
313
|
+
custom_instance = Radius::Spec::ModelFactory.build(
|
314
|
+
:AnyClass,
|
315
|
+
name: "Any Custom Name",
|
316
|
+
)
|
317
|
+
# => #<struct AnyClass name="Any Custom Name">
|
318
|
+
|
319
|
+
custom_instance.name
|
320
|
+
# => "Any Custom Name"
|
321
|
+
```
|
322
|
+
|
323
|
+
- Include the factory helper methods explicitly:
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
require 'radius/spec/model_factory'
|
327
|
+
|
328
|
+
RSpec.describe AnyClass do
|
329
|
+
include Radius::Spec::ModelFactory
|
330
|
+
|
331
|
+
it "includes the factory helpers" do
|
332
|
+
an_object = build(AnyClass)
|
333
|
+
expect(an_object.name).to eq "Any Name"
|
334
|
+
end
|
335
|
+
end
|
336
|
+
```
|
337
|
+
|
338
|
+
- Include the factory helpers via metadata:
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
RSpec.describe AnyClass, :model_factory do
|
342
|
+
it "includes the factory helpers" do
|
343
|
+
an_object = build("AnyClass")
|
344
|
+
expect(an_object.name).to eq "Any Name"
|
345
|
+
end
|
346
|
+
end
|
347
|
+
```
|
348
|
+
|
349
|
+
When using this metadata option you do not need to explicitly require the
|
350
|
+
model factory feature. This gem registers metadata with the RSpec
|
351
|
+
configuration when it loads and `RSpec` is defined. When the metadata is
|
352
|
+
first used it will automatically require the model factory feature and
|
353
|
+
include the helpers.
|
354
|
+
|
355
|
+
Any of following metadata will include the factory helpers:
|
356
|
+
|
357
|
+
- `:model_factory`
|
358
|
+
- `:model_factories`
|
359
|
+
- `type: :controller`
|
360
|
+
- `type: :feature`
|
361
|
+
- `type: :job`
|
362
|
+
- `type: :model`
|
363
|
+
- `type: :request`
|
364
|
+
- `type: :system`
|
365
|
+
|
366
|
+
There are a few behaviors to note for using the builder:
|
367
|
+
|
368
|
+
- the class constant or fully qualified class name as a string (or symbol)
|
369
|
+
may be provided to the builder
|
370
|
+
|
371
|
+
This mirrors how defining the factory behaves.
|
372
|
+
|
373
|
+
- custom attribute values provided to the builder will replace any of the
|
374
|
+
registered defaults in the template
|
375
|
+
|
376
|
+
- new attributes not defined in the template may be included in the custom
|
377
|
+
attributes
|
378
|
+
|
379
|
+
These new attributes will be included with the other attributes and passed
|
380
|
+
to `new`.
|
381
|
+
|
382
|
+
- unlike the registered template attributes, all custom attributes (even
|
383
|
+
those that replace the registered attributes) are not modified or
|
384
|
+
duplicated in any way
|
385
|
+
|
386
|
+
This means if you provide an array or hash as an attribute value those
|
387
|
+
exact instances will be sent to `new`. Additionally, if you provide a
|
388
|
+
`Proc` as an attribute value it will be sent to new directly without
|
389
|
+
receiving `call`.
|
390
|
+
|
391
|
+
##### Optional Block
|
392
|
+
|
393
|
+
Both `build` and `create` support providing an optional block. This block is
|
394
|
+
passed directly to `new` when creating the object. This is to support the
|
395
|
+
common Ruby idiom of yielding `self` within initialize:
|
396
|
+
|
397
|
+
```ruby
|
398
|
+
class AnyClass
|
399
|
+
def initialize(attrs = {})
|
400
|
+
# setup attrs
|
401
|
+
yield self if block_given?
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
RSpec.describe AnyClass, :model_factory do
|
406
|
+
it "passes the block to the object initializer" do
|
407
|
+
block_capture = nil
|
408
|
+
an_object = build("AnyClass") { |instance| block_capture = instance }
|
409
|
+
expect(block_capture).to be an_object
|
410
|
+
end
|
411
|
+
end
|
412
|
+
```
|
413
|
+
|
414
|
+
Since Ruby always supports passing a block to a method, even if the method does
|
415
|
+
not use the block, it's possible the block will not run if the class being
|
416
|
+
instantiated does not do anything with it.
|
417
|
+
|
418
|
+
Also, while the common idiom is to `yield self` classes are free to yield
|
419
|
+
anything. You need to be aware of how the class normally behaves when using
|
420
|
+
this feature.
|
421
|
+
|
422
|
+
##### "Creating" Instances
|
423
|
+
|
424
|
+
We suggest that you create instances using the following syntax:
|
425
|
+
|
426
|
+
```ruby
|
427
|
+
created_instance = build("AnyClass").tap(&:save!)
|
428
|
+
```
|
429
|
+
|
430
|
+
Or alternatively:
|
431
|
+
|
432
|
+
```ruby
|
433
|
+
let(:an_instance) { build("AnyClass") }
|
434
|
+
|
435
|
+
before do
|
436
|
+
an_instance.save!
|
437
|
+
end
|
438
|
+
```
|
439
|
+
|
440
|
+
This way it is explicit what objects need to be persisted and in what order.
|
441
|
+
|
442
|
+
However, many of our existing projects use a legacy `create` helper. This is
|
443
|
+
simply a wrapper around `build.tap(&:save!)`, but it supports omitting the
|
444
|
+
`save!` call for objects which do not support it.
|
445
|
+
|
446
|
+
```ruby
|
447
|
+
created_instance = create("AnyClass")
|
448
|
+
```
|
449
|
+
|
450
|
+
## Development
|
451
|
+
|
452
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
453
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
454
|
+
prompt that will allow you to experiment.
|
455
|
+
|
456
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
457
|
+
release a new version, update the version number in `version.rb`, and then run
|
458
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
459
|
+
git commits and tags, and push the `.gem` file to
|
460
|
+
[rubygems.org](https://rubygems.org).
|
461
|
+
|
462
|
+
## Contributing
|
463
|
+
|
464
|
+
Bug reports and pull requests are welcome on GitHub at
|
465
|
+
https://github.com/RadiusNetworks/radius-spec. This project is intended to be a
|
466
|
+
safe, welcoming space for collaboration, and contributors are expected to
|
467
|
+
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
468
|
+
conduct.
|
469
|
+
|
470
|
+
## Code of Conduct
|
471
|
+
|
472
|
+
Everyone interacting in the Radius::Spec project’s codebases, issue trackers,
|
473
|
+
chat rooms and mailing lists is expected to follow the [code of
|
474
|
+
conduct](https://github.com/RadiusNetworks/radius-spec/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/ci
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# bin/ci: Setup environment for CI to run tests. This is primarily designed to
|
4
|
+
# run on the continuous integration server.
|
5
|
+
|
6
|
+
set -e
|
7
|
+
cd "$(dirname "$0")/.."
|
8
|
+
echo "Current Working Dir: $(pwd)"
|
9
|
+
|
10
|
+
# Run the specs for the rails app
|
11
|
+
echo " ---> Running specs"
|
12
|
+
bin/rspec
|
13
|
+
|
14
|
+
# Script for running bundle audits
|
15
|
+
# bundle-audit provides patch-level verification for Bundler
|
16
|
+
# https://github.com/rubysec/bundler-audit.
|
17
|
+
echo " ---> Running bundler-audit"
|
18
|
+
gem install --no-rdoc --no-ri bundler-audit
|
19
|
+
bundle-audit check --update
|
20
|
+
|
21
|
+
# Run style checker
|
22
|
+
echo " ---> Running rubocop"
|
23
|
+
bin/rubocop --extra-details --display-style-guide
|
data/bin/console
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "radius/spec"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
require "pry-byebug"
|
12
|
+
Pry.start
|
data/bin/pry
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'pry' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("pry", "pry")
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bin/setup
ADDED
data/bin/travis
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'travis' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("travis", "travis")
|