diff --git a/.rubocop.yml b/.rubocop.yml index 660803d..8c73e93 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.6 NewCops: enable Layout/LineLength: diff --git a/devbox.json b/devbox.json index 4fbb86c..1be2d41 100644 --- a/devbox.json +++ b/devbox.json @@ -3,7 +3,8 @@ "packages": ["ruby@2.6.8"], "shell": { "scripts": { - "test": ["bundle exec rspec $@"] + "test": ["bundle exec rspec $@"], + "lint": ["bundle exec rubocop -a $@"] } } } diff --git a/lib/vero/api/users/delete_api.rb b/lib/vero/api/users/delete_api.rb index 275031b..d13f106 100644 --- a/lib/vero/api/users/delete_api.rb +++ b/lib/vero/api/users/delete_api.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Vero module Api module Workers @@ -12,7 +14,7 @@ def request end def validate! - raise ArgumentError.new("Missing :id") if options[:id].to_s.blank? + raise ArgumentError, 'Missing :id' if options[:id].to_s.blank? end end end diff --git a/lib/vero/config.rb b/lib/vero/config.rb index e41c20e..219cb3b 100644 --- a/lib/vero/config.rb +++ b/lib/vero/config.rb @@ -23,7 +23,7 @@ def request_params { auth_token: auth_token, development_mode: development_mode - }.reject { |_, v| v.nil? } + }.compact end def domain diff --git a/spec/lib/api/users/delete_api_spec.rb b/spec/lib/api/users/delete_api_spec.rb index 0c1dd9a..5170996 100644 --- a/spec/lib/api/users/delete_api_spec.rb +++ b/spec/lib/api/users/delete_api_spec.rb @@ -1,31 +1,33 @@ +# frozen_string_literal: true + require 'spec_helper' describe Vero::Api::Workers::Users::DeleteAPI do - subject { Vero::Api::Workers::Users::DeleteAPI.new('https://api.getvero.com', {:auth_token => 'abcd', :id => '1234'}) } + subject { Vero::Api::Workers::Users::DeleteAPI.new('https://api.getvero.com', { auth_token: 'abcd', id: '1234' }) } - it_behaves_like "a Vero wrapper" do - let(:end_point) { "/api/v2/users/delete.json" } + it_behaves_like 'a Vero wrapper' do + let(:end_point) { '/api/v2/users/delete.json' } end - it_behaves_like "a Vero wrapper" do - let(:end_point) { "/api/v2/users/delete.json" } + it_behaves_like 'a Vero wrapper' do + let(:end_point) { '/api/v2/users/delete.json' } end describe :validate! do - it "should not raise an error when the keys are Strings" do - subject.options = {"auth_token" => 'abcd', "id" => '1234'} + it 'should not raise an error when the keys are Strings' do + subject.options = { 'auth_token' => 'abcd', 'id' => '1234' } expect { subject.send(:validate!) }.to_not raise_error end - it "should raise an error for missing keys" do - subject.options = {"auth_token" => 'abcd'} + it 'should raise an error for missing keys' do + subject.options = { 'auth_token' => 'abcd' } expect { subject.send(:validate!) }.to raise_error(ArgumentError) end end describe :request do - it "should send a request to the Vero API" do - expect(RestClient).to receive(:post).with("https://api.getvero.com/api/v2/users/delete.json", {:auth_token => 'abcd', :id => '1234'}).and_return(200) + it 'should send a request to the Vero API' do + expect(RestClient).to receive(:post).with('https://api.getvero.com/api/v2/users/delete.json', { auth_token: 'abcd', id: '1234' }).and_return(200) subject.send(:request) end end diff --git a/spec/lib/app_spec.rb b/spec/lib/app_spec.rb index 9ab00e1..6985be7 100644 --- a/spec/lib/app_spec.rb +++ b/spec/lib/app_spec.rb @@ -42,7 +42,7 @@ describe :disable_requests! do it 'should change config.disabled' do - Vero::App.init {} + Vero::App.init expect(context.config.disabled).to be(false) Vero::App.disable_requests! @@ -52,7 +52,7 @@ describe :log do it 'should have a log method' do - Vero::App.init {} + Vero::App.init expect(Vero::App).to receive(:log) Vero::App.log(Object, 'test') end diff --git a/spec/lib/view_helpers_spec.rb b/spec/lib/view_helpers_spec.rb index fe6f317..cba4c78 100644 --- a/spec/lib/view_helpers_spec.rb +++ b/spec/lib/view_helpers_spec.rb @@ -23,7 +23,7 @@ it 'should return an empty string if Vero::App is not properly configured' do expect(subject.vero_javascript_tag).to eq('') - Vero::App.init {} + Vero::App.init expect(subject.vero_javascript_tag).to eq('') end diff --git a/spec/support/vero_user_support.rb b/spec/support/vero_user_support.rb index 5cfd6b1..146490c 100644 --- a/spec/support/vero_user_support.rb +++ b/spec/support/vero_user_support.rb @@ -1,4 +1,3 @@ # frozen_string_literal: true -VeroUser = Struct.new(:api_key, :secret) do -end +VeroUser = Struct.new(:api_key, :secret) diff --git a/vero.gemspec b/vero.gemspec index bb75903..9a96e78 100644 --- a/vero.gemspec +++ b/vero.gemspec @@ -6,7 +6,6 @@ require 'vero/version' Gem::Specification.new do |spec| spec.name = 'vero' spec.version = Vero::VERSION.dup - spec.date = Time.now.strftime('%Y-%m-%d') spec.authors = ['James Lamont'] spec.email = ['support@getvero.com'] @@ -15,7 +14,6 @@ Gem::Specification.new do |spec| spec.homepage = 'http://www.getvero.com/' spec.files = Dir['**/*'] - spec.test_files = Dir['test/**/*'] + Dir['spec/**/*'] spec.executables = Dir['bin/*'].map { |f| File.basename(f) } spec.require_paths = ['lib'] @@ -23,4 +21,5 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'json' spec.add_runtime_dependency 'rest-client' + spec.metadata['rubygems_mfa_required'] = 'true' end