Skip to content

Commit

Permalink
Restrict the supported Ruby version to 2.7
Browse files Browse the repository at this point in the history
Also start testing against multiple versions and prevent new cops from
disrupting the CI without control.
  • Loading branch information
elia committed Oct 7, 2022
1 parent 76e511e commit fc16fe7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
34 changes: 28 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,35 @@ orbs:

jobs:
run-specs-with-postgres:
executor: solidusio_extensions/postgres
executor:
name: solidusio_extensions/postgres
ruby_version: '3.1'
steps:
- browser-tools/install-browser-tools
- solidusio_extensions/run-tests
- checkout
- browser-tools/install-chrome
- solidusio_extensions/run-tests-solidus-master
- solidusio_extensions/store-test-results

run-specs-with-mysql:
executor: solidusio_extensions/mysql
executor:
name: solidusio_extensions/mysql
ruby_version: '3.0'
steps:
- checkout
- browser-tools/install-chrome
- solidusio_extensions/run-tests-solidus-current
- solidusio_extensions/store-test-results

run-specs-with-sqlite:
executor:
name: solidusio_extensions/sqlite
ruby_version: '2.7'
steps:
- browser-tools/install-browser-tools
- solidusio_extensions/run-tests
- checkout
- browser-tools/install-chrome
- solidusio_extensions/run-tests-solidus-older
- solidusio_extensions/store-test-results

lint-code:
executor: solidusio_extensions/sqlite-memory
steps:
Expand All @@ -30,6 +50,7 @@ workflows:
jobs:
- run-specs-with-postgres
- run-specs-with-mysql
- run-specs-with-sqlite
- lint-code

"Weekly run specs against master":
Expand All @@ -43,3 +64,4 @@ workflows:
jobs:
- run-specs-with-postgres
- run-specs-with-mysql
- run-specs-with-sqlite
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ require:
- solidus_dev_support/rubocop

AllCops:
NewCops: enable
NewCops: disable
TargetRubyVersion: '2.7'
Exclude:
- sandbox/**/*
- spec/dummy/**/*
Expand Down
4 changes: 2 additions & 2 deletions lib/paypal/paypal_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def initialize(environment, refresh_token = nil)
super(environment)
@refresh_token = refresh_token

add_injector { _1._sign_request }
add_injector { _1._add_headers }
add_injector(&:_sign_request)
add_injector(&:_add_headers)
end

def user_agent
Expand Down
2 changes: 1 addition & 1 deletion solidus_paypal_commerce_platform.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
spec.metadata['changelog_uri'] = 'https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/releases'
spec.metadata['rubygems_mfa_required'] = 'true'

spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
spec.required_ruby_version = Gem::Requirement.new('>= 2.7')

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def Struct(data) # rubocop:disable Naming/MethodName
let(:result) { Struct(purchase_units: [Struct(payments: payments)]) }
let(:payments) { Struct(captures: [Struct(id: SecureRandom.hex(4))]) }

it "sends a purchase request to paypal" do # rubocop:disable Rspec/NoExpectationExample
it "sends a purchase request to paypal" do
paypal_order_id = SecureRandom.hex(8)
source = paypal_payment_method.payment_source_class.create(paypal_order_id: paypal_order_id)
expect_request(:OrdersCaptureRequest).to receive(:new).with(paypal_order_id).and_call_original
Expand All @@ -48,7 +48,7 @@ def Struct(data) # rubocop:disable Naming/MethodName
let(:result) { Struct(purchase_units: [Struct(payments: payments)]) }
let(:payments) { Struct(authorizations: [Struct(id: SecureRandom.hex(4))]) }

it "sends an authorize request to paypal" do # rubocop:disable Rspec/NoExpectationExample
it "sends an authorize request to paypal" do
paypal_order_id = SecureRandom.hex(8)
source = paypal_payment_method.payment_source_class.create(paypal_order_id: paypal_order_id)
expect_request(:OrdersAuthorizeRequest).to receive(:new).with(paypal_order_id)
Expand Down Expand Up @@ -87,7 +87,7 @@ def Struct(data) # rubocop:disable Naming/MethodName
end

describe "#void" do
it "sends a void request to paypal" do # rubocop:disable Rspec/NoExpectationExample
it "sends a void request to paypal" do
authorization_id = SecureRandom.hex(8)
source = paypal_payment_method.payment_source_class.create(authorization_id: authorization_id)
payment.source = source
Expand Down

0 comments on commit fc16fe7

Please sign in to comment.