Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update obsolete Rubocop cops #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 3 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ AllCops:
Exclude:
- 'spec/dummy/**/*'
- 'vendor/bundle/**/*'
TargetRubyVersion: 2.1
TargetRubyVersion: 2.3

# Sometimes I believe this reads better
# This also causes spacing issues on multi-line fixes
Expand Down Expand Up @@ -38,9 +38,6 @@ Style/WordArray:
Style/ConditionalAssignment:
Enabled: false

Performance/Count:
Enabled: false

Style/RaiseArgs:
Enabled: false

Expand Down Expand Up @@ -73,10 +70,10 @@ Layout/ClosingParenthesisIndentation:
Layout/MultilineMethodCallIndentation:
Enabled: false

Layout/IndentArray:
Layout/IndentFirstArrayElement:
Enabled: false

Layout/IndentHash:
Layout/IndentFirstHashElement:
Enabled: false

Layout/AlignHash:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

branch = ENV.fetch('SOLIDUS_BRANCH', 'v2.2')
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'bundler'

Bundler::GemHelper.install_tasks
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/spree/checkout_controller_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
module CheckoutControllerDecorator
def update
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/spree/paybright_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
class PaybrightController < Spree::BaseController
# We can't use CSRF protection on a route that's hit by an external service
Expand Down Expand Up @@ -36,6 +38,7 @@ def paybright_params

def redirect_path(order)
return cart_path unless order

order.complete? ? order_path(order) : checkout_state_path(order.state)
end

Expand Down
2 changes: 2 additions & 0 deletions app/models/solidus_paybright/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
class Configuration < Spree::Preferences::Configuration
attr_writer :test_redirect_url
Expand Down
2 changes: 2 additions & 0 deletions app/models/spree/payment_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
module PaymentDecorator
def redirect_url
Expand Down
2 changes: 2 additions & 0 deletions app/models/spree/payment_method/paybright.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Spree
class PaymentMethod::Paybright < Spree::PaymentMethod
preference :api_key, :string
Expand Down
2 changes: 2 additions & 0 deletions app/models/spree/payment_method_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
module PaymentMethodDecorator
def redirect_url(_payment)
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Spree::Core::Engine.routes.draw do
post "/paybright/callback", to: "paybright#callback", as: :paybright_callback
get "/paybright/cancel/:payment_id", to: "paybright#cancel", as: :paybright_cancel
Expand Down
2 changes: 2 additions & 0 deletions lib/generators/solidus_paybright/install/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
module Generators
class InstallGenerator < Rails::Generators::Base
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'solidus_core'
require 'solidus_support'
require 'solidus_paybright/engine'
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/api_client.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "typhoeus"
require "securerandom"
require "digest"
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/callback_validator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
class CallbackValidator
# @param params [Hash] The Paybright callback params
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/engine.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
class Engine < Rails::Engine
require 'spree/core'
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/factories.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

FactoryBot.define do
factory :paybright_payment_method, class: Spree::PaymentMethod::Paybright do
name "Paybright"
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/params_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
class ParamsHelper
include Spree::Core::Engine.routes.url_helpers
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/signing_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "openssl"

module SolidusPaybright
Expand Down
2 changes: 2 additions & 0 deletions lib/solidus_paybright/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module SolidusPaybright
VERSION = '1.1.0'
end
4 changes: 3 additions & 1 deletion solidus_paybright.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
$:.push File.expand_path('../lib', __FILE__)
# frozen_string_literal: true

$:.push File.expand_path('lib', __dir__)
require 'solidus_paybright/version'

Gem::Specification.new do |s|
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/spree/checkout_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

describe Spree::CheckoutController, type: :controller do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/spree/paybright_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

describe Spree::PaybrightController, type: :controller do
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/solidus_paybright/api_client_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

describe SolidusPaybright::ApiClient do
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/solidus_paybright/params_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

describe SolidusPaybright::ParamsHelper do
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/solidus_paybright/signing_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

describe SolidusPaybright::SigningHelper do
Expand Down
2 changes: 2 additions & 0 deletions spec/models/spree/payment_method/paybright_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "spec_helper"

describe Spree::PaymentMethod::Paybright, type: :model do
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Run Coverage report
require 'simplecov'
SimpleCov.start do
Expand All @@ -13,7 +15,7 @@
# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'

require File.expand_path('../dummy/config/environment.rb', __FILE__)
require File.expand_path('dummy/config/environment.rb', __dir__)

require 'rspec/rails'
require 'database_cleaner'
Expand Down