diff options
| author | Zog | 2018-05-09 10:19:33 +0200 |
|---|---|---|
| committer | Zog | 2018-05-09 10:19:33 +0200 |
| commit | 64933b6903583b585f7de5bc391a9ab2ade1c6a7 (patch) | |
| tree | 844875f2cc8f62f9561e2b9b840dee2c6d2128d4 /spec | |
| parent | 9434284e4f12b4b576762dabbd2b0a308e28bc61 (diff) | |
| download | chouette-core-64933b6903583b585f7de5bc391a9ab2ade1c6a7.tar.bz2 | |
Refs #6961; Update Workbench#edit
- Update the form
- Use policies and update the seeds accordingly
- Add a link in the navbar(s)
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/workbenches_controller_spec.rb | 31 | ||||
| -rw-r--r-- | spec/controllers/workgroups_controller_spec.rb | 5 |
2 files changed, 34 insertions, 2 deletions
diff --git a/spec/controllers/workbenches_controller_spec.rb b/spec/controllers/workbenches_controller_spec.rb index bc0843a07..c6a37a8c0 100644 --- a/spec/controllers/workbenches_controller_spec.rb +++ b/spec/controllers/workbenches_controller_spec.rb @@ -1,7 +1,10 @@ require 'spec_helper' RSpec.describe WorkbenchesController, :type => :controller do - let(:workbench) { create :workbench } + login_user + + let(:workbench) { create :workbench, organisation: @user.organisation } + let(:compliance_control_set) { create :compliance_control_set, organisation: @user.organisation } describe "GET show" do it "returns http success" do @@ -10,4 +13,30 @@ RSpec.describe WorkbenchesController, :type => :controller do end end + describe 'PATCH update' do + let(:workbench_params){ + { + owner_compliance_control_set_ids: { + import: compliance_control_set.id, + merge: 2**64/2 - 1 + } + } + } + let(:request){ patch :update, id: workbench.id, workbench: workbench_params } + + it 'should respond with 403' do + expect(request).to have_http_status 403 + end + + with_permission "workbenches.update" do + it 'returns HTTP success' do + expect(request).to redirect_to [workbench] + p workbench.reload.owner_compliance_control_set_ids + expect(workbench.reload.compliance_control_set(:import)).to eq compliance_control_set + # Let's check we support Bigint + expect(workbench.reload.owner_compliance_control_set_ids["merge"]).to eq (2**64/2 - 1).to_s + end + end + end + end diff --git a/spec/controllers/workgroups_controller_spec.rb b/spec/controllers/workgroups_controller_spec.rb index 2f8565088..0841b6081 100644 --- a/spec/controllers/workgroups_controller_spec.rb +++ b/spec/controllers/workgroups_controller_spec.rb @@ -14,7 +14,8 @@ RSpec.describe WorkgroupsController, :type => :controller do "0" => { id: workbench.id, owner_compliance_control_set_ids: { - import: compliance_control_set.id + import: compliance_control_set.id, + merge: 2**64/2 - 1 } } } @@ -34,6 +35,8 @@ RSpec.describe WorkgroupsController, :type => :controller do it 'returns HTTP success' do expect(request).to be_redirect expect(workbench.reload.compliance_control_set(:import)).to eq compliance_control_set + # Let's check we support Bigint + expect(workbench.reload.owner_compliance_control_set_ids["merge"]).to eq (2**64/2 - 1).to_s end end end |
