Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Rails 7.2 #5843

Merged
merged 9 commits into from
Nov 1, 2024
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
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,23 @@ commands:
ruby -v >> /tmp/.ruby-versions
gem --version >> /tmp/.gems-versions
bundle --version >> /tmp/.gems-versions
gem search -eq rails -v "~> 7" -v "< 7.2" >> /tmp/.gems-versions # get the latest rails from rubygems
gem search -eq rails -v "~> 7" -v "< 8.0" >> /tmp/.gems-versions # get the latest rails from rubygems
gem search -eq solidus >> /tmp/.gems-versions # get the latest solidus from rubygems

cat /tmp/.ruby-versions
cat /tmp/.gems-versions
- restore_cache:
keys:
- solidus-installer-v10-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
- solidus-installer-v10-{{ checksum "/tmp/.ruby-versions" }}-
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-
- run:
name: "Prepare the rails application"
command: |
cd /tmp
test -d my_app || (gem install rails -v "< 7.1" && gem install solidus)
test -d my_app || (gem install rails -v "< 8.0" && gem install solidus)
test -d my_app || rails new my_app --skip-git
- save_cache:
key: solidus-installer-v10-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
key: solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
paths:
- /tmp/my_app
- /home/circleci/.rubygems
Expand Down Expand Up @@ -224,8 +224,8 @@ commands:
mkdir -p /tmp/dummy_extension
cd /tmp/dummy_extension
bundle init
bundle add rails -v "< 7.1" --skip-install
bundle add sqlite3 -v "~> 1.3" --skip-install
bundle add rails -v "< 8.0" --skip-install
bundle add sqlite3 -v "~> 2.0" --skip-install
test -n "<<parameters.extra_gems>>" && bundle add <<parameters.extra_gems>> --skip-install
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
export LIB_NAME=set # dummy requireable file
Expand Down Expand Up @@ -374,7 +374,7 @@ workflows:
{
parameters:
{
rails: ["7.0", "7.1"],
rails: ["7.0", "7.1", "7.2"],
ruby: ["3.1"],
database: ["mysql"],
paperclip: [true],
Expand All @@ -386,7 +386,7 @@ workflows:
{
parameters:
{
rails: ["7.0", "7.1"],
rails: ["7.0", "7.1", "7.2"],
ruby: ["3.1"],
database: ["postgres"],
paperclip: [false],
Expand All @@ -398,7 +398,7 @@ workflows:
{
parameters:
{
rails: ["7.0"],
rails: ["7.1"],
ruby: ["3.2"],
database: ["sqlite"],
paperclip: [false],
Expand All @@ -410,8 +410,8 @@ workflows:
{
parameters:
{
rails: ["7.1", "main"],
ruby: ["3.3.2"],
rails: ["7.2", "main"],
ruby: ["3.3.5"],
database: ["sqlite"],
paperclip: [false],
},
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gemspec require: false
if /(stable|main)/.match? ENV['RAILS_VERSION']
gem 'rails', github: 'rails', require: false, branch: ENV['RAILS_VERSION']
else
gem 'rails', ENV['RAILS_VERSION'] || '< 7.2', require: false
gem 'rails', ENV['RAILS_VERSION'] || ['> 7.0', '< 8.0.0.beta1'], require: false
end
# rubocop:enable Bundler/DuplicatedGem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def expect_order_state_label_to_eq(text)
within('[data-hook="rejected_return_items"] tbody tr:nth-child(1)') do
click_button('Receive')

expect(page).to have_button("Receive", disabled: true)
expect(page).to have_button("Receive", disabled: true, wait: 5)
end
end

Expand Down
4 changes: 2 additions & 2 deletions core/app/models/spree/tax_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class TaxRate < Spree::Base
include Spree::CalculatedAdjustments
include Spree::AdjustmentSource

enum level: {
enum :level, {
item: 0,
order: 1
}, _suffix: true
}, suffix: true

belongs_to :zone, class_name: "Spree::Zone", inverse_of: :tax_rates, optional: true

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
apply 'https://github.com/solidusio/solidus_starter_frontend/raw/main/template.rb'
apply 'https://github.com/solidusio/solidus_starter_frontend/raw/rails-7.2/template.rb'

Check warning on line 1 in core/lib/generators/solidus/install/app_templates/frontend/starter.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/generators/solidus/install/app_templates/frontend/starter.rb#L1

Added line #L1 was not covered by tests
1 change: 1 addition & 0 deletions core/lib/spree/testing_support/dummy_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ApplicationController < ActionController::Base

# @private
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

# @private
Expand Down
23 changes: 8 additions & 15 deletions core/lib/spree/testing_support/dummy_app/migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@
module Migrations
extend self

# Ensure database exists
def database_exists?
ActiveRecord::Base.connection
rescue ActiveRecord::NoDatabaseError
false
else
true
end

def needs_migration?
return true if !database_exists?

ActiveRecord::Base.connection.migration_context.needs_migration?
end

def auto_migrate
if needs_migration?
puts "Configuration changed. Re-running migrations"
Expand All @@ -35,6 +20,14 @@

private

def needs_migration?
ActiveRecord::Migration.check_all_pending!
rescue ActiveRecord::PendingMigrationError, ActiveRecord::NoDatabaseError
true
else
false

Check warning on line 28 in core/lib/spree/testing_support/dummy_app/migrations.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/migrations.rb#L28

Added line #L28 was not covered by tests
end

def sh(cmd)
puts cmd
system cmd
Expand Down
4 changes: 2 additions & 2 deletions core/solidus_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Gem::Specification.new do |s|
actionmailer actionpack actionview activejob activemodel activerecord
activestorage activesupport railties
].each do |rails_dep|
s.add_dependency rails_dep, ['>= 7.0', '< 7.2']
s.add_dependency rails_dep, ['>= 7.0', '< 8.0.0.beta1']
end

s.add_dependency 'activemerchant', '~> 1.66'
s.add_dependency 'acts_as_list', '< 2.0'
s.add_dependency 'awesome_nested_set', '~> 3.3'
s.add_dependency 'awesome_nested_set', ['~> 3.3', '>= 3.7.0']
s.add_dependency 'cancancan', ['>= 2.2', '< 4.0']
s.add_dependency 'carmen', '~> 1.1.0'
s.add_dependency 'discard', '~> 1.0'
Expand Down
2 changes: 1 addition & 1 deletion promotions/app/models/solidus_promotions/promotion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Promotion < Spree::Base
joins(:benefits).distinct
end

enum lane: SolidusPromotions.config.preferred_lanes
enum :lane, SolidusPromotions.config.preferred_lanes

def self.with_coupon_code(val)
joins(:codes).where(
Expand Down
Loading