radius-spec 0.3.0 → 0.7.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 +5 -1
- data/.travis.yml +3 -5
- data/.yardopts +1 -0
- data/CHANGELOG.md +115 -1
- data/Gemfile +2 -1
- data/README.md +330 -31
- data/benchmarks/bm_setup.rb +1 -0
- data/benchmarks/call_vs_yield.rb +33 -0
- data/benchmarks/casecmp_vs_downcase.rb +488 -0
- data/bin/ci +1 -1
- data/common_rubocop.yml +243 -21
- data/common_rubocop_rails.yml +135 -17
- data/lib/radius/spec/model_factory.rb +35 -22
- data/lib/radius/spec/rails.rb +2 -2
- data/lib/radius/spec/rspec.rb +20 -0
- data/lib/radius/spec/rspec/negated_matchers.rb +19 -0
- data/lib/radius/spec/tempfile.rb +162 -0
- data/lib/radius/spec/vcr.rb +100 -0
- data/lib/radius/spec/version.rb +1 -1
- data/radius-spec.gemspec +4 -3
- metadata +40 -18
- data/bin/travis +0 -29
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
VCR.configure do |config|
|
7
|
+
config.cassette_library_dir = "spec/cassettes"
|
8
|
+
config.hook_into :webmock
|
9
|
+
config.configure_rspec_metadata!
|
10
|
+
config.ignore_localhost = true
|
11
|
+
|
12
|
+
record_mode = case
|
13
|
+
when RSpec.configuration.files_to_run.one?
|
14
|
+
# When developing new features we often run new specs in
|
15
|
+
# isolation as we write the code. This is the time to allow
|
16
|
+
# creating the cassettes.
|
17
|
+
:once
|
18
|
+
when ENV['CI']
|
19
|
+
# Never let CI record
|
20
|
+
:none
|
21
|
+
else
|
22
|
+
# Default to blocking new requests to catch issues
|
23
|
+
:none
|
24
|
+
end
|
25
|
+
config.default_cassette_options = {
|
26
|
+
record: record_mode,
|
27
|
+
|
28
|
+
# Required for working proxy
|
29
|
+
update_content_length_header: true,
|
30
|
+
|
31
|
+
# Raise errors when recorded cassettes no longer match interactions
|
32
|
+
allow_unused_http_interactions: false,
|
33
|
+
}
|
34
|
+
|
35
|
+
# Filter out common sensitive or environment specific data
|
36
|
+
%w[
|
37
|
+
AWS_ACCESS_KEY_ID
|
38
|
+
AWS_SECRET_ACCESS_KEY
|
39
|
+
GOOGLE_CLIENT_ID
|
40
|
+
GOOGLE_CLIENT_SECRET
|
41
|
+
RADIUS_OAUTH_PROVIDER_APP_ID
|
42
|
+
RADIUS_OAUTH_PROVIDER_APP_SECRET
|
43
|
+
RADIUS_OAUTH_PROVIDER_URL
|
44
|
+
].each do |secret|
|
45
|
+
config.filter_sensitive_data("<#{secret}>") { ENV[secret] }
|
46
|
+
|
47
|
+
config.filter_sensitive_data("<#{secret}_FORM>") {
|
48
|
+
URI.encode_www_form_component(ENV[secret]) if ENV[secret]
|
49
|
+
}
|
50
|
+
|
51
|
+
config.filter_sensitive_data("<#{secret}_URI>") {
|
52
|
+
ERB::Util.url_encode(ENV[secret]) if ENV[secret]
|
53
|
+
}
|
54
|
+
|
55
|
+
config.filter_sensitive_data('<AUTHORIZATION_HEADER>') { |interaction|
|
56
|
+
interaction.request.headers['Authorization']&.first
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
RSpec.configure do |config|
|
62
|
+
{
|
63
|
+
vcr_record: :once,
|
64
|
+
vcr_record_new: :new_episodes,
|
65
|
+
}.each do |tag, record_mode|
|
66
|
+
config.define_derived_metadata(tag) do |metadata|
|
67
|
+
case metadata[:vcr]
|
68
|
+
when nil, true
|
69
|
+
metadata[:vcr] = { record: record_mode }
|
70
|
+
when Hash
|
71
|
+
metadata[:vcr][:record] = record_mode
|
72
|
+
else
|
73
|
+
raise "Unknown VCR metadata value: #{metadata[:vcr].inspect}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
config.define_derived_metadata(:focus) do |metadata|
|
79
|
+
# VCR is flagged as falsey
|
80
|
+
next if metadata.key?(:vcr) && !metadata[:vcr]
|
81
|
+
|
82
|
+
case metadata[:vcr]
|
83
|
+
when nil, true
|
84
|
+
metadata[:vcr] = { record: :once }
|
85
|
+
when Hash
|
86
|
+
metadata[:vcr][:record] ||= :once
|
87
|
+
else
|
88
|
+
raise "Unknown VCR metadata value: #{metadata[:vcr].inspect}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Try to any custom VCR config for the app
|
94
|
+
# rubocop:disable Lint/HandleExceptions
|
95
|
+
begin
|
96
|
+
require 'support/vcr'
|
97
|
+
rescue LoadError
|
98
|
+
# Ignore as this is an optional convenience feature
|
99
|
+
end
|
100
|
+
# rubocop:enable Lint/HandleExceptions
|
data/lib/radius/spec/version.rb
CHANGED
data/radius-spec.gemspec
CHANGED
@@ -31,8 +31,9 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.required_ruby_version = ">= 2.5"
|
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.73.0"
|
35
|
+
spec.add_runtime_dependency "rubocop-rails", "~> 2.2.1"
|
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.7.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-07-23 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.73.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.73.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.2.1
|
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.2.1
|
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
|
@@ -88,6 +108,7 @@ files:
|
|
88
108
|
- benchmarks/bm_setup.rb
|
89
109
|
- benchmarks/call_vs_yield.rb
|
90
110
|
- benchmarks/case_equality_vs_class_check.rb
|
111
|
+
- benchmarks/casecmp_vs_downcase.rb
|
91
112
|
- benchmarks/cover_vs_include.rb
|
92
113
|
- benchmarks/delete_vs_tr.rb
|
93
114
|
- benchmarks/double_negation.rb
|
@@ -109,7 +130,6 @@ files:
|
|
109
130
|
- bin/rspec
|
110
131
|
- bin/rubocop
|
111
132
|
- bin/setup
|
112
|
-
- bin/travis
|
113
133
|
- bin/yard
|
114
134
|
- common_rubocop.yml
|
115
135
|
- common_rubocop_rails.yml
|
@@ -117,6 +137,9 @@ files:
|
|
117
137
|
- lib/radius/spec/model_factory.rb
|
118
138
|
- lib/radius/spec/rails.rb
|
119
139
|
- lib/radius/spec/rspec.rb
|
140
|
+
- lib/radius/spec/rspec/negated_matchers.rb
|
141
|
+
- lib/radius/spec/tempfile.rb
|
142
|
+
- lib/radius/spec/vcr.rb
|
120
143
|
- lib/radius/spec/version.rb
|
121
144
|
- radius-spec.gemspec
|
122
145
|
homepage: https://github.com/RadiusNetworks/radius-spec
|
@@ -124,9 +147,9 @@ licenses:
|
|
124
147
|
- Apache-2.0
|
125
148
|
metadata:
|
126
149
|
bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
|
127
|
-
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.
|
128
|
-
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.
|
129
|
-
post_install_message:
|
150
|
+
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.7.0/CHANGELOG.md
|
151
|
+
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.7.0
|
152
|
+
post_install_message:
|
130
153
|
rdoc_options: []
|
131
154
|
require_paths:
|
132
155
|
- lib
|
@@ -141,9 +164,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
164
|
- !ruby/object:Gem::Version
|
142
165
|
version: '0'
|
143
166
|
requirements: []
|
144
|
-
|
145
|
-
|
146
|
-
signing_key:
|
167
|
+
rubygems_version: 3.1.6
|
168
|
+
signing_key:
|
147
169
|
specification_version: 4
|
148
170
|
summary: Radius Networks RSpec setup and plug-ins
|
149
171
|
test_files: []
|
data/bin/travis
DELETED
@@ -1,29 +0,0 @@
|
|
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")
|