diff --git a/.github/workflows/rspec_tests.yml b/.github/workflows/rspec_tests.yml index 816fda8a8..dc106a34b 100644 --- a/.github/workflows/rspec_tests.yml +++ b/.github/workflows/rspec_tests.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: ruby: ["3.1", "3.2", "3.3"] - gemfile: ["stripe_12", "stripe_13"] + gemfile: ["stripe_12", "stripe_13", "stripe_14", "stripe_15"] env: BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile steps: diff --git a/Appraisals b/Appraisals index 690909cd7..ff78e1117 100644 --- a/Appraisals +++ b/Appraisals @@ -1,3 +1,11 @@ +appraise "stripe-15" do + gem "stripe", "15.3.0" +end + +appraise "stripe-14" do + gem "stripe", "14.0.0" +end + appraise "stripe-13" do gem "stripe", "13.4.0" end diff --git a/gemfiles/stripe_12.gemfile.lock b/gemfiles/stripe_12.gemfile.lock index 88b5215e0..5d77a7510 100644 --- a/gemfiles/stripe_12.gemfile.lock +++ b/gemfiles/stripe_12.gemfile.lock @@ -1,11 +1,11 @@ PATH remote: .. specs: - stripe-ruby-mock (4.0.0) + stripe-ruby-mock (5.0.0) dante (>= 0.2.0) drb (>= 2.0.4, < 3) multi_json (~> 1.0) - stripe (> 5, < 14) + stripe (> 5, < 16) GEM remote: https://rubygems.org/ @@ -16,32 +16,32 @@ GEM thor (>= 0.14.0) daemons (1.4.1) dante (0.2.0) - diff-lcs (1.6.1) - dotenv (2.8.1) - drb (2.2.1) + diff-lcs (1.6.2) + dotenv (3.1.8) + drb (2.2.3) eventmachine (1.2.7) - multi_json (1.15.0) - rack (2.2.13) - rake (13.2.1) - rspec (3.13.0) + multi_json (1.17.0) + rack (2.2.20) + rake (13.3.0) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.3) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.2) + rspec-support (3.13.6) stripe (12.6.0) thin (1.8.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (1.3.2) + thor (1.4.0) PLATFORMS ruby diff --git a/gemfiles/stripe_13.gemfile.lock b/gemfiles/stripe_13.gemfile.lock index 8c3e4d4f1..e519e8955 100644 --- a/gemfiles/stripe_13.gemfile.lock +++ b/gemfiles/stripe_13.gemfile.lock @@ -1,11 +1,11 @@ PATH remote: .. specs: - stripe-ruby-mock (4.0.0) + stripe-ruby-mock (5.0.0) dante (>= 0.2.0) drb (>= 2.0.4, < 3) multi_json (~> 1.0) - stripe (> 5, < 14) + stripe (> 5, < 16) GEM remote: https://rubygems.org/ @@ -16,32 +16,32 @@ GEM thor (>= 0.14.0) daemons (1.4.1) dante (0.2.0) - diff-lcs (1.6.1) - dotenv (2.8.1) - drb (2.2.1) + diff-lcs (1.6.2) + dotenv (3.1.8) + drb (2.2.3) eventmachine (1.2.7) - multi_json (1.15.0) - rack (2.2.13) - rake (13.2.1) - rspec (3.13.0) + multi_json (1.17.0) + rack (2.2.20) + rake (13.3.0) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.3) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.2) + rspec-support (3.13.6) stripe (13.4.0) thin (1.8.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (1.3.2) + thor (1.4.0) PLATFORMS ruby diff --git a/gemfiles/stripe_14.gemfile b/gemfiles/stripe_14.gemfile new file mode 100644 index 000000000..490aaff68 --- /dev/null +++ b/gemfiles/stripe_14.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal" +gem "stripe", "14.0.0" + +group :test do + gem "rake" + gem "dotenv" +end + +gemspec path: "../" diff --git a/gemfiles/stripe_14.gemfile.lock b/gemfiles/stripe_14.gemfile.lock new file mode 100644 index 000000000..1a268001d --- /dev/null +++ b/gemfiles/stripe_14.gemfile.lock @@ -0,0 +1,60 @@ +PATH + remote: .. + specs: + stripe-ruby-mock (5.0.0) + dante (>= 0.2.0) + drb (>= 2.0.4, < 3) + multi_json (~> 1.0) + stripe (> 5, < 16) + +GEM + remote: https://rubygems.org/ + specs: + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + daemons (1.4.1) + dante (0.2.0) + diff-lcs (1.6.2) + dotenv (3.1.8) + drb (2.2.3) + eventmachine (1.2.7) + multi_json (1.17.0) + rack (2.2.20) + rake (13.3.0) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.6) + stripe (14.0.0) + thin (1.8.2) + daemons (~> 1.0, >= 1.0.9) + eventmachine (~> 1.0, >= 1.0.4) + rack (>= 1, < 3) + thor (1.4.0) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + appraisal + dotenv + rake + rspec (~> 3.13.0) + stripe (= 14.0.0) + stripe-ruby-mock! + thin (~> 1.8.1) + +BUNDLED WITH + 2.6.6 diff --git a/gemfiles/stripe_15.gemfile b/gemfiles/stripe_15.gemfile new file mode 100644 index 000000000..dc2fdbc2f --- /dev/null +++ b/gemfiles/stripe_15.gemfile @@ -0,0 +1,13 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal" +gem "stripe", "15.3.0" + +group :test do + gem "rake" + gem "dotenv" +end + +gemspec path: "../" diff --git a/gemfiles/stripe_15.gemfile.lock b/gemfiles/stripe_15.gemfile.lock new file mode 100644 index 000000000..6cc538d5e --- /dev/null +++ b/gemfiles/stripe_15.gemfile.lock @@ -0,0 +1,60 @@ +PATH + remote: .. + specs: + stripe-ruby-mock (5.0.0) + dante (>= 0.2.0) + drb (>= 2.0.4, < 3) + multi_json (~> 1.0) + stripe (> 5, < 16) + +GEM + remote: https://rubygems.org/ + specs: + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + daemons (1.4.1) + dante (0.2.0) + diff-lcs (1.6.2) + dotenv (3.1.8) + drb (2.2.3) + eventmachine (1.2.7) + multi_json (1.17.0) + rack (2.2.20) + rake (13.3.0) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.6) + stripe (15.3.0) + thin (1.8.2) + daemons (~> 1.0, >= 1.0.9) + eventmachine (~> 1.0, >= 1.0.4) + rack (>= 1, < 3) + thor (1.4.0) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + appraisal + dotenv + rake + rspec (~> 3.13.0) + stripe (= 15.3.0) + stripe-ruby-mock! + thin (~> 1.8.1) + +BUNDLED WITH + 2.6.6 diff --git a/spec/shared_stripe_examples/invoice_examples.rb b/spec/shared_stripe_examples/invoice_examples.rb index afab6c43f..a5f39285f 100644 --- a/spec/shared_stripe_examples/invoice_examples.rb +++ b/spec/shared_stripe_examples/invoice_examples.rb @@ -210,7 +210,10 @@ end end - context "retrieving upcoming invoice" do + # Note: Invoice.upcoming was removed in Stripe 14.0.0 + # https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md#1400---2025-04-01 + # Use Invoice.create_preview instead + context "retrieving upcoming invoice", skip: (Gem::Version.new(Stripe::VERSION) >= Gem::Version.new('14.0.0')) do let(:customer) { Stripe::Customer.create(source: stripe_helper.generate_card_token) } let(:coupon_amtoff) { stripe_helper.create_coupon(id: '100OFF', currency: 'usd', amount_off: 100_00, duration: 'repeating', duration_in_months: 6) } let(:coupon_pctoff) { stripe_helper.create_coupon(id: '50OFF', currency: 'usd', percent_off: 50, amount_off: nil, duration: 'repeating', duration_in_months: 6) } diff --git a/spec/shared_stripe_examples/subscription_examples.rb b/spec/shared_stripe_examples/subscription_examples.rb index 213aa26f0..360056426 100644 --- a/spec/shared_stripe_examples/subscription_examples.rb +++ b/spec/shared_stripe_examples/subscription_examples.rb @@ -586,7 +586,7 @@ ] ) - expect(subscription.current_period_end).to eq (Time.now + (7 * 60 * 60 * 24)).to_i + expect(subscription.current_period_end).to be_within(2).of((Time.now + (7 * 60 * 60 * 24)).to_i) end it 'sets current_period_end based on price month interval', live: true do @@ -599,7 +599,7 @@ ] ) - expect(subscription.current_period_end).to eq (DateTime.now >> 1).to_time.to_i + expect(subscription.current_period_end).to be_within(2).of((DateTime.now >> 1).to_time.to_i) end it 'sets current_period_end based on price year interval', live: true do @@ -612,7 +612,7 @@ ] ) - expect(subscription.current_period_end).to eq (DateTime.now >> 12).to_time.to_i + expect(subscription.current_period_end).to be_within(2).of((DateTime.now >> 12).to_time.to_i) end it 'add a new subscription to bill via an invoice' do diff --git a/stripe-ruby-mock.gemspec b/stripe-ruby-mock.gemspec index b212ec912..73ed9d200 100644 --- a/stripe-ruby-mock.gemspec +++ b/stripe-ruby-mock.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |gem| gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] - gem.add_dependency 'stripe', '> 5', '< 14' + gem.add_dependency 'stripe', '> 5', '< 16' gem.add_dependency 'multi_json', '~> 1.0' gem.add_dependency 'dante', '>= 0.2.0' gem.add_dependency 'drb', '>= 2.0.4', '< 3'