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
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ jobs:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }} tests
strategy:
fail-fast: false

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really matter, it just means "if one test in the matrix fails, do we cancel all others". I think it's worth seeing what does succeed vs fail, hence the change. But when everything is green, it's no difference.

matrix:
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, jruby-9.3]
# '4' is a prefix match resolved against the version list baked into the
# setup-ruby commit pinned below, so it only tracks new 4.x releases as far
# as that pin. Bump the pin to pick up newer ones.
ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0.5', '4', 'jruby-9.3']

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.0.5 is what we use in Evergreen currently, hence that version specifically. 4 is just to test any future versions (currently 4.0.6)

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3
- name: Setup ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ matrix.ruby }}
- run: ./scripts/build
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/pr-review.yml

This file was deleted.

6 changes: 3 additions & 3 deletions lib/recurly_v2/xml/nokogiri.rb

@grantcox grantcox Sep 2, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the same change in lib/recurly_v2/xml/rexml.rb are both "broken in production" bugs (ArgumentError will be raised in Ruby 3 onwards), they're not just CI issues.

However, Claude has traced this and the only use is for redaction of CVVs in debug log messages, and so is only invoked if the RECURLY_INSECURE_DEBUG env var is true. I've confirmed we don't set this env var anywhere, so that's why we haven't had any issues ourselves.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the issue in rexml.rb was fixed upstream in recurly@f516a11#diff-b2b37bc25c4fe579fc6b01c5356a20e8d4f7fb730fd2f2cba26c942f38d72722 , although this nokogiri.rb issue is still present.

I will create another PR updating us to the latest upstream v2 branch. But that will come after this one - we want CI to actually be running (and green) to confirm that this version update does still pass completely, on all relevant Ruby versions.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def each_element xpath = nil
elements.each { |el| yield el }
end

def each element = root
def each element = root, &block
element.elements.each do |el|
yield el
each el, &Proc.new
block.call el
each el, &block
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/recurly_v2/xml/rexml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def each_element xpath = nil
root.each_element(xpath) { |el| yield el }
end

def each element = root
def each element = root, &block
element.each_element do |el|
yield el
each el, &Proc.new
block.call el
each el, &block
end
end

Expand Down
20 changes: 17 additions & 3 deletions recurly.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ Gem::Specification.new do |s|
s.add_development_dependency 'nokogiri', '~> 1.8', '>= 1.8.2'
end

s.add_development_dependency 'rake', '~> 11.3'
s.add_development_dependency 'minitest', '~> 5.8', '>= 5.8.0'
# logger left the default gems in Ruby 4.0; spec_helper requires it.
s.add_development_dependency 'logger'
# rake 11 requires ostruct, gone from Ruby 4.0's default gems.
s.add_development_dependency 'rake', '>= 11.3'
# Held to the 5.x line: minitest 6 needs Ruby >= 3.2, dropped the global must_*
# expectations this suite is written in, and moved Minitest::Mock to a gem that
# itself needs Ruby >= 3.1 — none of which the old half of the matrix can meet.
s.add_development_dependency 'minitest', '~> 5.8'
# Restores must_* if a bundled minitest 6 wins activation over the pin above.
s.add_development_dependency 'minitest-global_expectations'
# On Ruby 4.0 the bundled minitest 6 does win, and it no longer ships
# Minitest::Mock. Earlier Rubies keep getting Mock from minitest 5 itself.
if RUBY_VERSION >= '4.0'
s.add_development_dependency 'minitest-mock'
end
s.add_development_dependency 'addressable', '~> 2.4', '>= 2.4.0'
s.add_development_dependency 'webmock', '~> 2.3', '>= 2.3.2'
# webmock 2.x requires base64, gone from Ruby 3.4's default gems.
s.add_development_dependency 'webmock', '>= 2.3.2'
s.add_development_dependency 'simplecov', '~> 0'

if RUBY_PLATFORM != 'java' && !ENV['CI']
Expand Down
8 changes: 6 additions & 2 deletions spec/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
require 'stringio'
old_stderr, $stderr = $stderr, StringIO.new
at_exit do
$stderr.rewind
$stderr.lines.each { |line| old_stderr.puts line if line.include? lib }
# Warnings from anywhere but lib are noise, but suppressing them unconditionally
# also swallows load errors and leaves a failing run with no output at all.
failing = !$!.nil? && !($!.is_a?(SystemExit) && $!.success?)
buffered, $stderr = $stderr, old_stderr
buffered.rewind
buffered.each_line { |line| old_stderr.puts line if failing || line.include?(lib) }
end

case ENV['XML']
Expand Down
6 changes: 3 additions & 3 deletions spec/recurly_v2/adjustment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
juris_detail.tax_in_cents[:USD].must_equal 115
juris_detail.rate.must_equal 0.056
juris_detail.description.must_equal 'Sales Tax'
juris_detail.jurisdiction_name.must_equal nil
juris_detail.jurisdiction_name.must_be_nil
end

it "must raise an exception when unavailable" do
Expand All @@ -107,7 +107,7 @@
stub_api_request :get, 'adjustments/abcdef1234567890', 'adjustments/show-200-nosub'

adjustment = Adjustment.find 'abcdef1234567890'
adjustment.subscription.must_equal nil
adjustment.subscription.must_be_nil
end

describe '#marshal_dump' do
Expand All @@ -117,7 +117,7 @@
adjustment = Adjustment.find 'abcdef1234567890'
adjustment_from_dump = Marshal.load(Marshal.dump(adjustment))

adjustment.instance_variables.must_equal adjustment_from_dump.instance_variables
adjustment.instance_variables.sort.must_equal adjustment_from_dump.instance_variables.sort
end

