Skip to content

Commit

Permalink
bump dependencies (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartes authored Aug 12, 2024
1 parent bd9d4f9 commit 2ff6a3c
Show file tree
Hide file tree
Showing 29 changed files with 201 additions and 202 deletions.
8 changes: 5 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
require:
- rubocop-rspec
- rubocop-performance
- rubocop-rspec_rails

inherit_gem:
prettier: rubocop.yml

AllCops:
TargetRubyVersion: 2.7
NewCops: enable
Exclude:
- bin/**/*
Expand Down Expand Up @@ -43,7 +45,7 @@ RSpec/MultipleMemoizedHelpers:
RSpec/EmptyExampleGroup:
Enabled: false

RSpec/Rails/InferredSpecType:
RSpecRails/InferredSpecType:
Enabled: false

Layout/LineLength:
Expand Down Expand Up @@ -104,10 +106,10 @@ Performance/Sum:
Performance/StringInclude:
Enabled: false

RSpec/Rails/HttpStatus:
RSpecRails/HttpStatus:
Enabled: false

RSpec/Rails/HaveHttpStatus:
RSpecRails/HaveHttpStatus:
Enabled: false

Lint/AmbiguousBlockAssociation:
Expand Down
24 changes: 7 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,12 @@ GEM
bigdecimal
rexml
diff-lcs (1.5.1)
docile (1.4.0)
hashdiff (1.1.0)
mize (0.4.1)
protocol (~> 2.0)
protocol (2.0.0)
ruby_parser (~> 3.0)
public_suffix (6.0.0)
racc (1.8.0)
rack (3.0.11)
docile (1.4.1)
hashdiff (1.1.1)
public_suffix (6.0.1)
rack (3.1.7)
rake (13.2.1)
rexml (3.3.1)
rexml (3.3.4)
strscan
rspec (3.13.0)
rspec-core (~> 3.13.0)
Expand All @@ -48,10 +43,6 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
ruby_parser (3.21.1)
racc (~> 1.5)
sexp_processor (~> 4.16)
sexp_processor (4.17.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -60,8 +51,7 @@ GEM
simplecov_json_formatter (0.1.4)
strscan (3.1.0)
sync (0.5.0)
term-ansicolor (1.10.2)
mize
term-ansicolor (1.11.2)
tins (~> 1.0)
thor (1.3.1)
timecop (0.9.10)
Expand Down Expand Up @@ -89,4 +79,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.5.11
2.5.17
2 changes: 1 addition & 1 deletion lib/castle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
module Castle
class << self
def configure(config_hash = nil)
(config_hash || {}).each { |config_name, config_value| config.send("#{config_name}=", config_value) }
(config_hash || {}).each { |config_name, config_value| config.send(:"#{config_name}=", config_value) }

yield(config) if block_given?
end
Expand Down
9 changes: 8 additions & 1 deletion spec/integration/rails/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
}
end
let(:now) { Time.now }
let(:headers) { { 'HTTP_AUTHORIZATION' => 'Basic 123', 'HTTP_X_FORWARDED_FOR' => '5.5.5.5, 1.2.3.4', 'HTTP_VERSION' => 'HTTP/1.0', 'HTTP_CONTENT_LENGTH' => '0' } }
let(:headers) do
{
'HTTP_AUTHORIZATION' => 'Basic 123',
'HTTP_X_FORWARDED_FOR' => '5.5.5.5, 1.2.3.4',
'HTTP_VERSION' => 'HTTP/1.0',
'HTTP_CONTENT_LENGTH' => '0'
}
end

before do
Timecop.freeze(now)
Expand Down
24 changes: 12 additions & 12 deletions spec/lib/castle/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@
end

it { assert_not_requested :post, 'https://api.castle.io/v1/authenticate' }
it { expect(request_response[:policy][:action]).to be_eql(Castle::Verdict::ALLOW) }
it { expect(request_response[:action]).to be_eql(Castle::Verdict::ALLOW) }
it { expect(request_response[:user_id]).to be_eql('1234') }
it { expect(request_response[:policy][:action]).to eql(Castle::Verdict::ALLOW) }
it { expect(request_response[:action]).to eql(Castle::Verdict::ALLOW) }
it { expect(request_response[:user_id]).to eql('1234') }
it { expect(request_response[:failover]).to be true }
it { expect(request_response[:failover_reason]).to be_eql('Castle is set to do not track.') }
it { expect(request_response[:failover_reason]).to eql('Castle is set to do not track.') }
end

context 'when request with fail' do
Expand All @@ -226,11 +226,11 @@

context 'with request error and not throw on eg deny strategy' do
it { assert_not_requested :post, 'https://:[email protected]/v1/authenticate' }
it { expect(request_response[:policy][:action]).to be_eql('allow') }
it { expect(request_response[:action]).to be_eql('allow') }
it { expect(request_response[:user_id]).to be_eql('1234') }
it { expect(request_response[:policy][:action]).to eql('allow') }
it { expect(request_response[:action]).to eql('allow') }
it { expect(request_response[:user_id]).to eql('1234') }
it { expect(request_response[:failover]).to be true }
it { expect(request_response[:failover_reason]).to be_eql('Castle::RequestError') }
it { expect(request_response[:failover_reason]).to eql('Castle::RequestError') }
end
end

Expand All @@ -245,11 +245,11 @@

describe 'not throw on eg deny strategy' do
it { assert_not_requested :post, 'https://:[email protected]/v1/authenticate' }
it { expect(request_response[:policy][:action]).to be_eql('allow') }
it { expect(request_response[:action]).to be_eql('allow') }
it { expect(request_response[:user_id]).to be_eql('1234') }
it { expect(request_response[:policy][:action]).to eql('allow') }
it { expect(request_response[:action]).to eql('allow') }
it { expect(request_response[:user_id]).to eql('1234') }
it { expect(request_response[:failover]).to be true }
it { expect(request_response[:failover_reason]).to be_eql('Castle::InternalServerError') }
it { expect(request_response[:failover_reason]).to eql('Castle::InternalServerError') }
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/castle/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Castle::Command do
subject(:command) { described_class.new('go', { id: '1' }, :post) }

it { expect(command.path).to be_eql('go') }
it { expect(command.data).to be_eql(id: '1') }
it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to eql('go') }
it { expect(command.data).to eql(id: '1') }
it { expect(command.method).to be(:post) }
end
4 changes: 2 additions & 2 deletions spec/lib/castle/commands/approve_device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
end

