From 1c1b21652d2462b94e393058865bb3ad518c14ea Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 2 Sep 2024 21:31:33 -0500 Subject: [PATCH 1/5] Update to Ruby 3.0 --- .github/workflows/code-scanning.yml | 2 +- .github/workflows/pr.yml | 2 +- .github/workflows/single-matrix-pr.yml | 2 +- .ruby-version | 2 +- README.md | 2 +- docs/getting_started_wsl2.md | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-scanning.yml b/.github/workflows/code-scanning.yml index b858e9ecb..b93c1f9d9 100644 --- a/.github/workflows/code-scanning.yml +++ b/.github/workflows/code-scanning.yml @@ -12,7 +12,7 @@ concurrency: env: # this version used for running various tools tool_node_version: "16.x" - tool_ruby_version: "2.7.8" + tool_ruby_version: "3.0.6" jobs: eslint: runs-on: ubuntu-latest diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index fdb1d4e58..51a3989be 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -17,6 +17,6 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - ruby: [2.7.8] + ruby: [3.0.6] node: [16.x] diff --git a/.github/workflows/single-matrix-pr.yml b/.github/workflows/single-matrix-pr.yml index 6dc011a5a..5fcf59b9f 100644 --- a/.github/workflows/single-matrix-pr.yml +++ b/.github/workflows/single-matrix-pr.yml @@ -12,7 +12,7 @@ on: env: # this version used for running various tools tool_node_version: "16.x" - tool_ruby_version: "2.7.8" + tool_ruby_version: "3.0.6" jobs: changes: name: "Check for file changes" diff --git a/.ruby-version b/.ruby-version index 6a81b4c83..8ffc1ad64 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.8 +3.0.6 \ No newline at end of file diff --git a/README.md b/README.md index 9b1764846..867462771 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-b #### Ruby install ```bash -rbenv install 2.7.8 +rbenv install 3.0.6 ``` #### Setup project diff --git a/docs/getting_started_wsl2.md b/docs/getting_started_wsl2.md index 0fd4de303..d64e9cfb0 100644 --- a/docs/getting_started_wsl2.md +++ b/docs/getting_started_wsl2.md @@ -9,7 +9,7 @@ These include: * PostgreSQL 12 (10 probably works) * NodeJS 14 (we require 14 because we want the full internationalization built-in) -* Ruby 2.7.8 +* Ruby 3.0.6 There are a few optional tools that make working on Houdini easier: @@ -118,7 +118,7 @@ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-b #### Ruby install ```bash -rbenv install 2.7.8 +rbenv install 3.0.6 ``` > Note: if a build failure occurs, installing the following packages may solve From 40a36cae9563e3a07e7fd3b8313f6a62ebd31410 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 2 Sep 2024 21:32:22 -0500 Subject: [PATCH 2/5] Update some of the test methods in `shared_user_context` to Ruby 3.0 --- spec/controllers/support/shared_user_context.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/controllers/support/shared_user_context.rb b/spec/controllers/support/shared_user_context.rb index 87297ff12..309fb074f 100644 --- a/spec/controllers/support/shared_user_context.rb +++ b/spec/controllers/support/shared_user_context.rb @@ -72,16 +72,16 @@ def __create_associate(host) u end - def send(method, *args) + def send(method, action, args={}) case method when :get - get(*args) + get(action, **args) when :post - post(*args) + post(action, **args) when :delete - delete(*args) + delete(action, **args) when :put - put(*args) + put(action, **args) end end From e773cf456c6dea62b8bdb106cd3c73b8ec18e5b8 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 2 Sep 2024 21:43:30 -0500 Subject: [PATCH 3/5] Update rake to be compatible with Ruby 3 --- Gemfile | 4 ++-- Gemfile.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 40dfdc3de..388d2eb71 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem 'jbuilder', '~> 2.11' gem 'bootsnap', '~> 1.18', require: false # Large rails application booting enhancer gem 'hamster', '~> 3.0' # Thread-safe collection classes for Ruby gem 'puma', '~> 5.6' -gem 'rake', '~> 12.3.2' +gem 'rake' gem 'sassc-rails', '~> 2.1', '>= 2.1.2' gem 'sassc', '~> 2.0', '>= 2.0.1' gem 'stripe', '~> 1.58' # January 19, 2017 version of the Stripe API https://stripe.com/docs/api @@ -103,4 +103,4 @@ gem 'kaminari' gem 'http_accept_language' -gem "js-routes" \ No newline at end of file +gem "js-routes" diff --git a/Gemfile.lock b/Gemfile.lock index 76e3919aa..6c1e1167c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -344,7 +344,7 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (12.3.3) + rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) @@ -530,7 +530,7 @@ DEPENDENCIES rack-timeout (~> 0.6.3) rails (= 6.1.7.7) rails-i18n (~> 6.0.0, ~> 6) - rake (~> 12.3.2) + rake react_on_rails (= 12.6.0) rspec (~> 3.13.0) rspec-json_expectations (~> 2) From 24c5d3eb78f637fcc435153915fca3842297c423 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 2 Sep 2024 22:04:59 -0500 Subject: [PATCH 4/5] Adjust from keyword arguments to options hash expectation in insert_charge_spec --- spec/legacy_lib/insert/insert_charge_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/legacy_lib/insert/insert_charge_spec.rb b/spec/legacy_lib/insert/insert_charge_spec.rb index a518a5179..250f07223 100644 --- a/spec/legacy_lib/insert/insert_charge_spec.rb +++ b/spec/legacy_lib/insert/insert_charge_spec.rb @@ -170,7 +170,7 @@ currency: 'usd', description: 'our statement<> blah-no-way', statement_descriptor: 'our statement blah-n', - metadata: nil }, stripe_account: nonprofit.stripe_account_id).and_wrap_original { |m, *args| m.call(*args) } + metadata: nil }, {stripe_account: nonprofit.stripe_account_id}).and_wrap_original { |m, *args| m.call(*args) } StripeMockHelper.prepare_card_error(:card_declined) finished_result = InsertCharge.with_stripe(amount: 100, @@ -196,7 +196,7 @@ currency: 'usd', description: 'our statement<> blah-no-way', statement_descriptor: 'our statement blah-n', - metadata: nil }, stripe_account: nonprofit.stripe_account_id).and_wrap_original { |m, *args| m.call(*args) } + metadata: nil }, {stripe_account: nonprofit.stripe_account_id}).and_wrap_original { |m, *args| m.call(*args) } StripeMockHelper.prepare_error(Stripe::StripeError.new('blah'), :new_charge) finished_result = InsertCharge.with_stripe(amount: 100, @@ -236,7 +236,7 @@ currency: 'usd', description: 'our statement<> blah-no-way', statement_descriptor: 'our statement blah-n', - metadata: nil }, stripe_account: nonprofit.stripe_account_id).and_wrap_original { |m, *args| + metadata: nil }, {stripe_account: nonprofit.stripe_account_id}).and_wrap_original { |m, *args| a = m.call(*args) stripe_charge_id = a['id'] a @@ -280,7 +280,7 @@ currency: 'usd', description: 'our statement<> blah-no-way', statement_descriptor: 'our statement blah-n', - metadata: nil }, stripe_account: nonprofit.stripe_account_id).and_wrap_original { |m, *args| + metadata: nil }, {stripe_account: nonprofit.stripe_account_id}).and_wrap_original { |m, *args| a = m.call(*args) stripe_charge_id = a['id'] a From bb9e5487012ad5244256f4c6d8d91e1a9da81015 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 2 Sep 2024 22:06:55 -0500 Subject: [PATCH 5/5] Adjust from keyword arguments to options hash expectation in insert_tickets_spec --- spec/legacy_lib/insert/insert_tickets_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/legacy_lib/insert/insert_tickets_spec.rb b/spec/legacy_lib/insert/insert_tickets_spec.rb index 4ec90e6df..e27112db5 100644 --- a/spec/legacy_lib/insert/insert_tickets_spec.rb +++ b/spec/legacy_lib/insert/insert_tickets_spec.rb @@ -300,7 +300,7 @@ def success_expectations expect(Houdini.event_publisher).to receive(:announce).with(:trx_assignment_created, any_args).ordered expect(Houdini.event_publisher).to receive(:announce).with(:transaction_created, any_args).ordered result = InsertTickets.create(tickets: [{ quantity: 1, ticket_level_id: ticket_level.id }], nonprofit_id: nonprofit.id, supporter_id: supporter.id, token: source_token.token, event_id: event.id, kind: 'offsite', offsite_payment: { kind: 'check', check_number: 'fake_checknumber' }, current_user: user) - + expected = generate_expected_tickets(payment_id: result['payment'].id, nonprofit: nonprofit, supporter: supporter, @@ -391,7 +391,7 @@ def success(other_elements = {}) success_expectations expect(Houdini.event_publisher).to receive(:announce).with(:ticket_level_created, any_args).twice expect(Houdini.event_publisher).to receive(:announce).with(:event_discount_created, any_args) - + expect(Houdini.event_publisher).to receive(:announce).with(:stripe_transaction_charge_created, any_args).ordered expect(Houdini.event_publisher).to receive(:announce).with(:payment_created, any_args).ordered expect(Houdini.event_publisher).to receive(:announce).with(:stripe_transaction_created, any_args).ordered @@ -421,7 +421,7 @@ def success(other_elements = {}) currency: 'usd', description: 'Tickets The event of Wonders', statement_descriptor: 'Tickets The event of W', - metadata: { kind: 'Ticket', event_id: event.id, nonprofit_id: nonprofit.id } }, stripe_account: nonprofit.stripe_account_id).and_wrap_original { |m, *args| + metadata: { kind: 'Ticket', event_id: event.id, nonprofit_id: nonprofit.id } }, {stripe_account: nonprofit.stripe_account_id}).and_wrap_original { |m, *args| a = m.call(*args) stripe_charge_id = a['id'] a