diff options
| author | Alban Peignier | 2018-05-09 16:37:02 +0200 |
|---|---|---|
| committer | Alban Peignier | 2018-05-09 16:37:02 +0200 |
| commit | d7bb9cf0e59a8590761be7af41af5c103024b8e0 (patch) | |
| tree | 4d209bddb294780d928d5d560203164270ebc408 /spec | |
| parent | 7107266518c028bebea7e4a89fd1db1040935b35 (diff) | |
| download | chouette-core-d7bb9cf0e59a8590761be7af41af5c103024b8e0.tar.bz2 | |
Fixes WorkbenchesController and WorkgroupsController specs. Refs #6960
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/workbenches_controller_spec.rb | 14 | ||||
| -rw-r--r-- | spec/controllers/workgroups_controller_spec.rb | 12 |
2 files changed, 13 insertions, 13 deletions
diff --git a/spec/controllers/workbenches_controller_spec.rb b/spec/controllers/workbenches_controller_spec.rb index c6a37a8c0..d9403d7b0 100644 --- a/spec/controllers/workbenches_controller_spec.rb +++ b/spec/controllers/workbenches_controller_spec.rb @@ -5,20 +5,21 @@ RSpec.describe WorkbenchesController, :type => :controller do let(:workbench) { create :workbench, organisation: @user.organisation } let(:compliance_control_set) { create :compliance_control_set, organisation: @user.organisation } + let(:merge_id) { 2**64/2 - 1 } # Let's check we support Bigint describe "GET show" do it "returns http success" do get :show, id: workbench.id - expect(response).to have_http_status(302) + expect(response).to have_http_status(200) end end describe 'PATCH update' do let(:workbench_params){ { - owner_compliance_control_set_ids: { - import: compliance_control_set.id, - merge: 2**64/2 - 1 + compliance_control_set_ids: { + after_import: compliance_control_set.id, + after_merge: merge_id } } } @@ -31,10 +32,9 @@ RSpec.describe WorkbenchesController, :type => :controller do 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 + expect(workbench.reload.compliance_control_set(:after_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 + expect(workbench.reload.owner_compliance_control_set_ids["after_merge"]).to eq merge_id.to_s end end end diff --git a/spec/controllers/workgroups_controller_spec.rb b/spec/controllers/workgroups_controller_spec.rb index 0841b6081..d25e42572 100644 --- a/spec/controllers/workgroups_controller_spec.rb +++ b/spec/controllers/workgroups_controller_spec.rb @@ -4,6 +4,7 @@ RSpec.describe WorkgroupsController, :type => :controller do let(:workgroup) { create :workgroup } let(:workbench) { create :workbench, workgroup: workgroup } let(:compliance_control_set) { create :compliance_control_set, organisation: @user.organisation } + let(:merge_id) { 2**64/2 - 1 } # Let's check we support Bigint describe 'PATCH update' do let(:params){ @@ -13,9 +14,9 @@ RSpec.describe WorkgroupsController, :type => :controller do workbenches_attributes: { "0" => { id: workbench.id, - owner_compliance_control_set_ids: { - import: compliance_control_set.id, - merge: 2**64/2 - 1 + compliance_control_set_ids: { + after_import_by_workgroup: compliance_control_set.id, + after_merge_by_workgroup: merge_id } } } @@ -34,9 +35,8 @@ RSpec.describe WorkgroupsController, :type => :controller do end 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 + expect(workbench.reload.compliance_control_set(:after_import_by_workgroup)).to eq compliance_control_set + expect(workbench.reload.owner_compliance_control_set_ids['after_merge_by_workgroup']).to eq merge_id.to_s end end end |
