Commit 300be109 authored by Nicola Justus's avatar Nicola Justus
Browse files

++ semantic in tests

parent f6f4b3ff
......@@ -2,10 +2,19 @@ require 'rails_helper'
describe SubmissionTasksController, type: :controller do
describe 'POST' do
it "should create a task" do
task = build(:submission_task)
post :create, params: task.attributes
expect(response.status).to eq(302)
describe 'on submission tasks' do
it "should create and redirect to created task" do
task = build(:submission_task)
put :create, params: task.attributes
expect(response).to have_http_status(:found)
end
it "should reject without tests" do
task = build(:submission_task_without_test)
put :create, params: task.attributes
#TODO: status for rejection ???
puts "rejected response ",response.inspect
expect(response).not_to have_http_status(:found)
end
end
end
end
require 'rails_helper'
RSpec.describe Task, type: :model do
it "should either need a 'test' or 'hidden_test'" do
it "should reject without one of 'test' or 'hidden_test'" do
task = build(:submission_task_without_test)
expect { task.save! }.to raise_error ActiveRecord::RecordInvalid
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment