diff --git a/.rubocop.yml b/.rubocop.yml index b4f7bf52..f5be18d6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,6 +17,9 @@ Layout/FirstHashElementIndentation: Layout/MultilineMethodCallIndentation: EnforcedStyle: indented +Naming/VariableNumber: + Enabled: false + # We use this extensively, the alternatives are not viable or desirable. RSpec/AnyInstance: Enabled: false diff --git a/app/decorators/models/solidus_paypal_braintree/spree/address_decorator.rb b/app/decorators/models/solidus_paypal_braintree/spree/address_decorator.rb index 90685077..5405c42d 100644 --- a/app/decorators/models/solidus_paypal_braintree/spree/address_decorator.rb +++ b/app/decorators/models/solidus_paypal_braintree/spree/address_decorator.rb @@ -14,7 +14,7 @@ def lastname def full_name name end - + unless ::Spree::Address.methods.include?(:firstname) ::Spree::Address.prepend self end diff --git a/app/models/solidus_paypal_braintree/transaction_address.rb b/app/models/solidus_paypal_braintree/transaction_address.rb index 2ec052be..0a23ec32 100644 --- a/app/models/solidus_paypal_braintree/transaction_address.rb +++ b/app/models/solidus_paypal_braintree/transaction_address.rb @@ -52,11 +52,11 @@ def to_spree_address ) if SolidusSupport.combined_first_and_last_name_in_address? - if first_name.nil? - address.name = name - else - address.name = [first_name, last_name].join(" ") - end + address.name = if first_name.nil? + name + else + [first_name, last_name].join(" ") + end else ::Spree::Deprecation.warn("first_name and last_name are deprecated. Use name instead.", caller) if first_name.nil? diff --git a/lib/generators/solidus_paypal_braintree/install/install_generator.rb b/lib/generators/solidus_paypal_braintree/install/install_generator.rb index a66b7eaa..3121c96c 100644 --- a/lib/generators/solidus_paypal_braintree/install/install_generator.rb +++ b/lib/generators/solidus_paypal_braintree/install/install_generator.rb @@ -11,8 +11,10 @@ def copy_initializer end def add_javascripts - append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_paypal_braintree\n" - append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_paypal_braintree\n" + append_file 'vendor/assets/javascripts/spree/frontend/all.js', + "//= require spree/frontend/solidus_paypal_braintree\n" + append_file 'vendor/assets/javascripts/spree/backend/all.js', + "//= require spree/backend/solidus_paypal_braintree\n" end def add_stylesheets diff --git a/lib/solidus_paypal_braintree/testing_support/factories.rb b/lib/solidus_paypal_braintree/testing_support/factories.rb index 0acc342f..16e74789 100644 --- a/lib/solidus_paypal_braintree/testing_support/factories.rb +++ b/lib/solidus_paypal_braintree/testing_support/factories.rb @@ -19,15 +19,15 @@ factory :address do zipcode { '21088-0255' } - unless SolidusSupport.combined_first_and_last_name_in_address? + if SolidusSupport.combined_first_and_last_name_in_address? + name { 'John Doe' } + else transient do name { "John Doe" } end firstname { name.split(' ').first } lastname { name.split(' ')[1..-1].join(' ') } - else - name { 'John Doe' } end end end diff --git a/solidus_paypal_braintree.gemspec b/solidus_paypal_braintree.gemspec index 50d0df1a..c858f7d0 100644 --- a/solidus_paypal_braintree.gemspec +++ b/solidus_paypal_braintree.gemspec @@ -36,9 +36,9 @@ Gem::Specification.new do |spec| spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3'] spec.add_dependency 'solidus_support', ['>= 0.8.1', '< 1'] - spec.add_development_dependency 'solidus_dev_support', '~> 2.4' - spec.add_development_dependency 'selenium-webdriver' spec.add_development_dependency 'rails-controller-testing' + spec.add_development_dependency 'selenium-webdriver' + spec.add_development_dependency 'solidus_dev_support', '~> 2.4' spec.add_development_dependency 'vcr' spec.add_development_dependency 'webmock' end diff --git a/spec/models/solidus_paypal_braintree/gateway_spec.rb b/spec/models/solidus_paypal_braintree/gateway_spec.rb index 160ad0b8..3808b8a6 100644 --- a/spec/models/solidus_paypal_braintree/gateway_spec.rb +++ b/spec/models/solidus_paypal_braintree/gateway_spec.rb @@ -1,4 +1,3 @@ -# coding: utf-8 require 'spec_helper' require 'webmock' require 'support/order_ready_for_payment'