it 'must return the same values' do
Expand Down
10 changes: 5 additions & 5 deletions spec/recurly_v2/api/errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
let(:error) { RecurlyV2::API::ResponseError.new nil, nil }

it "must return nil" do
error.send(:xml).must_equal nil
error.send(:xml).must_be_nil
end
end

describe "when response assigned" do
let(:response) { MiniTest::Mock.new }
let(:response) { Minitest::Mock.new }
let(:error) { RecurlyV2::API::ResponseError.new nil, response }

describe "when xml already cached" do
Expand All @@ -28,15 +28,15 @@
before { response.expect :body, nil }

it "must return nil" do
error.send(:xml).must_equal nil
error.send(:xml).must_be_nil
end
end

describe "when response body is empty string" do
before { 2.times { response.expect :body, '' } }

it "must return nil" do
error.send(:xml).must_equal nil
error.send(:xml).must_be_nil
end
end

Expand All @@ -54,7 +54,7 @@
before { 3.times { response.expect :body, html } }

it "must return nil" do
error.send(:xml).must_equal nil
error.send(:xml).must_be_nil
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/recurly_v2/billing_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

it "is accessible as an attribute" do
billing_info_without_cc_bin_country = BillingInfo.find 'without-cc-bin'
billing_info_without_cc_bin_country.cc_bin_country.must_equal nil
billing_info_without_cc_bin_country.cc_bin_country.must_be_nil

billing_info_with_cc_bin_country = BillingInfo.find 'with-cc-bin'
billing_info_with_cc_bin_country.cc_bin_country.must_equal 'US'
Expand Down Expand Up @@ -229,7 +229,7 @@
billing_info = BillingInfo.find 'abcdef1234567890'
billing_info_from_dump = Marshal.load(Marshal.dump(billing_info))

billing_info.instance_variables.must_equal billing_info_from_dump.instance_variables
billing_info.instance_variables.sort.must_equal billing_info_from_dump.instance_variables.sort
end

it 'must return the same values' do
Expand Down
2 changes: 1 addition & 1 deletion spec/recurly_v2/credit_payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
credit_payment = CreditPayment.find('12345')

credit_payment_from_dump = Marshal.load(Marshal.dump(credit_payment))
credit_payment.instance_variables.must_equal credit_payment_from_dump.instance_variables
credit_payment.instance_variables.sort.must_equal credit_payment_from_dump.instance_variables.sort
end

it 'must return the same values' do
Expand Down
8 changes: 4 additions & 4 deletions spec/recurly_v2/gift_card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
gift_card.balance_in_cents.must_equal 1_000
gift_card.currency.must_equal "USD"
gift_card.created_at.must_equal DateTime.parse("2016-07-28T00:01:48Z")
gift_card.canceled_at.must_equal nil
gift_card.delivered_at.must_equal nil
gift_card.canceled_at.must_be_nil
gift_card.delivered_at.must_be_nil
gift_card.id.must_equal 2004005808969875135
gift_card.product_code.must_equal "gift_card"
gift_card.redeemed_at.must_equal DateTime.parse("2016-07-28T00:01:46Z")
Expand All @@ -54,7 +54,7 @@

delivery.must_be_instance_of RecurlyV2::Delivery
delivery.method.must_equal "email"
delivery.deliver_at.must_equal nil
delivery.deliver_at.must_be_nil
delivery.email_address.must_equal "john@example.com"
delivery.first_name.must_equal "John"
delivery.last_name.must_equal "Smith"
Expand All @@ -64,7 +64,7 @@
address = delivery.address

address.address1.must_equal "400 Alabama St"
address.address2.must_equal nil
address.address2.must_be_nil
address.city.must_equal "San Francisco"
address.state.must_equal "CA"
address.zip.must_equal "94110"
Expand Down
4 changes: 2 additions & 2 deletions spec/recurly_v2/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,12 @@ def record.to_param() 1 end
it "must return nil if persisted with changes" do
record.persist!
record[:uuid] = 'changed'
record.valid?.must_equal nil
record.valid?.must_be_nil
end

it "must return nil if not persisted with changes and no errors" do
record[:uuid] = 'changed'
record.valid?.must_equal nil
record.valid?.must_be_nil
end

it "must return false if it has errors" do
Expand Down
6 changes: 3 additions & 3 deletions spec/recurly_v2/subscription_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
stub_api_request :get, 'subscriptions/abcdef1234567890', 'subscriptions/show-200-noinvoice'

subscription = Subscription.find 'abcdef1234567890'
subscription.invoice.must_equal nil
subscription.invoice.must_be_nil
end
end
end
Expand Down Expand Up @@ -405,12 +405,12 @@

it "should be able to pause and resume a subscription" do
sub = RecurlyV2::Subscription.find('abcdef1234567890')
sub.paused_at.must_equal nil
sub.paused_at.must_be_nil
sub.pause(1).must_equal true
sub.paused_at.must_be_instance_of DateTime
sub.remaining_pause_cycles.must_equal 1
sub.resume.must_equal true
sub.remaining_pause_cycles.must_equal nil
sub.remaining_pause_cycles.must_be_nil
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/recurly_v2/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
transaction = Transaction.find 'abcdef1234567890'
transaction_from_dump = Marshal.load(Marshal.dump(transaction))

transaction.instance_variables.must_equal transaction_from_dump.instance_variables
transaction.instance_variables.sort.must_equal transaction_from_dump.instance_variables.sort
end

it 'must return the same values' do
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
require 'cgi'
require 'minitest/autorun'
require 'minitest/spec'
require 'minitest/global_expectations'
require 'minitest/mock'
require 'webmock'

WebMock.enable!
Expand Down
Loading