extracted method

This commit is contained in:
Hauke Klement
2015-02-09 16:24:33 +01:00
parent 342c3a153c
commit 232c6b398f
5 changed files with 14 additions and 10 deletions

View File

@ -29,7 +29,7 @@ describe ErrorsController do
expect(response.body).to eq({hint: hint}.to_json)
end
expect_content_type('application/json')
expect_json
expect_status(200)
end
@ -46,7 +46,7 @@ describe ErrorsController do
expect { request.call }.to change(Error, :count).by(1)
end
expect_content_type('application/json')
expect_json
expect_status(201)
end
end
@ -55,7 +55,7 @@ describe ErrorsController do
before(:each) { post :create, execution_environment_id: FactoryGirl.build(:error).execution_environment.id, error: {}, format: :json }
expect_assigns(error: Error)
expect_content_type('application/json')
expect_json
expect_status(422)
end
end

View File

@ -67,7 +67,7 @@ describe ExecutionEnvironmentsController do
expect_assigns(docker_client: DockerClient)
expect_assigns(execution_environment: :execution_environment)
expect_content_type('application/json')
expect_json
expect_status(200)
end

View File

@ -154,7 +154,7 @@ describe ExercisesController do
expect(assigns(:submission)).to be_a(Submission)
end
expect_content_type('application/json')
expect_json
expect_status(200)
end
@ -170,7 +170,7 @@ describe ExercisesController do
expect(assigns(:submission)).to be_a(Submission)
end
expect_content_type('application/json')
expect_json
expect_status(503)
end
end
@ -188,7 +188,7 @@ describe ExercisesController do
expect(assigns(:submission)).to be_a(Submission)
end
expect_content_type('application/json')
expect_json
expect_status(200)
end
end

View File

@ -21,7 +21,7 @@ describe SubmissionsController do
expect { request.call }.to change(Submission, :count).by(1)
end
expect_content_type('application/json')
expect_json
expect_status(201)
end
@ -29,7 +29,7 @@ describe SubmissionsController do
before(:each) { post :create, submission: {} }
expect_assigns(submission: Submission)
expect_content_type('application/json')
expect_json
expect_status(422)
end
end
@ -169,7 +169,7 @@ describe SubmissionsController do
expect_assigns(docker_client: DockerClient)
expect_assigns(submission: :submission)
expect_content_type('application/json')
expect_json
expect_status(200)
end
end

View File

@ -27,6 +27,10 @@ def expect_flash_message(type, message)
end
end
def expect_json
expect_content_type('application/json')
end
def expect_redirect(path = nil)
if path
it "redirects to #{path}" do