radius-spec 0.5.0 → 0.9.0
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 +28 -0
- data/.github/workflows/reviewdog.yml +21 -0
- data/.rubocop.yml +9 -5
- data/CHANGELOG.md +98 -0
- data/Gemfile +2 -3
- data/README.md +5 -6
- data/benchmarks/call_vs_yield.rb +33 -2
- data/benchmarks/casecmp_vs_downcase.rb +488 -0
- data/benchmarks/cover_vs_include.rb +2 -2
- data/benchmarks/format_string.rb +3 -3
- data/benchmarks/hash_each.rb +305 -0
- data/benchmarks/hash_merge.rb +1 -1
- data/benchmarks/hash_transform.rb +455 -0
- data/benchmarks/style_hash_like_case.rb +285 -0
- data/benchmarks/unfreeze_string.rb +0 -2
- data/bin/ci +1 -1
- data/common_rubocop.yml +166 -45
- data/common_rubocop_rails.yml +47 -20
- data/lib/radius/spec/model_factory.rb +0 -2
- data/lib/radius/spec/rspec.rb +9 -0
- data/lib/radius/spec/vcr.rb +0 -2
- data/lib/radius/spec/version.rb +1 -1
- data/radius-spec.gemspec +8 -7
- metadata +42 -19
- data/.travis.yml +0 -17
- data/bin/ci-code-review +0 -28
data/common_rubocop_rails.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require: rubocop-rails
|
2
|
+
|
1
3
|
inherit_mode:
|
2
4
|
merge:
|
3
5
|
- Exclude
|
@@ -5,10 +7,6 @@ inherit_mode:
|
|
5
7
|
|
6
8
|
inherit_from: common_rubocop.yml
|
7
9
|
|
8
|
-
# Enable additional Rails cops
|
9
|
-
Rails:
|
10
|
-
Enabled: true
|
11
|
-
|
12
10
|
AllCops:
|
13
11
|
Exclude:
|
14
12
|
- 'bin/puma'
|
@@ -22,24 +20,26 @@ AllCops:
|
|
22
20
|
- 'db/migrate/**/*'
|
23
21
|
|
24
22
|
# Rails project's are not concerned with API docs normally
|
25
|
-
Documentation:
|
23
|
+
Style/Documentation:
|
26
24
|
Enabled: false
|
27
25
|
|
28
|
-
Metrics/BlockLength:
|
29
|
-
Exclude:
|
30
|
-
- 'config/routes.rb'
|
31
|
-
- 'spec/rails_helper.rb'
|
32
|
-
|
33
26
|
# Rails foreign keys and indexes can get long. We want to ignore our annotation
|
34
27
|
# comments which are for these entries.
|
35
28
|
#
|
36
29
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
37
30
|
# URISchemes: http, https
|
38
|
-
|
31
|
+
Layout/LineLength:
|
39
32
|
IgnoredPatterns:
|
40
33
|
- '\A# fk_rails_'
|
41
34
|
- '\A# index_'
|
42
35
|
|
36
|
+
Metrics/BlockLength:
|
37
|
+
Exclude:
|
38
|
+
- 'bin/setup'
|
39
|
+
- 'bin/update'
|
40
|
+
- 'config/routes.rb'
|
41
|
+
- 'spec/rails_helper.rb'
|
42
|
+
|
43
43
|
# For our Rails apps several of them use the `respond_to` with `format` blocks
|
44
44
|
# to handle various mime types (mostly HTML and JSON). Given our `do` / `end`
|
45
45
|
# block style for non-functional blocks (which includes both `respond_to` and
|
@@ -143,6 +143,37 @@ Rails/FindEach:
|
|
143
143
|
Rails/HasAndBelongsToMany:
|
144
144
|
Enabled: false
|
145
145
|
|
146
|
+
# We find the combo `:only` and `:if` readable. While the `:except` and `:if`
|
147
|
+
# combo is easier to read as a combined proc. As a team we are fine with
|
148
|
+
# handling this in PR reviews, until such time which Rubocop provides an option
|
149
|
+
# for us to configure this.
|
150
|
+
Rails/IgnoredSkipActionFilterOption:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
# We do not care about this check due to its lack of configuration.
|
154
|
+
#
|
155
|
+
# Some of the team finds the naming of this method is more confusing than using
|
156
|
+
# `each_with_object`. We all agree the other examples are bad and should not be
|
157
|
+
# used:
|
158
|
+
#
|
159
|
+
# # OK for us
|
160
|
+
# [1, 2, 3].each_with_object({}) { |el, h| h[foo(el)] = el }
|
161
|
+
#
|
162
|
+
# # Bad
|
163
|
+
# [1, 2, 3].to_h { |el| [foo(el), el] }
|
164
|
+
# [1, 2, 3].map { |el| [foo(el), el] }.to_h
|
165
|
+
# Hash[[1, 2, 3].collect { |el| [foo(el), el] }]
|
166
|
+
#
|
167
|
+
# If this check supports configuration in the future so that we can allow
|
168
|
+
# `each_with_object` then we'll turn it back on.
|
169
|
+
Rails/IndexBy:
|
170
|
+
Enabled: false
|
171
|
+
|
172
|
+
# We find the name of this method to be very confusing. We'd prefer this method
|
173
|
+
# is never used.
|
174
|
+
Rails/IndexWith:
|
175
|
+
Enabled: false
|
176
|
+
|
146
177
|
# The ActiveSupport monkey patches for `present?` are nearly all defined as:
|
147
178
|
#
|
148
179
|
# !blank?
|
@@ -220,17 +251,13 @@ Rails/SaveBang:
|
|
220
251
|
# - http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html
|
221
252
|
# - http://api.rubyonrails.org/classes/ActiveRecord/Relation.html
|
222
253
|
#
|
254
|
+
# Configuration parameters: Blacklist, Whitelist.
|
223
255
|
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
224
256
|
Rails/SkipsModelValidations:
|
225
|
-
|
226
|
-
- '
|
227
|
-
- '
|
228
|
-
- '
|
229
|
-
- 'update_all'
|
230
|
-
- 'update_attribute'
|
231
|
-
- 'update_column'
|
232
|
-
- 'update_columns'
|
233
|
-
- 'update_counters'
|
257
|
+
Whitelist:
|
258
|
+
- 'decrement!'
|
259
|
+
- 'increment!'
|
260
|
+
- 'touch'
|
234
261
|
|
235
262
|
# Rails uses compact style by default so we're disabling this with a :hammer:
|
236
263
|
# for things likely to be generated by Rails (i.e. most things in app).
|
@@ -482,10 +482,8 @@ module Radius
|
|
482
482
|
end
|
483
483
|
|
484
484
|
# Try to load the factories defined for the specs
|
485
|
-
# rubocop:disable Lint/HandleExceptions
|
486
485
|
begin
|
487
486
|
require 'support/model_factories'
|
488
487
|
rescue LoadError
|
489
488
|
# Ignore as this is an optional convenience feature
|
490
489
|
end
|
491
|
-
# rubocop:enable Lint/HandleExceptions
|
data/lib/radius/spec/rspec.rb
CHANGED
@@ -22,6 +22,10 @@ RSpec.configure do |config|
|
|
22
22
|
# ...rather than:
|
23
23
|
# # => "be bigger than 2"
|
24
24
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
25
|
+
|
26
|
+
# The default is to warn, but this normally just gets ignored by
|
27
|
+
# developers. It's best to fix the problem then live with the warning.
|
28
|
+
expectations.on_potential_false_positives = :raise
|
25
29
|
end
|
26
30
|
|
27
31
|
# rspec-mocks config goes here. You can use an alternate test double
|
@@ -101,6 +105,11 @@ RSpec.configure do |config|
|
|
101
105
|
# as the one that triggered the failure.
|
102
106
|
Kernel.srand config.seed
|
103
107
|
|
108
|
+
# Common shared_example / shared_context inclusion alias for behavior driven
|
109
|
+
# development
|
110
|
+
config.alias_it_should_behave_like_to :has_behavior
|
111
|
+
config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
|
112
|
+
|
104
113
|
config.when_first_matching_example_defined(
|
105
114
|
:model_factory,
|
106
115
|
:model_factories,
|
data/lib/radius/spec/vcr.rb
CHANGED
@@ -91,10 +91,8 @@ RSpec.configure do |config|
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# Try to any custom VCR config for the app
|
94
|
-
# rubocop:disable Lint/HandleExceptions
|
95
94
|
begin
|
96
95
|
require 'support/vcr'
|
97
96
|
rescue LoadError
|
98
97
|
# Ignore as this is an optional convenience feature
|
99
98
|
end
|
100
|
-
# rubocop:enable Lint/HandleExceptions
|
data/lib/radius/spec/version.rb
CHANGED
data/radius-spec.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.metadata = {
|
14
14
|
"bug_tracker_uri" => "https://github.com/RadiusNetworks/radius-spec/issues",
|
15
|
-
"changelog_uri"
|
15
|
+
"changelog_uri" => "https://github.com/RadiusNetworks/radius-spec/blob/v#{Radius::Spec::VERSION}/CHANGELOG.md",
|
16
16
|
"source_code_uri" => "https://github.com/RadiusNetworks/radius-spec/tree/v#{Radius::Spec::VERSION}",
|
17
17
|
}
|
18
18
|
spec.summary = "Radius Networks RSpec setup and plug-ins"
|
@@ -21,18 +21,19 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.homepage = "https://github.com/RadiusNetworks/radius-spec"
|
22
22
|
spec.license = "Apache-2.0"
|
23
23
|
|
24
|
-
spec.files = `git ls-files -z`.split("\x0").reject
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f|
|
25
25
|
f.match(%r{^(test|spec|features)/})
|
26
|
-
|
26
|
+
}
|
27
27
|
spec.bindir = "exe"
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.required_ruby_version = ">= 2.5"
|
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.
|
34
|
+
spec.add_runtime_dependency "rubocop", "~> 0.89.0"
|
35
|
+
spec.add_runtime_dependency "rubocop-rails", "~> 2.6.0"
|
35
36
|
|
36
|
-
spec.add_development_dependency "bundler", "
|
37
|
-
spec.add_development_dependency "rake", "
|
37
|
+
spec.add_development_dependency "bundler", ">= 2.2.10"
|
38
|
+
spec.add_development_dependency "rake", ">= 12.0", "< 14.0"
|
38
39
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radius-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radius Networks
|
8
8
|
- Aaron Kromer
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -31,42 +31,62 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 0.89.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.89.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: rubocop-rails
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
-
type: :
|
48
|
+
version: 2.6.0
|
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:
|
55
|
+
version: 2.6.0
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: bundler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.2.10
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.2.10
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: rake
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|
59
73
|
requirements:
|
60
|
-
- - "
|
74
|
+
- - ">="
|
61
75
|
- !ruby/object:Gem::Version
|
62
76
|
version: '12.0'
|
77
|
+
- - "<"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '14.0'
|
63
80
|
type: :development
|
64
81
|
prerelease: false
|
65
82
|
version_requirements: !ruby/object:Gem::Requirement
|
66
83
|
requirements:
|
67
|
-
- - "
|
84
|
+
- - ">="
|
68
85
|
- !ruby/object:Gem::Version
|
69
86
|
version: '12.0'
|
87
|
+
- - "<"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '14.0'
|
70
90
|
description: Standard RSpec setup and a collection of plug-ins to help improve specs.
|
71
91
|
email:
|
72
92
|
- support@radiusnetworks.com
|
@@ -74,10 +94,11 @@ executables: []
|
|
74
94
|
extensions: []
|
75
95
|
extra_rdoc_files: []
|
76
96
|
files:
|
97
|
+
- ".github/workflows/ci.yml"
|
98
|
+
- ".github/workflows/reviewdog.yml"
|
77
99
|
- ".gitignore"
|
78
100
|
- ".rspec"
|
79
101
|
- ".rubocop.yml"
|
80
|
-
- ".travis.yml"
|
81
102
|
- ".yardopts"
|
82
103
|
- CHANGELOG.md
|
83
104
|
- CODE_OF_CONDUCT.md
|
@@ -88,6 +109,7 @@ files:
|
|
88
109
|
- benchmarks/bm_setup.rb
|
89
110
|
- benchmarks/call_vs_yield.rb
|
90
111
|
- benchmarks/case_equality_vs_class_check.rb
|
112
|
+
- benchmarks/casecmp_vs_downcase.rb
|
91
113
|
- benchmarks/cover_vs_include.rb
|
92
114
|
- benchmarks/delete_vs_tr.rb
|
93
115
|
- benchmarks/double_negation.rb
|
@@ -95,14 +117,16 @@ files:
|
|
95
117
|
- benchmarks/format_string.rb
|
96
118
|
- benchmarks/format_string_token.rb
|
97
119
|
- benchmarks/gsub_vs_tr.rb
|
120
|
+
- benchmarks/hash_each.rb
|
98
121
|
- benchmarks/hash_merge.rb
|
122
|
+
- benchmarks/hash_transform.rb
|
99
123
|
- benchmarks/kwargs.rb
|
100
124
|
- benchmarks/max_ternary.rb
|
101
125
|
- benchmarks/max_ternary_micro.rb
|
126
|
+
- benchmarks/style_hash_like_case.rb
|
102
127
|
- benchmarks/unfreeze_string.rb
|
103
128
|
- benchmarks/unpack_first.rb
|
104
129
|
- bin/ci
|
105
|
-
- bin/ci-code-review
|
106
130
|
- bin/console
|
107
131
|
- bin/pry
|
108
132
|
- bin/rake
|
@@ -126,9 +150,9 @@ licenses:
|
|
126
150
|
- Apache-2.0
|
127
151
|
metadata:
|
128
152
|
bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
|
129
|
-
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.
|
130
|
-
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.
|
131
|
-
post_install_message:
|
153
|
+
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.9.0/CHANGELOG.md
|
154
|
+
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.9.0
|
155
|
+
post_install_message:
|
132
156
|
rdoc_options: []
|
133
157
|
require_paths:
|
134
158
|
- lib
|
@@ -143,9 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
167
|
- !ruby/object:Gem::Version
|
144
168
|
version: '0'
|
145
169
|
requirements: []
|
146
|
-
|
147
|
-
|
148
|
-
signing_key:
|
170
|
+
rubygems_version: 3.1.2
|
171
|
+
signing_key:
|
149
172
|
specification_version: 4
|
150
173
|
summary: Radius Networks RSpec setup and plug-ins
|
151
174
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
before_install:
|
5
|
-
- gem update --system
|
6
|
-
- gem install bundler
|
7
|
-
bundler_args: --jobs=3 --retry=3 --without documentation debug
|
8
|
-
before_script:
|
9
|
-
- "bin/ci-code-review"
|
10
|
-
script: bin/ci
|
11
|
-
rvm:
|
12
|
-
- 2.5
|
13
|
-
- ruby-head
|
14
|
-
matrix:
|
15
|
-
allow_failures:
|
16
|
-
- rvm: ruby-head
|
17
|
-
fast_finish: true
|
data/bin/ci-code-review
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# See:
|
4
|
-
# - https://docs.travis-ci.com/user/environment-variables/#Convenience-Variables
|
5
|
-
# - https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
|
6
|
-
# - https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
|
7
|
-
if [[ "$TRAVIS_PULL_REQUEST" = "false" ]] || [[ "$TRAVIS_BRANCH" = "production" ]]; then
|
8
|
-
exit
|
9
|
-
fi
|
10
|
-
|
11
|
-
set -e
|
12
|
-
cd "$(dirname "$0")/.."
|
13
|
-
|
14
|
-
REVIEWDOG_VERSION="0.9.9"
|
15
|
-
|
16
|
-
if ! [ "$(./bin/reviewdog -version)" = "$REVIEWDOG_VERSION" ]; then
|
17
|
-
echo "Installing reviewdog version ${REVIEWDOG_VERSION}..."
|
18
|
-
curl -fsSL https://github.com/haya14busa/reviewdog/releases/download/$REVIEWDOG_VERSION/reviewdog_linux_amd64 \
|
19
|
-
-o ./bin/reviewdog
|
20
|
-
chmod +x ./bin/reviewdog
|
21
|
-
fi
|
22
|
-
|
23
|
-
echo Rubocop Version: $(./bin/rubocop --version)
|
24
|
-
echo Review Dog Version: $(./bin/reviewdog -version)
|
25
|
-
|
26
|
-
# Add `-diff="git diff master"` to reviewdog args when running locally
|
27
|
-
./bin/rubocop --config .rubocop.yml --extra-details --display-style-guide --rails | \
|
28
|
-
./bin/reviewdog -f=rubocop -reporter=github-pr-check
|