Fix tests and rename request variable in specs to perform_request

Explanation: Using the variable name `request` might interfere with methods in Rails core system prevent successful test execution. See this issue: https://github.com/turbolinks/turbolinks-rails/issues/38
This commit is contained in:
Sebastian Serth
2018-10-08 09:53:04 +02:00
parent 9106ab182b
commit 90defa8f89
14 changed files with 80 additions and 79 deletions

View File

@ -7,13 +7,13 @@ describe EventsController do
describe 'POST #create' do
context 'with a valid event' do
let(:request) { proc { post :create, params: { event: {category: 'foo', data: 'bar', exercise_id: exercise.id, file_id: exercise.files[0].id} } } }
before(:each) { request.call }
let(:perform_request) { proc { post :create, params: { event: {category: 'foo', data: 'bar', exercise_id: exercise.id, file_id: exercise.files[0].id} } } }
before(:each) { perform_request.call }
expect_assigns(event: Event)
it 'creates the Event' do
expect { request.call }.to change(Event, :count).by(1)
expect { perform_request.call }.to change(Event, :count).by(1)
end
expect_status(201)