context 'with device_token' do
it { expect(command.method).to be_eql(:put) }
it { expect(command.path).to be_eql("devices/#{device_token}/approve") }
it { expect(command.method).to be(:put) }
it { expect(command.path).to eql("devices/#{device_token}/approve") }
it { expect(command.data).to be_nil }
end
end
Expand Down
30 changes: 15 additions & 15 deletions spec/lib/castle/commands/authenticate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,45 @@
let(:payload) { default_payload.merge(properties: { test: '1' }) }
let(:command_data) { default_payload.merge(properties: { test: '1' }, context: context) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('authenticate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('authenticate') }
it { expect(command.data).to eql(command_data) }
end

context 'with user_traits' do
let(:payload) { default_payload.merge(user_traits: { test: '1' }) }
let(:command_data) { default_payload.merge(user_traits: { test: '1' }, context: context) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('authenticate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('authenticate') }
it { expect(command.data).to eql(command_data) }
end

context 'when active true' do
let(:payload) { default_payload.merge(context: context.merge(active: true)) }
let(:command_data) { default_payload.merge(context: context.merge(active: true)) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('authenticate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('authenticate') }
it { expect(command.data).to eql(command_data) }
end

context 'when active false' do
let(:payload) { default_payload.merge(context: context.merge(active: false)) }
let(:command_data) { default_payload.merge(context: context.merge(active: false)) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('authenticate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('authenticate') }
it { expect(command.data).to eql(command_data) }
end

context 'when active string' do
let(:payload) { default_payload.merge(context: context.merge(active: 'string')) }
let(:command_data) { default_payload.merge(context: context) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('authenticate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('authenticate') }
it { expect(command.data).to eql(command_data) }
end
end

Expand Down
24 changes: 12 additions & 12 deletions spec/lib/castle/commands/end_impersonation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,36 @@
let(:payload) { default_payload.merge(properties: { impersonator: impersonator }) }
let(:command_data) { default_payload.merge(properties: { impersonator: impersonator }, context: context) }

it { expect(command.method).to be_eql(:delete) }
it { expect(command.path).to be_eql('impersonate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:delete) }
it { expect(command.path).to eql('impersonate') }
it { expect(command.data).to eql(command_data) }
end

context 'when active true' do
let(:payload) { default_payload.merge(context: context.merge(active: true)) }
let(:command_data) { default_payload.merge(context: context.merge(active: true)) }

it { expect(command.method).to be_eql(:delete) }
it { expect(command.path).to be_eql('impersonate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:delete) }
it { expect(command.path).to eql('impersonate') }
it { expect(command.data).to eql(command_data) }
end

context 'when active false' do
let(:payload) { default_payload.merge(context: context.merge(active: false)) }
let(:command_data) { default_payload.merge(context: context.merge(active: false)) }

it { expect(command.method).to be_eql(:delete) }
it { expect(command.path).to be_eql('impersonate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:delete) }
it { expect(command.path).to eql('impersonate') }
it { expect(command.data).to eql(command_data) }
end

context 'when active string' do
let(:payload) { default_payload.merge(context: context.merge(active: 'string')) }
let(:command_data) { default_payload.merge(context: context) }

it { expect(command.method).to be_eql(:delete) }
it { expect(command.path).to be_eql('impersonate') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:delete) }
it { expect(command.path).to eql('impersonate') }
it { expect(command.data).to eql(command_data) }
end
end

Expand Down
30 changes: 15 additions & 15 deletions spec/lib/castle/commands/filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,45 +28,45 @@
let(:payload) { default_payload.merge(properties: { test: '1' }) }
let(:command_data) { default_payload.merge(properties: { test: '1' }, context: context) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('filter') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('filter') }
it { expect(command.data).to eql(command_data) }
end

context 'with user_traits' do
let(:payload) { default_payload.merge(user_traits: { test: '1' }) }
let(:command_data) { default_payload.merge(user_traits: { test: '1' }, context: context) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('filter') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('filter') }
it { expect(command.data).to eql(command_data) }
end

context 'when active true' do
let(:payload) { default_payload.merge(context: context.merge(active: true)) }
let(:command_data) { default_payload.merge(context: context.merge(active: true)) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('filter') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('filter') }
it { expect(command.data).to eql(command_data) }
end

context 'when active false' do
let(:payload) { default_payload.merge(context: context.merge(active: false)) }
let(:command_data) { default_payload.merge(context: context.merge(active: false)) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('filter') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('filter') }
it { expect(command.data).to eql(command_data) }
end

context 'when active string' do
let(:payload) { default_payload.merge(context: context.merge(active: 'string')) }
let(:command_data) { default_payload.merge(context: context) }

it { expect(command.method).to be_eql(:post) }
it { expect(command.path).to be_eql('filter') }
it { expect(command.data).to be_eql(command_data) }
it { expect(command.method).to be(:post) }
it { expect(command.path).to eql('filter') }
it { expect(command.data).to eql(command_data) }
end
end
end
4 changes: 2 additions & 2 deletions spec/lib/castle/commands/get_device_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
end

context 'with device_token' do
it { expect(command.method).to be_eql(:get) }
it { expect(command.path).to be_eql("devices/#{device_token}") }
it { expect(command.method).to be(:get) }
it { expect(command.path).to eql("devices/#{device_token}") }
it { expect(command.data).to be_nil }
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/castle/commands/get_devices_for_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
end

context 'with user_id' do
it { expect(command.method).to be_eql(:get) }
it { expect(command.path).to be_eql("users/#{user_id}/devices") }
it { expect(command.method).to be(:get) }
it { expect(command.path).to eql("users/#{user_id}/devices") }
it { expect(command.data).to be_nil }
end
end
Expand Down
Loading

0 comments on commit 2ff6a3c

Please sign in to comment.