diff options
| author | Teddy Wing | 2017-11-08 16:43:31 +0100 |
|---|---|---|
| committer | cedricnjanga | 2017-11-13 17:52:54 +0100 |
| commit | 80f932d417744488c7dadc53d7369ca573f1fc61 (patch) | |
| tree | 77b5c20fc5067f303812d94493337294bf88c385 | |
| parent | 089f3d3268aa73acdb162a5479740bb2d36aff67 (diff) | |
| download | chouette-core-80f932d417744488c7dadc53d7369ca573f1fc61.tar.bz2 | |
ComplianceCheckSetsController: Get ComplianceCheckSet and update status
Get the `ComplianceCheckSet` from the URL and call its `#update_status`
method.
This doesn't currently work all the way. We need to send a real
response.
Refs #4757
| -rw-r--r-- | app/controllers/api/v1/compliance_check_sets_controller.rb | 4 | ||||
| -rw-r--r-- | spec/controllers/api/v1/compliance_check_sets_controller_spec.rb | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/controllers/api/v1/compliance_check_sets_controller.rb b/app/controllers/api/v1/compliance_check_sets_controller.rb index b7206014d..e34d269ee 100644 --- a/app/controllers/api/v1/compliance_check_sets_controller.rb +++ b/app/controllers/api/v1/compliance_check_sets_controller.rb @@ -1,6 +1,6 @@ class Api::V1::ComplianceCheckSetsController < Api::V1::IbooController - defaults resource_class: ComplianceCheckSet - def validated + @compliance_check_set = ComplianceCheckSet.find(params[:id]) + @compliance_check_set.update_status end end diff --git a/spec/controllers/api/v1/compliance_check_sets_controller_spec.rb b/spec/controllers/api/v1/compliance_check_sets_controller_spec.rb index c9c58c7cb..e8e24b530 100644 --- a/spec/controllers/api/v1/compliance_check_sets_controller_spec.rb +++ b/spec/controllers/api/v1/compliance_check_sets_controller_spec.rb @@ -1,7 +1,12 @@ RSpec.describe Api::V1::ComplianceCheckSetsController, type: :controller do + include_context 'iboo authenticated api user' + describe "POST #validate" do - it "calls [that thing that updates statuses on ComplianceCheckX]" do - post :validated, params: { id: 5 } + it "calls #update_status on the ComplianceCheckSet" do + check_set = create(:compliance_check_set) + expect_any_instance_of(ComplianceCheckSet).to receive(:update_status) + + patch :validated, id: check_set.id end end end |
