Skip to content

Commit

Permalink
Merge pull request #193 from tvdeyen/rails-7.1
Browse files Browse the repository at this point in the history
Rails 7.1 support
  • Loading branch information
tvdeyen authored Jan 11, 2024
2 parents 19e08fe + ba7c00e commit e1ba042
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ log/*.log
pkg/
spec/dummy/config/initializers/devise.rb
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/db/*.sqlite3-*
spec/dummy/log/*.log
spec/dummy/tmp/
spec/dummy/.sass-cache
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
2 changes: 1 addition & 1 deletion alchemy-devise.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "factory_bot_rails"
s.add_development_dependency "rails-controller-testing"
s.add_development_dependency "rspec-activemodel-mocks", "~> 1.0"
s.add_development_dependency "rspec-rails", "~> 6.0.1"
s.add_development_dependency "rspec-rails", "~> 6.0"
s.add_development_dependency "simplecov"

s.post_install_message = <<~MSG
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
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Eager loading loads your whole application. When running a single test locally,
# this probably isn't necessary. It's a good idea to do in a continuous integration
# system, or in some way before deploying your code.
config.eager_load = ENV["CI"].present?
config.eager_load = false

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
Expand Down

0 comments on commit e1ba042

Please sign in to comment.