radius-spec 0.2.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Radius
4
4
  module Spec
5
- VERSION = "0.2.0"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end
@@ -31,6 +31,7 @@ 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.62.0"
34
35
 
35
36
  spec.add_development_dependency "bundler", "~> 1.16"
36
37
  spec.add_development_dependency "rake", "~> 12.0"
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.2.0
4
+ version: 0.6.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: 2018-05-17 00:00:00.000000000 Z
12
+ date: 2020-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '3.7'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubocop
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.62.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.62.0
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: bundler
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -71,14 +85,31 @@ files:
71
85
  - LICENSE.txt
72
86
  - README.md
73
87
  - Rakefile
88
+ - benchmarks/bm_setup.rb
89
+ - benchmarks/call_vs_yield.rb
90
+ - benchmarks/case_equality_vs_class_check.rb
91
+ - benchmarks/casecmp_vs_downcase.rb
92
+ - benchmarks/cover_vs_include.rb
93
+ - benchmarks/delete_vs_tr.rb
94
+ - benchmarks/double_negation.rb
95
+ - benchmarks/empty_literal.rb
96
+ - benchmarks/format_string.rb
97
+ - benchmarks/format_string_token.rb
98
+ - benchmarks/gsub_vs_tr.rb
99
+ - benchmarks/hash_merge.rb
100
+ - benchmarks/kwargs.rb
101
+ - benchmarks/max_ternary.rb
102
+ - benchmarks/max_ternary_micro.rb
103
+ - benchmarks/unfreeze_string.rb
104
+ - benchmarks/unpack_first.rb
74
105
  - bin/ci
106
+ - bin/ci-code-review
75
107
  - bin/console
76
108
  - bin/pry
77
109
  - bin/rake
78
110
  - bin/rspec
79
111
  - bin/rubocop
80
112
  - bin/setup
81
- - bin/travis
82
113
  - bin/yard
83
114
  - common_rubocop.yml
84
115
  - common_rubocop_rails.yml
@@ -86,6 +117,9 @@ files:
86
117
  - lib/radius/spec/model_factory.rb
87
118
  - lib/radius/spec/rails.rb
88
119
  - lib/radius/spec/rspec.rb
120
+ - lib/radius/spec/rspec/negated_matchers.rb
121
+ - lib/radius/spec/tempfile.rb
122
+ - lib/radius/spec/vcr.rb
89
123
  - lib/radius/spec/version.rb
90
124
  - radius-spec.gemspec
91
125
  homepage: https://github.com/RadiusNetworks/radius-spec
@@ -93,9 +127,9 @@ licenses:
93
127
  - Apache-2.0
94
128
  metadata:
95
129
  bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
96
- changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.2.0/CHANGELOG.md
97
- source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.2.0
98
- post_install_message:
130
+ changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.6.0/CHANGELOG.md
131
+ source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.6.0
132
+ post_install_message:
99
133
  rdoc_options: []
100
134
  require_paths:
101
135
  - lib
@@ -110,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
144
  - !ruby/object:Gem::Version
111
145
  version: '0'
112
146
  requirements: []
113
- rubyforge_project:
114
- rubygems_version: 2.7.6
115
- signing_key:
147
+ rubygems_version: 3.0.3
148
+ signing_key:
116
149
  specification_version: 4
117
150
  summary: Radius Networks RSpec setup and plug-ins
118
151
  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")