mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
Fix API and tests for new task completion logic [SCI-5004]
This commit is contained in:
parent
73cf620960
commit
57716fd89c
2 changed files with 5 additions and 18 deletions
|
@ -60,13 +60,13 @@ module Api
|
|||
def task_params_create
|
||||
raise TypeError unless params.require(:data).require(:type) == 'tasks'
|
||||
|
||||
params.require(:data).require(:attributes).permit(%i(name x y description state))
|
||||
params.require(:data).require(:attributes).permit(%i(name x y description))
|
||||
end
|
||||
|
||||
def task_params_update
|
||||
raise TypeError unless params.require(:data).require(:type) == 'tasks'
|
||||
|
||||
params.require(:data).require(:attributes).permit(%i(name x y description state my_module_status_id))
|
||||
params.require(:data).require(:attributes).permit(%i(name x y description my_module_status_id))
|
||||
end
|
||||
|
||||
def load_task_for_managing
|
||||
|
|
|
@ -292,7 +292,7 @@ RSpec.describe 'Api::V1::TasksController', type: :request do
|
|||
end
|
||||
end
|
||||
|
||||
context 'task completion, when has valid params' do
|
||||
context 'direct task completion disabled, when has valid params' do
|
||||
let(:request_body) do
|
||||
{
|
||||
data: {
|
||||
|
@ -304,23 +304,10 @@ RSpec.describe 'Api::V1::TasksController', type: :request do
|
|||
}
|
||||
end
|
||||
|
||||
it 'returns status 200' do
|
||||
it 'returns status 204, no changes to task' do
|
||||
action
|
||||
|
||||
expect(response).to have_http_status 200
|
||||
end
|
||||
|
||||
it 'returns well formated response' do
|
||||
action
|
||||
|
||||
expect(json).to match(
|
||||
hash_including(
|
||||
data: hash_including(
|
||||
type: 'tasks',
|
||||
attributes: hash_including(state: 'completed')
|
||||
)
|
||||
)
|
||||
)
|
||||
expect(response).to have_http_status 204
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue