Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.6
NewCops: enable

Layout/LineLength:
Expand Down
3 changes: 2 additions & 1 deletion devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"packages": ["ruby@2.6.8"],
"shell": {
"scripts": {
"test": ["bundle exec rspec $@"]
"test": ["bundle exec rspec $@"],
"lint": ["bundle exec rubocop -a $@"]
}
}
}
4 changes: 3 additions & 1 deletion lib/vero/api/users/delete_api.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Vero
module Api
module Workers
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/vero/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def request_params
{
auth_token: auth_token,
development_mode: development_mode
}.reject { |_, v| v.nil? }
}.compact
end

def domain
Expand Down
24 changes: 13 additions & 11 deletions spec/lib/api/users/delete_api_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/view_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions spec/support/vero_user_support.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true

VeroUser = Struct.new(:api_key, :secret) do
end
VeroUser = Struct.new(:api_key, :secret)
3 changes: 1 addition & 2 deletions vero.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand All @@ -15,12 +14,12 @@ 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']

spec.required_ruby_version = '>= 2.6.6'

spec.add_runtime_dependency 'json'
spec.add_runtime_dependency 'rest-client'
spec.metadata['rubygems_mfa_required'] = 'true'
Comment thread
jylamont marked this conversation as resolved.
end