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.1 #2592

Merged
merged 2 commits into from
Oct 24, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
matrix:
rails:
- "7.0"
- "7.1"
ruby:
- "3.0"
- "3.1"
Expand Down
7 changes: 1 addition & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "https://rubygems.org"

gemspec

rails_version = ENV.fetch("RAILS_VERSION", 7.0).to_f
rails_version = ENV.fetch("RAILS_VERSION", "7.1")
gem "rails", "~> #{rails_version}.0"

if ENV["DB"].nil? || ENV["DB"] == "sqlite"
Expand Down Expand Up @@ -48,11 +48,6 @@ end
# Necessary until https://github.com/mikel/mail/pull/1439
# got merged and released.
if Gem.ruby_version >= Gem::Version.new("3.1.0")
if rails_version.to_s.match?(/6.1/)
# Rails 6.1 needs this as well
gem "net-pop", "~> 0.1.0", require: false
gem "net-imap", "~> 0.4.0", require: false
end
gem "net-smtp", "~> 0.4.0", require: false
end

Expand Down
4 changes: 2 additions & 2 deletions alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Gem::Specification.new do |gem|
activesupport
railties
].each do |rails_gem|
gem.add_runtime_dependency rails_gem, [">= 7.0", "< 7.1"]
gem.add_runtime_dependency rails_gem, [">= 7.0", "< 7.2"]
end

gem.add_runtime_dependency "active_model_serializers", ["~> 0.10.0"]
gem.add_runtime_dependency "active_model_serializers", ["~> 0.10.14"]
gem.add_runtime_dependency "acts_as_list", [">= 0.3", "< 2"]
gem.add_runtime_dependency "awesome_nested_set", ["~> 3.1"]
gem.add_runtime_dependency "cancancan", [">= 2.1", "< 4.0"]
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/alchemy/admin/ingredients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def update
private

def ingredient_params
params[:ingredient]&.permit(@ingredient.class.stored_attributes[:data]) || {}
params[:ingredient]&.permit(@ingredient.class.stored_attributes[:data]) ||
ActionController::Parameters.new
end

def load_croppable_resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
end

it "does not update the attributes of ingredient" do
expect(ingredient).to receive(:update).with({})
expect(ingredient).to receive(:update).with(ActionController::Parameters.new.permit)
patch :update, params: params, xhr: true
end
end
Expand All @@ -110,7 +110,7 @@
end

it "does not update the attributes of ingredient" do
expect(ingredient).to receive(:update).with({})
expect(ingredient).to receive(:update).with(ActionController::Parameters.new)
patch :update, params: params, xhr: true
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_05_05_132743) do
ActiveRecord::Schema[7.1].define(version: 2023_05_05_132743) do
create_table "alchemy_attachments", force: :cascade do |t|
t.string "name"
t.string "file_name"
Expand Down
18 changes: 9 additions & 9 deletions spec/models/alchemy/page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1476,36 +1476,36 @@ module Alchemy
end

describe "#set_language" do
let(:default_language) { mock_model("Language", code: "es") }
let(:page) { Page.new }

before { allow(page).to receive(:parent).and_return(parent) }
let(:default_language) { build(:alchemy_language, code: "es") }
let(:page) { build(:alchemy_page, parent: parent) }

subject { page }

context "parent has a language" do
let(:parent) { mock_model("Page", language: default_language, language_id: default_language.id, language_code: default_language.code) }
let(:parent) { create(:alchemy_page, language: default_language, language_id: default_language.id, language_code: default_language.code) }

before do
page.send(:set_language)
end

describe "#language_id" do
subject { super().language_id }
subject { page.language_id }

it { is_expected.to eq(parent.language_id) }
end
end

context "parent has no language" do
let(:parent) { mock_model("Page", language: nil, language_id: nil, language_code: nil) }
let(:parent) { build(:alchemy_page, language: nil, language_id: nil, language_code: nil) }

before do
allow(Language).to receive(:default).and_return(default_language)
expect(Language).to receive(:current).twice { default_language }
page.send(:set_language)
end

describe "#language_id" do
subject { super().language_id }
subject { page.language_id }

it { is_expected.to eq(default_language.id) }
end
end
Expand Down