radius-spec 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/bin/bundle +114 -0
- data/common_rubocop.yml +16 -1
- data/common_rubocop_rails.yml +40 -3
- data/lib/radius/spec/model_factory.rb +9 -0
- data/lib/radius/spec/version.rb +1 -1
- data/radius-spec.gemspec +2 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8cf443a1c6510d208f4c05e3411461e850d11243ddfb8c72403cd6ad5cf42bb
|
4
|
+
data.tar.gz: b3eb1c7facabda9825bda8fd5d112e61bb9f356dabb0924846e103dda307633b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c9172e6e540bc8826a5ba39084c7a26fbccace68c54445dc9ed67c07228ed83044be16547fd1ec4524fbe649cf000f384a0f430928a79c903a9ba2389ea3f47
|
7
|
+
data.tar.gz: 7a1903a1749717032feeea5f02c171e48173ea16a5bbc1f6ec5a3e487462aa47be3608906954d10f37d4526768e614c4ea5a023cf1b75fa9ca76e27e902d961d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1
|
+
## 0.10.0 (October 18, 2021)
|
2
|
+
|
3
|
+
[Full Changelog](https://github.com/RadiusNetworks/radius-spec/compare/v0.9.0...v0.10.0)
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
- Upgrade to Rubocop Rails 2.8.x (Aaron Hill, Aaron Kromer, Ben Reynolds, James Nebeker, JC Avena, Sam Kim, Alex
|
8
|
+
Stone #30, #32)
|
9
|
+
- Adjust common Rubocop Rails configuration (Aaron Hill, Aaron Kromer, Ben Reynolds, James Nebeker, JC Avena,
|
10
|
+
Sam Kim, Alex Stone #30, #32)
|
11
|
+
- Enable `Rails/AttributeDefaultBlockValue` by default
|
12
|
+
- Enable `Rails/ArelStar` by default
|
13
|
+
- Enable `Rails/DefaultScope` by default
|
14
|
+
- Enable `Rails/FindById` by default
|
15
|
+
- Enable `Rails/PluckId` by default
|
16
|
+
- Enable `Rails/WhereEquals` by default
|
17
|
+
- Use the more aggressive `aggressive` check for `Rails/PluckInWhere`
|
18
|
+
- Use the more aggressive `aggressive` check for `Rails/ShortI18n`
|
19
|
+
- Switch to new `AllowedMethods` attribute name for `Rails/SkipsModelValidations`
|
20
|
+
- Disable `Rails/SquishedSQLHeredocs` by default
|
21
|
+
- Adjust common Rubocop configuration (Aaron Hill, Aaron Kromer, JC Avena, Sam
|
22
|
+
Kim #32, #34)
|
23
|
+
- Enable `Style/ClassMethodsDefinitions` by default
|
24
|
+
- Enable `Style/CombinableLoops` by default
|
25
|
+
- Enable `Style/KeywordParametersOrder` by default
|
26
|
+
- Enable `Style/RedundantSelfAssignment` by default
|
27
|
+
- Enable `Style/SoleNestedConditional` by default
|
28
|
+
- Enable `Lint/DuplicateRequire` by default
|
29
|
+
- Enable `Lint/EmptyFile` by default
|
30
|
+
- Enable `Lint/TrailingCommaInAttributeDeclaration` by default
|
31
|
+
- Enable `Lint/UselessMethodDefinition` by default
|
32
|
+
- Exclude the following testing methods from `Metrics/BlockLength`
|
33
|
+
- 'describe'
|
34
|
+
- 'shared_context'
|
35
|
+
- 'shared_examples'
|
36
|
+
- 'RSpec.describe'
|
37
|
+
- 'RSpec.shared_context'
|
38
|
+
- 'RSpec.shared_examples'
|
39
|
+
|
40
|
+
### Bug Fixes
|
41
|
+
|
42
|
+
None
|
43
|
+
|
44
|
+
|
1
45
|
## 0.9.0 (September 30, 2021)
|
2
46
|
|
3
47
|
[Full Changelog](https://github.com/RadiusNetworks/radius-spec/compare/v0.8.0...v0.9.0)
|
data/bin/bundle
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling do
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
end
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling do
|
95
|
+
require "bundler/version"
|
96
|
+
end
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|
data/common_rubocop.yml
CHANGED
@@ -4,7 +4,7 @@ AllCops:
|
|
4
4
|
# version by version without having to worry about adding an entry for each
|
5
5
|
# new "enabled by default" check. If we want to jump multiple versions and
|
6
6
|
# wish to be notified of all the enw check, then we'll need to change
|
7
|
-
# `NewCops` to `pending
|
7
|
+
# `NewCops` to `pending`.
|
8
8
|
NewCops: enable
|
9
9
|
Exclude:
|
10
10
|
# Exclude generated binstubs
|
@@ -217,9 +217,15 @@ Metrics/BlockLength:
|
|
217
217
|
- 'spec/support/model_factories.rb'
|
218
218
|
ExcludedMethods:
|
219
219
|
- 'chdir'
|
220
|
+
- 'describe'
|
220
221
|
- 'refine'
|
222
|
+
- 'shared_context'
|
223
|
+
- 'shared_examples'
|
221
224
|
- 'Capybara.register_driver'
|
222
225
|
- 'RSpec.configure'
|
226
|
+
- 'RSpec.describe'
|
227
|
+
- 'RSpec.shared_context'
|
228
|
+
- 'RSpec.shared_examples'
|
223
229
|
- 'VCR.configure'
|
224
230
|
|
225
231
|
# We want length related code metrics to count Hashs, Arrays, and
|
@@ -395,6 +401,15 @@ Style/BlockDelimiters:
|
|
395
401
|
- proc
|
396
402
|
- it
|
397
403
|
|
404
|
+
# As a team we prefer the more explicit `def self.method_name` style. We find
|
405
|
+
# the explicitness easier to read and grep for on the CLI.
|
406
|
+
#
|
407
|
+
# Configuration parameters: EnforcedStyle.
|
408
|
+
# SupportedStyles: def_self, self_class
|
409
|
+
Style/ClassMethodsDefinitions:
|
410
|
+
Enabled: true
|
411
|
+
EnforcedStyle: def_self
|
412
|
+
|
398
413
|
# Prefer `Time` over `DateTime`.
|
399
414
|
#
|
400
415
|
# While these are not necessarily interchangeable we prefer `Time`. According
|
data/common_rubocop_rails.yml
CHANGED
@@ -106,6 +106,11 @@ Rails/ApplicationRecord:
|
|
106
106
|
Rails/CreateTableWithTimestamps:
|
107
107
|
Enabled: false
|
108
108
|
|
109
|
+
# This cop looks for uses of default_scope because named scopes are preferred:
|
110
|
+
# https://rails.rubystyle.guide/#named-scopes
|
111
|
+
Rails/DefaultScope:
|
112
|
+
Enabled: true
|
113
|
+
|
109
114
|
# Usage of `find_by` is more expressive of intent than `where.first`. We should
|
110
115
|
# check all app code, not just the models to improve intent expression.
|
111
116
|
#
|
@@ -119,6 +124,11 @@ Rails/FindBy:
|
|
119
124
|
- 'app/**/*.rb'
|
120
125
|
- 'lib/**/*.rb'
|
121
126
|
|
127
|
+
# This cop enforces that ActiveRecord#find is used instead of where.take!, find_by!, and find_by_id!
|
128
|
+
# to retrieve a single record by primary key when you expect it to be found.
|
129
|
+
Rails/FindById:
|
130
|
+
Enabled: true
|
131
|
+
|
122
132
|
# Usage of `each` for large datasets can be a performance issue; specially a
|
123
133
|
# drain on system memory. When possible it's better to use `find_each` so that
|
124
134
|
# chunks of data are evaluated at a time.
|
@@ -174,6 +184,21 @@ Rails/IndexBy:
|
|
174
184
|
Rails/IndexWith:
|
175
185
|
Enabled: false
|
176
186
|
|
187
|
+
# This cop enforces the use of ids over pluck(:id) and pluck(primary_key).
|
188
|
+
# https://rails.rubystyle.guide/#ids
|
189
|
+
Rails/PluckId:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
# This cop identifies places where pluck is used in where query methods and can be replaced with
|
193
|
+
# select. Since pluck is an eager method and hits the database immediately, using select helps to
|
194
|
+
# avoid additional database queries.
|
195
|
+
#
|
196
|
+
# When the EnforcedStyle is aggressive then all calls to pluck in the where is used as offenses.
|
197
|
+
# This may lead to false positives as the cop cannot replace to select between calls to pluck on an
|
198
|
+
# ActiveRecord::Relation instance vs a call to pluck on an Array instance.
|
199
|
+
Rails/PluckInWhere:
|
200
|
+
EnforcedStyle: aggressive
|
201
|
+
|
177
202
|
# The ActiveSupport monkey patches for `present?` are nearly all defined as:
|
178
203
|
#
|
179
204
|
# !blank?
|
@@ -234,6 +259,13 @@ Rails/ReadWriteAttribute:
|
|
234
259
|
Rails/SaveBang:
|
235
260
|
Enabled: true
|
236
261
|
|
262
|
+
# This cop enforces that short forms of I18n methods are used: t instead of translate and l instead
|
263
|
+
# of localize. We want this because it's a pain to use the full method names over and over in view
|
264
|
+
# code. When the EnforcedStyle is aggressive then all translate and localize calls without a
|
265
|
+
# receiver are added as offenses.
|
266
|
+
Rails/ShortI18n:
|
267
|
+
EnforcedStyle: aggressive
|
268
|
+
|
237
269
|
# According to the Rails docs while the following methods skip validations they
|
238
270
|
# only update the specified (single) attribute reducing risks. We'd rather not
|
239
271
|
# warn for those cases:
|
@@ -251,14 +283,19 @@ Rails/SaveBang:
|
|
251
283
|
# - http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html
|
252
284
|
# - http://api.rubyonrails.org/classes/ActiveRecord/Relation.html
|
253
285
|
#
|
254
|
-
# Configuration parameters:
|
255
|
-
#
|
286
|
+
# Configuration parameters: ForbiddenMethods, AllowedMethods.
|
287
|
+
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
256
288
|
Rails/SkipsModelValidations:
|
257
|
-
|
289
|
+
AllowedMethods:
|
258
290
|
- 'decrement!'
|
259
291
|
- 'increment!'
|
260
292
|
- 'touch'
|
261
293
|
|
294
|
+
# We don't want to be forced to use squish in SQL or JSON heredocs (especially
|
295
|
+
# in specs).
|
296
|
+
Rails/SquishedSQLHeredocs:
|
297
|
+
Enabled: false
|
298
|
+
|
262
299
|
# Rails uses compact style by default so we're disabling this with a :hammer:
|
263
300
|
# for things likely to be generated by Rails (i.e. most things in app).
|
264
301
|
#
|
@@ -110,6 +110,14 @@ module Radius
|
|
110
110
|
class TemplateNotFound < KeyError; end
|
111
111
|
|
112
112
|
class << self
|
113
|
+
# rubocop:disable Style/ClassMethodsDefinitions
|
114
|
+
# Style Note: We are using this class method style because we need to
|
115
|
+
# call `alias_method` within this module's singleton class context.
|
116
|
+
# Ruby did not introduce access to `singleton_class` until 2.7. Once we
|
117
|
+
# drop support for Ruby < 2.7 we can switch styles and use:
|
118
|
+
#
|
119
|
+
# singleton_class.alias_method :factory, :define_factory
|
120
|
+
|
113
121
|
# Suggested method for defining multiple factory templates at once.
|
114
122
|
#
|
115
123
|
# Most projects end up having many domain models which need factories
|
@@ -283,6 +291,7 @@ module Radius
|
|
283
291
|
def templates
|
284
292
|
@templates ||= {}
|
285
293
|
end
|
294
|
+
# rubocop:enable Style/ClassMethodsDefinitions
|
286
295
|
end
|
287
296
|
|
288
297
|
module_function
|
data/lib/radius/spec/version.rb
CHANGED
data/radius-spec.gemspec
CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.required_ruby_version = ">= 2.5" # rubocop:disable Gemspec/RequiredRubyVersion
|
32
32
|
|
33
33
|
spec.add_runtime_dependency "rspec", "~> 3.7"
|
34
|
-
spec.add_runtime_dependency "rubocop", "~> 0.
|
35
|
-
spec.add_runtime_dependency "rubocop-rails", "~> 2.
|
34
|
+
spec.add_runtime_dependency "rubocop", "~> 0.90.0"
|
35
|
+
spec.add_runtime_dependency "rubocop-rails", "~> 2.9.1"
|
36
36
|
|
37
37
|
spec.add_development_dependency "bundler", ">= 2.2.10"
|
38
38
|
spec.add_development_dependency "rake", ">= 12.0", "< 14.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radius-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radius Networks
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -31,28 +31,28 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 0.90.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
41
|
+
version: 0.90.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rubocop-rails
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 2.
|
48
|
+
version: 2.9.1
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
55
|
+
version: 2.9.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: bundler
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- benchmarks/style_hash_like_case.rb
|
127
127
|
- benchmarks/unfreeze_string.rb
|
128
128
|
- benchmarks/unpack_first.rb
|
129
|
+
- bin/bundle
|
129
130
|
- bin/ci
|
130
131
|
- bin/console
|
131
132
|
- bin/pry
|
@@ -150,8 +151,8 @@ licenses:
|
|
150
151
|
- Apache-2.0
|
151
152
|
metadata:
|
152
153
|
bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
|
153
|
-
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.
|
154
|
-
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.
|
154
|
+
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.10.0/CHANGELOG.md
|
155
|
+
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.10.0
|
155
156
|
post_install_message:
|
156
157
|
rdoc_options: []
|
157
158
|
require_paths:
|
@@ -167,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
requirements: []
|
170
|
-
rubygems_version: 3.1.
|
171
|
+
rubygems_version: 3.1.6
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Radius Networks RSpec setup and plug-ins
|