radius-spec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/bin/yard
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 'yard' 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("yard", "yard")
|
data/common_rubocop.yml
ADDED
@@ -0,0 +1,290 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5.0
|
3
|
+
Exclude:
|
4
|
+
# Exclude generated binstubs
|
5
|
+
- 'bin/bundle'
|
6
|
+
- 'bin/bundler-travis'
|
7
|
+
- 'bin/pry'
|
8
|
+
- 'bin/rake'
|
9
|
+
- 'bin/rspec'
|
10
|
+
- 'bin/rubocop'
|
11
|
+
- 'bin/travis'
|
12
|
+
- 'bin/yard'
|
13
|
+
# Exclude vendored content
|
14
|
+
- 'vendor/**/*'
|
15
|
+
Include:
|
16
|
+
- '**/Brewfile'
|
17
|
+
- '**/Rakefile'
|
18
|
+
|
19
|
+
# Modifiers should be indented as deep as method definitions, or as deep as the
|
20
|
+
# class/module keyword, depending on configuration.
|
21
|
+
#
|
22
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
23
|
+
# SupportedStyles: outdent, indent
|
24
|
+
Layout/AccessModifierIndentation:
|
25
|
+
EnforcedStyle: outdent
|
26
|
+
|
27
|
+
# Disabling this until it is fixed to support multi-line block chains using the
|
28
|
+
# semantic style.
|
29
|
+
#
|
30
|
+
# See https://github.com/bbatsov/rubocop/issues/5655
|
31
|
+
#
|
32
|
+
# Configuration parameters: EnforcedStyleAlignWith.
|
33
|
+
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
34
|
+
Layout/BlockAlignment:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
# Disabling this until it is fixed to handle multi-line method chains where the
|
38
|
+
# first method call is multi-line.
|
39
|
+
#
|
40
|
+
# See # https://github.com/bbatsov/rubocop/issues/5650
|
41
|
+
Layout/ClosingParenthesisIndentation:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
# Disabling this until it is fixed to handle multi-line method chains where the
|
45
|
+
# first method call is multi-line.
|
46
|
+
#
|
47
|
+
# See # https://github.com/bbatsov/rubocop/issues/5650
|
48
|
+
#
|
49
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
50
|
+
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
51
|
+
Layout/FirstParameterIndentation:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
# Often with benchmarking we don't explictly "use" a variable or return value.
|
55
|
+
# We simply need to perform the operation which generates said value for the
|
56
|
+
# benchmark.
|
57
|
+
#
|
58
|
+
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
59
|
+
Lint/Void:
|
60
|
+
Exclude:
|
61
|
+
- 'benchmarks/**/*'
|
62
|
+
|
63
|
+
# Configuration parameters: CountComments, ExcludedMethods, Max.
|
64
|
+
Metrics/BlockLength:
|
65
|
+
Exclude:
|
66
|
+
- '**/Rakefile'
|
67
|
+
- '**/*.rake'
|
68
|
+
- 'spec/spec_helper.rb'
|
69
|
+
- 'spec/**/*_spec.rb'
|
70
|
+
|
71
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
72
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
73
|
+
Naming/FileName:
|
74
|
+
Exclude:
|
75
|
+
- '**/Gemfile'
|
76
|
+
- '**/*.gemspec'
|
77
|
+
- '**/Brewfile'
|
78
|
+
|
79
|
+
# `alias` behavior changes on scope. In general we expect the behavior to be
|
80
|
+
# that which is defined by `alias_method`.
|
81
|
+
#
|
82
|
+
# See https://stackoverflow.com/questions/4763121/should-i-use-alias-or-alias-method
|
83
|
+
#
|
84
|
+
# Configuration parameters: EnforcedStyle.
|
85
|
+
# SupportedStyles: prefer_alias, prefer_alias_method
|
86
|
+
Style/Alias:
|
87
|
+
EnforcedStyle: prefer_alias_method
|
88
|
+
|
89
|
+
# Use semantic style for blocks:
|
90
|
+
# - Prefer `do...end` over `{...}` for procedural blocks.
|
91
|
+
# - Prefer `{...}` over `do...end` for functional blocks.
|
92
|
+
#
|
93
|
+
# When the return value of the method receiving the block is important prefer
|
94
|
+
# `{..}` over `do..end`.
|
95
|
+
#
|
96
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods,
|
97
|
+
# FunctionalMethods, IgnoredMethods.
|
98
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
99
|
+
Style/BlockDelimiters:
|
100
|
+
Details: |
|
101
|
+
Use semantic style for blocks:
|
102
|
+
- Prefer `do...end` over `{...}` for procedural blocks.
|
103
|
+
- Prefer `{...}` over `do...end` for functional blocks.
|
104
|
+
|
105
|
+
When the return value of the method receiving the block is important prefer
|
106
|
+
`{..}` over `do..end`.
|
107
|
+
Enabled: true
|
108
|
+
EnforcedStyle: semantic
|
109
|
+
ProceduralMethods:
|
110
|
+
- benchmark
|
111
|
+
- bm
|
112
|
+
- bmbm
|
113
|
+
- measure
|
114
|
+
- realtime
|
115
|
+
- with_object
|
116
|
+
FunctionalMethods:
|
117
|
+
- each_with_object
|
118
|
+
- git_source
|
119
|
+
- let
|
120
|
+
- let!
|
121
|
+
- new
|
122
|
+
- subject
|
123
|
+
- tap
|
124
|
+
- watch
|
125
|
+
IgnoredMethods:
|
126
|
+
- lambda
|
127
|
+
- proc
|
128
|
+
- it
|
129
|
+
|
130
|
+
# Using `case` instead of an `if` expression when the case condition is empty
|
131
|
+
# can be more expressive of intent. Using multiple "cases" informs the reader
|
132
|
+
# that all of the conditions are related or coupled in a meaningful way.
|
133
|
+
# Multi-branch `if` expressions do not necessarily convey this relation. They
|
134
|
+
# may simply be separate branching logic and possibly only flattened for
|
135
|
+
# readability.
|
136
|
+
Style/EmptyCaseCondition:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
# Always write methods on multiple lines.
|
140
|
+
#
|
141
|
+
# Configuration parameters: EnforcedStyle.
|
142
|
+
# SupportedStyles: compact, expanded
|
143
|
+
Style/EmptyMethod:
|
144
|
+
EnforcedStyle: expanded
|
145
|
+
|
146
|
+
# Prefer symbol keys using the 1.9 hash syntax. However, when keys are mixed
|
147
|
+
# use a consistent mapping style; which generally means using hash rockets:
|
148
|
+
#
|
149
|
+
# # bad
|
150
|
+
# {:a => 2}
|
151
|
+
# {b: 1, :c => 2}
|
152
|
+
# {d: 1, 'e' => 2}
|
153
|
+
#
|
154
|
+
# # good
|
155
|
+
# {a: 2, b: 1}
|
156
|
+
# {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
|
157
|
+
#
|
158
|
+
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
159
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
160
|
+
Style/HashSyntax:
|
161
|
+
Details: |
|
162
|
+
Prefer symbol keys using the 1.9 hash syntax. However, when keys are mixed
|
163
|
+
use a consistent mapping style; which generally means using hash rockets.
|
164
|
+
EnforcedStyle: ruby19_no_mixed_keys
|
165
|
+
|
166
|
+
# As part of our semantic style we generally use the literal `-> { }` format to
|
167
|
+
# indicate this is a function with a return value we care about. As this cop
|
168
|
+
# doesn't have a more flexible setting we prefer the literal syntax to the
|
169
|
+
# lambda version.
|
170
|
+
#
|
171
|
+
# Configuration parameters: EnforcedStyle.
|
172
|
+
# SupportedStyles: line_count_dependent, lambda, literal
|
173
|
+
Style/Lambda:
|
174
|
+
Details: |
|
175
|
+
As part of our semantic style we generally use the literal `-> { }` format
|
176
|
+
to indicate this is a function with a return value we care about. As this
|
177
|
+
cop doesn't have a more flexible setting we prefer the literal syntax to
|
178
|
+
the lambda version.
|
179
|
+
EnforcedStyle: literal
|
180
|
+
|
181
|
+
# Avoid chaining a method call on a do...end block. This breaks semantic style
|
182
|
+
# reducing contextual information.
|
183
|
+
Style/MethodCalledOnDoEndBlock:
|
184
|
+
Details: "This breaks semantic style reducing contextual information."
|
185
|
+
Enabled: true
|
186
|
+
|
187
|
+
# With semantic style (functional blocks) it's common to chain several methods
|
188
|
+
# to avoid creating multiple intermediate local variables. Block length is
|
189
|
+
# generally not an issue here as these types of usage tend to produce short (<
|
190
|
+
# 5 LOC) multi-line blocks.
|
191
|
+
Style/MultilineBlockChain:
|
192
|
+
Enabled: false
|
193
|
+
|
194
|
+
# Context for this cop is too dependent. Often using the numeric comparision is
|
195
|
+
# faster. An in certain contexts, Also, depending on the context a numeric
|
196
|
+
# comparison is more consistent and can even be more natural:
|
197
|
+
#
|
198
|
+
# # numeric comparison is more natural and consistent
|
199
|
+
# if n < 0
|
200
|
+
# elsif n < 5
|
201
|
+
# elsif n < 20
|
202
|
+
# end
|
203
|
+
#
|
204
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
205
|
+
# SupportedStyles: predicate, comparison
|
206
|
+
Style/NumericPredicate:
|
207
|
+
Enabled: false
|
208
|
+
|
209
|
+
# Prefer slashes for simple expressions. For multi-line use percent literal
|
210
|
+
# to support comments and other advanced features.
|
211
|
+
#
|
212
|
+
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
213
|
+
# SupportedStyles: slashes, percent_r, mixed
|
214
|
+
Style/RegexpLiteral:
|
215
|
+
EnforcedStyle: mixed
|
216
|
+
|
217
|
+
# We generally prefer double quotes but many generators use single quotes. We
|
218
|
+
# don't view the performance difference to be all that much so we don't care
|
219
|
+
# if the style is mixed or double quotes are used for static strings.
|
220
|
+
#
|
221
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
222
|
+
# SupportedStyles: single_quotes, double_quotes
|
223
|
+
Style/StringLiterals:
|
224
|
+
Enabled: false
|
225
|
+
|
226
|
+
# When ternaries become complex they can be difficult to read due to increased
|
227
|
+
# cognative load parsing the expression. Cognative load can increase further
|
228
|
+
# when assignment is involved.
|
229
|
+
#
|
230
|
+
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
|
231
|
+
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
|
232
|
+
Style/TernaryParentheses:
|
233
|
+
AllowSafeAssignment: false
|
234
|
+
Details: |
|
235
|
+
When ternaries become complex they can be difficult to read due to
|
236
|
+
increased cognative load parsing the expression. Cognative load can
|
237
|
+
increase further when assignment is involved. To help reduce this cognative
|
238
|
+
use parentheses for complex expressions.
|
239
|
+
EnforcedStyle: require_parentheses_when_complex
|
240
|
+
|
241
|
+
# Always use trailing commas for multiline. This makes git diffs easier to read
|
242
|
+
# by cutting down on noise when commas are appended.
|
243
|
+
#
|
244
|
+
# However, specs often multi-line `expect()` for readability with long lines.
|
245
|
+
# We don't want to enforce a trailing comma in that case. Ideally, there would
|
246
|
+
# be another option to only enforce a consistent comma when there is more than
|
247
|
+
# one argument.
|
248
|
+
#
|
249
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
250
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
251
|
+
Style/TrailingCommaInArguments:
|
252
|
+
Details: |
|
253
|
+
Always use trailing commas for multiline arguments. This makes git diffs
|
254
|
+
easier to read by cutting down on noise when commas are appended. It also
|
255
|
+
simplifies adding, removing, and swapping argument orders.
|
256
|
+
EnforcedStyleForMultiline: consistent_comma
|
257
|
+
Exclude:
|
258
|
+
- 'spec/**/*_spec.rb'
|
259
|
+
|
260
|
+
# Always use trailing commas for multiline. This makes git diffs easier to read
|
261
|
+
# by cutting down on noise when commas are appended.
|
262
|
+
#
|
263
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
264
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
265
|
+
Style/TrailingCommaInArrayLiteral:
|
266
|
+
Details: |
|
267
|
+
Always use trailing commas for multiline arrays. This makes git diffs
|
268
|
+
easier to read by cutting down on noise when commas are appended. It also
|
269
|
+
simplifies adding, removing, and re-arranging the elements.
|
270
|
+
EnforcedStyleForMultiline: consistent_comma
|
271
|
+
|
272
|
+
# Always use trailing commas for multiline. This makes git diffs easier to read
|
273
|
+
# by cutting down on noise when commas are appended.
|
274
|
+
#
|
275
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
276
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
277
|
+
Style/TrailingCommaInHashLiteral:
|
278
|
+
Details: |
|
279
|
+
Always use trailing commas for multiline hashes. This makes git diffs
|
280
|
+
easier to read by cutting down on noise when commas are appended. It also
|
281
|
+
simplifies adding, removing, and re-arranging the elements.
|
282
|
+
EnforcedStyleForMultiline: consistent_comma
|
283
|
+
|
284
|
+
# When it comes to constants it's safer to place the constant on the right-hand
|
285
|
+
# side. With a constant accidental assignment will produce a syntax error.
|
286
|
+
#
|
287
|
+
# Configuration parameters: EnforcedStyle.
|
288
|
+
# SupportedStyles: all_comparison_operators, equality_operators_only
|
289
|
+
Style/YodaCondition:
|
290
|
+
Enabled: false
|
@@ -0,0 +1,113 @@
|
|
1
|
+
inherit_mode:
|
2
|
+
merge:
|
3
|
+
- Exclude
|
4
|
+
|
5
|
+
inherit_from: common_rubocop.yml
|
6
|
+
|
7
|
+
# Enable additional Rails cops
|
8
|
+
Rails:
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
AllCops:
|
12
|
+
Exclude:
|
13
|
+
- 'bin/puma'
|
14
|
+
- 'bin/rails'
|
15
|
+
- 'bin/shoryuken'
|
16
|
+
- 'bin/sidekiq'
|
17
|
+
- 'bin/spring'
|
18
|
+
- 'db/schema.rb'
|
19
|
+
- 'db/migrate/**/*'
|
20
|
+
|
21
|
+
# Rails project's are not concerned with API docs normally
|
22
|
+
Documentation:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/BlockLength:
|
26
|
+
Exclude:
|
27
|
+
- 'spec/rails_helper.rb'
|
28
|
+
|
29
|
+
# Rails foreign keys and indexes can get long. We want to ignore our annotation
|
30
|
+
# comments which are for these entries.
|
31
|
+
#
|
32
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
33
|
+
# URISchemes: http, https
|
34
|
+
Metrics/LineLength:
|
35
|
+
IgnoredPatterns:
|
36
|
+
- '\A# fk_rails_'
|
37
|
+
- '\A# index_'
|
38
|
+
|
39
|
+
# As Rails defaults to creating timestamps you need to go out of your way to
|
40
|
+
# explicitly have them removed from the table. This cop is almost always a
|
41
|
+
# false negative so we're disabling it.
|
42
|
+
#
|
43
|
+
# Configuration parameters: Include.
|
44
|
+
# Include: db/migrate/*.rb
|
45
|
+
Rails/CreateTableWithTimestamps:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
# The ActiveSupport monkey patches for `present?` are nearly all defiend as:
|
49
|
+
#
|
50
|
+
# !blank?
|
51
|
+
#
|
52
|
+
# For most of use `unless blank?` reads just as easily as `if present?`.
|
53
|
+
# Sometimes contextually, it can read better depending on the branch logic and
|
54
|
+
# surrounding context. As `if present?` requires an additional negation and
|
55
|
+
# method call it is technically slower. In the general case the perf different
|
56
|
+
# isn't much but in some cases it matters. Thus, we are not enforcing changing
|
57
|
+
# `unless blank?` to `if present?` and are leaving it up to the context to
|
58
|
+
# decide which is a better fit.
|
59
|
+
#
|
60
|
+
# Cop supports --auto-correct.
|
61
|
+
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
|
62
|
+
Rails/Present:
|
63
|
+
UnlessBlank: false
|
64
|
+
|
65
|
+
# We prefer you use the attribute readers and writes. For those special cases
|
66
|
+
# where the intent is really to interact with the raw underlying attribute we
|
67
|
+
# prefer `read_attribute` and `write_attribute`; as this makes the intent
|
68
|
+
# explict. Ideally we'd never use the hash like accessor `[:attr]`.
|
69
|
+
#
|
70
|
+
# We disable this cop because it is not configurable.
|
71
|
+
#
|
72
|
+
# Configuration parameters: Include.
|
73
|
+
# Include: app/models/**/*.rb
|
74
|
+
Rails/ReadWriteAttribute:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
# According to the Rails docs while the following methods skip validations they
|
78
|
+
# only update the specified (single) attribute reducing risks. We'd rather not
|
79
|
+
# warn for those cases:
|
80
|
+
#
|
81
|
+
# - decrement!
|
82
|
+
# - increment!
|
83
|
+
# - touch
|
84
|
+
#
|
85
|
+
# We are not excluding `toggle!` because it's more likely that a flag may have
|
86
|
+
# validations associated with it (or is used by other validations).
|
87
|
+
#
|
88
|
+
# See:
|
89
|
+
#
|
90
|
+
# - http://api.rubyonrails.org/classes/ActiveRecord/CounterCache/ClassMethods.html
|
91
|
+
# - http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html
|
92
|
+
# - http://api.rubyonrails.org/classes/ActiveRecord/Relation.html
|
93
|
+
#
|
94
|
+
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
95
|
+
Rails/SkipsModelValidations:
|
96
|
+
Blacklist:
|
97
|
+
- 'decrement_counter'
|
98
|
+
- 'increment_counter'
|
99
|
+
- 'toggle!'
|
100
|
+
- 'update_all'
|
101
|
+
- 'update_attribute'
|
102
|
+
- 'update_column'
|
103
|
+
- 'update_columns'
|
104
|
+
- 'update_counters'
|
105
|
+
|
106
|
+
# Rails uses compact style by default so we're disabling this with a :hammer:
|
107
|
+
# for things likely to be generated by Rails (i.e. most things in app).
|
108
|
+
#
|
109
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
110
|
+
# SupportedStyles: nested, compact
|
111
|
+
Style/ClassAndModuleChildren:
|
112
|
+
Exclude:
|
113
|
+
- 'app/**/*'
|