From 260da33ac6ddb7943735df49cfb8fe288c28692e Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:20:43 +1000 Subject: [PATCH 1/3] ci: bump MySQL from 5.7 to 8.0 --- .github/workflows/ci-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 9ce999c..0e7999e 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -14,7 +14,7 @@ jobs: DB: ${{ matrix.db }} services: mysql: - image: mysql:5.7 + image: mysql:8.0 env: MYSQL_DATABASE: double_entry_test MYSQL_USER: mysql From 4b5229b15d81393de82f93ce4eab25a02ba2e762 Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Fri, 26 Dec 2025 19:50:20 +0700 Subject: [PATCH 2/3] ci: Update the test matrix to use Rails 8.1, 8.0, 7.2, and Ruby 4.0, 3.4, 3.3, 3.2 --- .github/workflows/ci-workflow.yml | 5 +++-- CHANGELOG.md | 3 +++ README.md | 10 +++++----- spec/support/gemfiles/Gemfile.rails-7.1.x | 10 ---------- .../{Gemfile.rails-7.0.x => Gemfile.rails-7.2.x} | 8 ++++---- spec/support/gemfiles/Gemfile.rails-8.0.x | 10 ++++++++++ .../{Gemfile.rails-6.1.x => Gemfile.rails-8.1.x} | 8 ++++---- 7 files changed, 29 insertions(+), 25 deletions(-) delete mode 100644 spec/support/gemfiles/Gemfile.rails-7.1.x rename spec/support/gemfiles/{Gemfile.rails-7.0.x => Gemfile.rails-7.2.x} (60%) create mode 100644 spec/support/gemfiles/Gemfile.rails-8.0.x rename spec/support/gemfiles/{Gemfile.rails-6.1.x => Gemfile.rails-8.1.x} (60%) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 0e7999e..cf3650a 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -5,9 +5,10 @@ jobs: name: 'Test (Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }}, DB: ${{ matrix.db }})' runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - ruby: ['3.3', '3.2', '3.1', '3.0'] - rails: ['7.1', '7.0', '6.1'] + ruby: ['4.0', '3.4', '3.3', '3.2'] + rails: ['8.1', '8.0', '7.2'] db: [mysql, postgres, sqlite] env: BUNDLE_GEMFILE: ${{ github.workspace }}/spec/support/gemfiles/Gemfile.rails-${{ matrix.rails }}.x diff --git a/CHANGELOG.md b/CHANGELOG.md index 48e60e3..29d88bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +- Run the test suite against Rails 8.1, 8.0, 7.2, and Ruby 4.0, 3.4, 3.3, 3.2 ([#225]). + [Unreleased]: https://github.com/envato/double_entry/compare/v2.0.1...HEAD +[#225]: https://github.com/envato/double_entry/pull/225 ## [2.0.1] - 2023-11-01 diff --git a/README.md b/README.md index c845bec..980cf34 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,15 @@ DoubleEntry uses the [Money gem](https://github.com/RubyMoney/money) to encapsul DoubleEntry is tested against: Ruby + * 4.0.x + * 3.4.x * 3.3.x * 3.2.x - * 3.1.x - * 3.0.x Rails - * 7.1.x - * 7.0.x - * 6.1.x + * 8.1.x + * 8.0.x + * 7.2.x Databases * MySQL diff --git a/spec/support/gemfiles/Gemfile.rails-7.1.x b/spec/support/gemfiles/Gemfile.rails-7.1.x deleted file mode 100644 index 7617a0a..0000000 --- a/spec/support/gemfiles/Gemfile.rails-7.1.x +++ /dev/null @@ -1,10 +0,0 @@ -source 'https://rubygems.org' - -gemspec path: '../../../' - -gem 'activerecord', '~> 7.1.0' - -# Rails imposed database gem constraints -gem 'mysql2', '~> 0.5' # https://github.com/rails/rails/blob/7-1-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6 -gem 'pg', '~> 1.1' # https://github.com/rails/rails/blob/7-1-stable/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L3 -gem 'sqlite3', '~> 1.4' # https://github.com/rails/rails/blob/7-1-stable/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 diff --git a/spec/support/gemfiles/Gemfile.rails-7.0.x b/spec/support/gemfiles/Gemfile.rails-7.2.x similarity index 60% rename from spec/support/gemfiles/Gemfile.rails-7.0.x rename to spec/support/gemfiles/Gemfile.rails-7.2.x index 5fc29c6..ca047d1 100644 --- a/spec/support/gemfiles/Gemfile.rails-7.0.x +++ b/spec/support/gemfiles/Gemfile.rails-7.2.x @@ -2,9 +2,9 @@ source 'https://rubygems.org' gemspec path: '../../../' -gem 'activerecord', '~> 7.0.0' +gem 'activerecord', '~> 7.2.0' # Rails imposed database gem constraints -gem 'mysql2', '~> 0.5' # https://github.com/rails/rails/blob/7-0-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6 -gem 'pg', '~> 1.1' # https://github.com/rails/rails/blob/7-0-stable/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L3 -gem 'sqlite3', '~> 1.4' # https://github.com/rails/rails/blob/7-0-stable/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 +gem 'mysql2', '~> 0.5' # https://github.com/rails/rails/blob/7-2-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6 +gem 'pg', '~> 1.1' # https://github.com/rails/rails/blob/7-2-stable/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L3 +gem 'sqlite3', '~> 1.4' # https://github.com/rails/rails/blob/7-2-stable/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 diff --git a/spec/support/gemfiles/Gemfile.rails-8.0.x b/spec/support/gemfiles/Gemfile.rails-8.0.x new file mode 100644 index 0000000..5ab71a7 --- /dev/null +++ b/spec/support/gemfiles/Gemfile.rails-8.0.x @@ -0,0 +1,10 @@ +source 'https://rubygems.org' + +gemspec path: '../../../' + +gem 'activerecord', '~> 8.0.0' + +# Rails imposed database gem constraints +gem 'mysql2', '~> 0.5' # https://github.com/rails/rails/blob/8-0-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6 +gem 'pg', '~> 1.1' # https://github.com/rails/rails/blob/8-0-stable/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L3 +gem 'sqlite3', '>= 2.1' # https://github.com/rails/rails/blob/8-0-stable/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 diff --git a/spec/support/gemfiles/Gemfile.rails-6.1.x b/spec/support/gemfiles/Gemfile.rails-8.1.x similarity index 60% rename from spec/support/gemfiles/Gemfile.rails-6.1.x rename to spec/support/gemfiles/Gemfile.rails-8.1.x index f3c6870..d29a9db 100644 --- a/spec/support/gemfiles/Gemfile.rails-6.1.x +++ b/spec/support/gemfiles/Gemfile.rails-8.1.x @@ -2,9 +2,9 @@ source 'https://rubygems.org' gemspec path: '../../../' -gem 'activerecord', '~> 6.1.0' +gem 'activerecord', '~> 8.1.0' # Rails imposed database gem constraints -gem 'mysql2', '~> 0.5' # https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6 -gem 'pg', '~> 1.1' # https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L3 -gem 'sqlite3', '~> 1.4' # https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 +gem 'mysql2', '~> 0.5' # https://github.com/rails/rails/blob/8-1-stable/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L6 +gem 'pg', '~> 1.1' # https://github.com/rails/rails/blob/8-1-stable/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L3 +gem 'sqlite3', '>= 2.1' # https://github.com/rails/rails/blob/8-1-stable/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L14 From ebb93751821e10f3d26fd67729479f009b285026 Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Fri, 26 Dec 2025 20:06:04 +0700 Subject: [PATCH 3/3] tests: configure a default currency --- script/jack_hammer | 2 ++ spec/double_entry/validation/line_check_spec.rb | 2 +- spec/support/money.rb | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/script/jack_hammer b/script/jack_hammer index d2af4d3..503c41d 100755 --- a/script/jack_hammer +++ b/script/jack_hammer @@ -40,6 +40,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'double_entry' require 'double_entry/line' +Money.default_currency = Money::Currency.new('USD') + def parse_options $account_count = 5 $process_count = 20 diff --git a/spec/double_entry/validation/line_check_spec.rb b/spec/double_entry/validation/line_check_spec.rb index 1c26f88..fb8ca3b 100644 --- a/spec/double_entry/validation/line_check_spec.rb +++ b/spec/double_entry/validation/line_check_spec.rb @@ -76,7 +76,7 @@ module Validation its(:errors_found) { should be true } its(:log) { should include <<~LOG } - Error on account \#{Account account: savings scope: currency: USD}: 100.01 (cached balance) != 100.00 (running balance) + Error on account \#{Account account: savings scope: currency: }: 100.01 (cached balance) != 100.00 (running balance) LOG it 'should correct the account balance' do diff --git a/spec/support/money.rb b/spec/support/money.rb index 452a5f5..384ed4d 100644 --- a/spec/support/money.rb +++ b/spec/support/money.rb @@ -1 +1,2 @@ Money.locale_backend = :i18n +Money.default_currency = Money::Currency.new('USD')