aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcedricnjanga2018-02-28 23:48:47 -0800
committercedricnjanga2018-02-28 23:48:47 -0800
commit72312d258101d06c5f608502f5db1d258583924a (patch)
tree6aab730bd53248ef99ae118ff152c7b1f29b51b8
parent4acb5a53da2995aacc7b6ce2c802ad16fa563bf8 (diff)
downloadchouette-core-72312d258101d06c5f608502f5db1d258583924a.tar.bz2
Refs #6044 Add spec to check that CCSet#index only dislays objets from user orga6044_add_ccset_spec_affectation
- Small change in ComplianceControlSetsHelper#organisations_filters_values to avoid errors - Add spec
-rw-r--r--app/helpers/compliance_control_sets_helper.rb2
-rw-r--r--spec/features/compliance_control_sets_spec.rb15
2 files changed, 16 insertions, 1 deletions
diff --git a/app/helpers/compliance_control_sets_helper.rb b/app/helpers/compliance_control_sets_helper.rb
index 448d5c008..0c63cb139 100644
--- a/app/helpers/compliance_control_sets_helper.rb
+++ b/app/helpers/compliance_control_sets_helper.rb
@@ -1,7 +1,7 @@
module ComplianceControlSetsHelper
def organisations_filters_values
- [current_organisation, Organisation.find_by_name("STIF")].uniq
+ [current_organisation, *Organisation.find_by_name("STIF")].uniq
end
def floating_links ccs_id
diff --git a/spec/features/compliance_control_sets_spec.rb b/spec/features/compliance_control_sets_spec.rb
index 36dc5c2a9..0f4597db3 100644
--- a/spec/features/compliance_control_sets_spec.rb
+++ b/spec/features/compliance_control_sets_spec.rb
@@ -8,6 +8,9 @@ RSpec.describe "ComplianceControlSets", type: :feature do
let( :control_set ){ create :compliance_control_set, organisation: organisation }
let( :controls ){ control_set.compliance_controls }
+ let(:other_orga) { create :organisation }
+ let(:other_control_cset) { create :compliance_control_set, organisation: other_orga }
+
let(:blox){
2.times.map{ | _ | create :compliance_control_block, compliance_control_set: control_set }
}
@@ -95,6 +98,18 @@ RSpec.describe "ComplianceControlSets", type: :feature do
end
+ describe 'index' do
+
+ before do
+ visit compliance_control_sets_path
+ end
+
+ it "only showw compliance control sets from user organisation" do
+ expect(page).not_to have_content (other_orga.name)
+ expect(page).to have_content (organisation.name)
+ end
+ end
+
def make_control ccblock=nil, times: 1, severity: :warning
times.times do
make_one_control ccblock, severity