Merge pull request #3995 from oliverguenther/fix/22245-category-edit

[22245] Fix invalid params on category edit
pull/3999/head
ulferts 9 years ago
commit 5089be9036
  1. 4
      app/controllers/categories_controller.rb
  2. 25
      spec/controllers/categories_controller_spec.rb

@ -65,10 +65,6 @@ class CategoriesController < ApplicationController
end
end
def edit
@category.attributes = permitted_params.category
end
def update
@category.attributes = permitted_params.category
if @category.save

@ -88,6 +88,31 @@ describe CategoriesController, type: :controller do
end
describe '#edit' do
let(:category) {
FactoryGirl.create(:category,
project: project)
}
subject { response }
before do
get :edit,
id: category_id
end
context 'valid category' do
let(:category_id) { category.id }
it { is_expected.to be_success }
it { is_expected.to render_template('edit') }
end
context 'invalid category' do
let(:category_id) { 404 }
it { is_expected.to be_not_found }
end
end
describe '#update' do
let(:name) { 'Testing' }
context 'valid category' do

Loading…
Cancel
Save