Skip to content

Commit

Permalink
chore: Fix linting issues
Browse files Browse the repository at this point in the history
- add_runtime_dependency is deprecated in favour of add_dependency
- params are not required for `super` when the method signature is unchanged
  • Loading branch information
mattbearman committed Sep 12, 2024
1 parent 1f40fd8 commit 9a0b16d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions apia.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Gem::Specification.new do |s|
s.authors = ['Adam Cooke']
s.email = ['adam@k.io']
s.licenses = ['MIT']
s.add_runtime_dependency 'json'
s.add_runtime_dependency 'rack'
s.add_dependency 'json'
s.add_dependency 'rack'
end
2 changes: 1 addition & 1 deletion lib/apia/dsls/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def field(name, *args, type: nil, **options, &block)

field :pagination, type: PaginationObject
end
super(name, *args, type: type, **options, &block)
super
end

def fields(fieldset)
Expand Down
2 changes: 1 addition & 1 deletion spec/specs/apia/argument_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
end

it 'should create a new set using HTTP params if provided' do
env = Rack::MockRequest.env_for('/?name=michael', :input => '')
env = Rack::MockRequest.env_for('/?name=michael', input: '')
request = Apia::Request.new(env)
as = Apia::ArgumentSet.create('ExampleSet') do
argument :name, type: :string
Expand Down
22 changes: 11 additions & 11 deletions spec/specs/apia/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
context '.execute' do
context 'authenticators' do
it 'should call the endpoint authenticator if one has been set' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))

api_auth = Apia::Authenticator.create('ExampleAPIAuthenticator')
api_auth.action { response.add_header 'x-auth', 'api' }
Expand Down Expand Up @@ -45,7 +45,7 @@
end

it 'should call the controller authenticator if one has been set' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))

api_auth = Apia::Authenticator.create('ExampleAPIAuthenticator')
api_auth.action { response.add_header 'x-auth', 'api' }
Expand Down Expand Up @@ -75,7 +75,7 @@
end

it 'should call the API authenticator' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))

api_auth = Apia::Authenticator.create('ExampleAPIAuthenticator')
api_auth.action { response.add_header 'x-auth', 'api' }
Expand All @@ -92,7 +92,7 @@
end

it 'checks the scopes are valid' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))

api_auth = Apia::Authenticator.create('ExampleAPIAuthenticator') do
scope_validator { |e| e == 'not-example' }
Expand Down Expand Up @@ -130,7 +130,7 @@
end

it 'should create an argument set from standard HTTP query string parameters' do
request = Apia::Request.new(Rack::MockRequest.env_for('/?name=Adam', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/?name=Adam', input: ''))
request.endpoint = Apia::Endpoint.create('Endpoint') do
argument :name, type: :string
end
Expand All @@ -144,7 +144,7 @@
context 'it includes CORS headers in the response' do
context 'when nothing is specified' do
it 'includes wildcard CORS headers' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))
endpoint = Apia::Endpoint.create('Endpoint')
response = endpoint.execute(request)
expect(response.headers['Access-Control-Allow-Origin']).to eq '*'
Expand All @@ -154,7 +154,7 @@

context 'when cors values are set by the authenticator' do
it 'includes the CORS headers from the authenticator in the response' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))

authenticator = Apia::Authenticator.create('ExampleAPIAuthenticator')
authenticator.action do
Expand All @@ -176,7 +176,7 @@

context 'when cors values are set by the authenticator and it throws an error' do
it 'includes the CORS headers from the authenticator in the response' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => ''))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: ''))

authenticator = Apia::Authenticator.create('ExampleAPIAuthenticator') do
potential_error 'Failed' do
Expand Down Expand Up @@ -207,7 +207,7 @@

context 'when the request is an OPTIONS request' do
it 'returns a 200 OK status' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => '', method: 'OPTIONS'))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: '', method: 'OPTIONS'))
endpoint = Apia::Endpoint.create('Endpoint')
response = endpoint.execute(request)
expect(response.headers['Access-Control-Allow-Origin']).to eq '*'
Expand All @@ -217,7 +217,7 @@
end

it 'does not execute the endpoint' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => '', method: 'OPTIONS'))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: '', method: 'OPTIONS'))
endpoint = Apia::Endpoint.create('Endpoint')
expect(endpoint).not_to receive(:new)
endpoint.execute(request)
Expand All @@ -226,7 +226,7 @@

context 'when the request is not an OPTIONS request' do
it 'executes the endpoint' do
request = Apia::Request.new(Rack::MockRequest.env_for('/', :input => '', method: 'GET'))
request = Apia::Request.new(Rack::MockRequest.env_for('/', input: '', method: 'GET'))
endpoint = Apia::Endpoint.create('Endpoint')
expect(endpoint).to receive(:new).and_call_original
endpoint.execute(request)
Expand Down

0 comments on commit 9a0b16d

Please sign in to comment.