ActionController::Parameter no longer is a hash

pull/4862/head
Jens Ulferts 8 years ago
parent af2018fb5d
commit cf8b2c568e
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 2
      app/controllers/repositories_controller.rb
  2. 7
      spec/controllers/repositories_controller_spec.rb

@ -96,7 +96,7 @@ class RepositoriesController < ApplicationController
@users += User.where(id: additional_user_ids) unless additional_user_ids.empty?
@users.compact!
@users.sort!
if request.post? && params[:committers].is_a?(Hash)
if request.post? && params[:committers].respond_to?(:values)
# Build a hash with repository usernames as keys and corresponding user ids as values
@repository.committer_ids = params[:committers].values
.inject({}) { |h, c|

@ -205,6 +205,7 @@ describe RepositoriesController, type: :controller do
describe 'committers' do
let(:role) { FactoryGirl.create(:role, permissions: [:manage_repository]) }
describe '#get' do
before do
get :committers
@ -215,14 +216,16 @@ describe RepositoriesController, type: :controller do
expect(response).to render_template 'repositories/committers'
end
end
describe '#post' do
before do
repository.fetch_changesets
post :committers, committers: {'0' => ['oliver', user.id] }, "commit"=>"Update"
post :committers, params: { committers: { '0' => ['oliver', user.id] },
commit: 'Update' }
end
it 'should be successful' do
expect(response).to be_redirect
expect(response).to redirect_to committers_project_repository_path(project)
expect(repository.committers).to include(['oliver', user.id])
end
end

Loading…
Cancel
Save