Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
Dozentron
Dozentron
Commits
300be109
Commit
300be109
authored
Apr 12, 2018
by
Nicola Justus
Browse files
++ semantic in tests
parent
f6f4b3ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
spec/features/task_spec.rb
View file @
300be109
...
...
@@ -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
spec/models/task_spec.rb
View file @
300be109
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment