Skip to content

Commit

Permalink
Test with Rails 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Jan 11, 2024
1 parent 03236f0 commit 7cd5bbb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
- "3.1"
- "3.2"
- "3.3"
rails:
- "7.0"
- "7.1"
database:
- mysql
- postgresql
Expand All @@ -25,6 +28,7 @@ jobs:
DB_PASSWORD: password
DB_HOST: "127.0.0.1"
RAILS_ENV: test
RAILS_VERSION: ${{ matrix.rails }}
ALCHEMY_BRANCH: ${{ matrix.alchemy_branch }}
services:
postgres:
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ source "https://rubygems.org"
alchemy_branch = ENV.fetch("ALCHEMY_BRANCH", "main")
gem "alchemy_cms", github: "AlchemyCMS/alchemy_cms", branch: alchemy_branch

gem "rails", "~> 7.0.0"
rails_version = ENV.fetch("RAILS_VERSION", "7.1")
gem "rails", "~> #{rails_version}.0"
gem "listen", "~> 3.8"
gem "puma", "~> 6.0"

Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/admin/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module Alchemy
}
expect(user)
.to receive(:update_without_password)
.with(params_hash).and_return(true)
.with(ActionController::Parameters.new(params_hash).permit!).and_return(true)

post :update, params: {id: user.id, user: params_hash, format: :js}
end
Expand All @@ -135,7 +135,7 @@ module Alchemy
"password" => "newpassword",
"password_confirmation" => "newpassword"
}
expect(user).to receive(:update).with(params_hash)
expect(user).to receive(:update).with(ActionController::Parameters.new(params_hash).permit!)

post :update, params: {id: user.id, user: params_hash, format: :js}
end
Expand Down Expand Up @@ -177,7 +177,7 @@ module Alchemy
it "updates the user including role" do
expect(user)
.to receive(:update_without_password)
.with({"alchemy_roles" => ["Administrator"]})
.with(ActionController::Parameters.new({"alchemy_roles" => ["Administrator"]}).permit!)
post :update, params: {id: user.id, user: {alchemy_roles: ["Administrator"]}, format: :js}
end
end
Expand All @@ -191,7 +191,7 @@ module Alchemy
end

it "updates user without role" do
expect(user).to receive(:update_without_password).with({})
expect(user).to receive(:update_without_password).with(ActionController::Parameters.new.permit!)
post :update, params: {id: user.id, user: {alchemy_roles: ["Administrator"]}, format: :js}
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults ENV.fetch("RAILS_VERSION", "7.1").to_f

# Configuration for the application, engines, and railties goes here.
#
Expand Down

0 comments on commit 7cd5bbb

Please sign in to comment.