Upgrade Rails to version 5.2.1 and adopt code & specs where necessary

Signed-off-by: Sebastian Serth <Sebastian.Serth@student.hpi.de>
This commit is contained in:
Sebastian Serth
2018-09-13 12:21:53 +02:00
parent 108190c242
commit de52db89f0
128 changed files with 786 additions and 422 deletions

View File

@ -8,7 +8,7 @@ describe HintsController do
describe 'POST #create' do
context 'with a valid hint' do
let(:request) { proc { post :create, execution_environment_id: execution_environment.id, hint: FactoryBot.attributes_for(:ruby_syntax_error) } }
let(:request) { proc { post :create, params: { execution_environment_id: execution_environment.id, hint: FactoryBot.attributes_for(:ruby_syntax_error) } } }
before(:each) { request.call }
expect_assigns(execution_environment: :execution_environment)
@ -22,7 +22,7 @@ describe HintsController do
end
context 'with an invalid hint' do
before(:each) { post :create, execution_environment_id: execution_environment.id, hint: {} }
before(:each) { post :create, params: { execution_environment_id: execution_environment.id, hint: {} } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: Hint)
@ -32,21 +32,21 @@ describe HintsController do
end
describe 'DELETE #destroy' do
before(:each) { delete :destroy, execution_environment_id: execution_environment.id, id: hint.id }
before(:each) { delete :destroy, params: { execution_environment_id: execution_environment.id, id: hint.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: Hint)
it 'destroys the hint' do
hint = FactoryBot.create(:ruby_syntax_error)
expect { delete :destroy, execution_environment_id: execution_environment.id, id: hint.id }.to change(Hint, :count).by(-1)
expect { delete :destroy, params: { execution_environment_id: execution_environment.id, id: hint.id } }.to change(Hint, :count).by(-1)
end
expect_redirect { execution_environment_hints_path(execution_environment) }
end
describe 'GET #edit' do
before(:each) { get :edit, execution_environment_id: execution_environment.id, id: hint.id }
before(:each) { get :edit, params: { execution_environment_id: execution_environment.id, id: hint.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: Hint)
@ -56,7 +56,7 @@ describe HintsController do
describe 'GET #index' do
before(:all) { FactoryBot.create_pair(:ruby_syntax_error) }
before(:each) { get :index, execution_environment_id: execution_environment.id }
before(:each) { get :index, params: { execution_environment_id: execution_environment.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hints: Hint.all)
@ -65,7 +65,7 @@ describe HintsController do
end
describe 'GET #new' do
before(:each) { get :new, execution_environment_id: execution_environment.id }
before(:each) { get :new, params: { execution_environment_id: execution_environment.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: Hint)
@ -74,7 +74,7 @@ describe HintsController do
end
describe 'GET #show' do
before(:each) { get :show, execution_environment_id: execution_environment.id, id: hint.id }
before(:each) { get :show, params: { execution_environment_id: execution_environment.id, id: hint.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: :hint)
@ -84,7 +84,7 @@ describe HintsController do
describe 'PUT #update' do
context 'with a valid hint' do
before(:each) { put :update, execution_environment_id: execution_environment.id, hint: FactoryBot.attributes_for(:ruby_syntax_error), id: hint.id }
before(:each) { put :update, params: { execution_environment_id: execution_environment.id, hint: FactoryBot.attributes_for(:ruby_syntax_error), id: hint.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: Hint)
@ -92,7 +92,7 @@ describe HintsController do
end
context 'with an invalid hint' do
before(:each) { put :update, execution_environment_id: execution_environment.id, hint: {name: ''}, id: hint.id }
before(:each) { put :update, params: { execution_environment_id: execution_environment.id, hint: {name: ''}, id: hint.id } }
expect_assigns(execution_environment: :execution_environment)
expect_assigns(hint: Hint)