diff options
| author | Xinhui Xu | 2017-09-19 11:45:30 +0200 |
|---|---|---|
| committer | GitHub | 2017-09-19 11:45:30 +0200 |
| commit | 8673b6d0c0f947209053f66ebb3a77669517566c (patch) | |
| tree | 8d3de103af3802634cb4f1de0f3b86fba07f5a02 | |
| parent | 1defcfa262845b2acd75ceac2d200f11ddf3a54e (diff) | |
| parent | f0e348e360a5c5b940356b95e75905f9794d2332 (diff) | |
| download | chouette-core-8673b6d0c0f947209053f66ebb3a77669517566c.tar.bz2 | |
Merge pull request #72 from af83/4466-compliance_control_sets
4466 compliance control sets
30 files changed, 419 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore index 29cc18f2e..41d838ee0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ public/assets/ chouette2.war vendor/bundle .ruby-version +.byebug_history start.sh coverage diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb new file mode 100644 index 000000000..1b23becaa --- /dev/null +++ b/app/controllers/compliance_control_sets_controller.rb @@ -0,0 +1,33 @@ +class ComplianceControlSetsController < BreadcrumbController + defaults resource_class: ComplianceControlSet + respond_to :html + + def index + index! do |format| + format.html { + @compliance_control_sets = decorate_compliance_control_sets(@compliance_control_sets) + } + end + end + + def show + show! do + @compliance_control_set = @compliance_control_set.decorate + end + end + + def decorate_compliance_control_sets(compliance_control_sets) + ModelDecorator.decorate( + compliance_control_sets, + with: ComplianceControlSetDecorator + ) + end + + protected + + private + + def compliance_control_set_params + params.require(:compliance_control_set).permit(:name) + end +end diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb new file mode 100644 index 000000000..d198f2cdb --- /dev/null +++ b/app/controllers/compliance_controls_controller.rb @@ -0,0 +1,22 @@ +class ComplianceControlsController < BreadcrumbController + defaults resource_class: ComplianceControl + belongs_to :compliance_control_set + + def create + create!(notice: t('notice.compliance_control.created')) + end + + def update + path = compliance_control_set_compliance_control_path(parent, resource) + update!(notice: t('notice.compliance_control.updated')) { path } + end + + def destroy + destroy!(notice: t('notice.compliance_control.destroyed')) + end + + private + def compliance_control_params + params.require(:compliance_control).permit(:name, :code, :criticity, :comment, :control_attributes) + end +end diff --git a/app/decorators/compliance_control_set_decorator.rb b/app/decorators/compliance_control_set_decorator.rb new file mode 100644 index 000000000..876a54d09 --- /dev/null +++ b/app/decorators/compliance_control_set_decorator.rb @@ -0,0 +1,26 @@ +class ComplianceControlSetDecorator < Draper::Decorator + delegate_all + + def action_links + links = [] + + # if h.policy(object).destroy? + links << Link.new( + content: h.destroy_link_content, + href: h.compliance_control_set_path(object.id), + method: :delete, + data: { confirm: h.t('compliance_control_sets.actions.destroy_confirm') } + ) + # end + + # if h.policy(object).edit? + links << Link.new( + content: h.t('compliance_control_sets.actions.edit'), + href: h.edit_compliance_control_set_path(object.id) + ) + # end + links + end + +end + diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index 55031d4f3..a3ee9de72 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -50,6 +50,8 @@ module BreadcrumbHelper compliance_check_breadcrumb action when "ComplianceCheckTask" compliance_check_task_breadcrumb action + when "ComplianceControlSets" + compliance_control_sets_breadcrumb action when "RuleParameterSet" rule_parameter_breadcrumb action when "User" @@ -239,6 +241,11 @@ module BreadcrumbHelper add_breadcrumb breadcrumb_label(@compliance_check_task), referential_compliance_check_task_path(@referential, @compliance_check_task),:title => breadcrumb_tooltip(@compliance_check_task) if action == :edit end + def compliance_control_sets_breadcrumb (action) + add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path + #add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) + end + def rule_parameter_breadcrumb (action) organisation_breadcrumb add_breadcrumb Referential.human_attribute_name("rule_parameter_sets"), organisation_path unless action == :index diff --git a/app/helpers/compliance_control_sets_helper.rb b/app/helpers/compliance_control_sets_helper.rb new file mode 100644 index 000000000..3e02e0ef7 --- /dev/null +++ b/app/helpers/compliance_control_sets_helper.rb @@ -0,0 +1,2 @@ +module ComplianceControlSetsHelper +end diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index ec4d487c1..95f53a90d 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -344,7 +344,6 @@ module TableBuilderHelper ) end end - def gear_menu_link(link) content_tag( :li, diff --git a/app/helpers/table_builder_helper/url.rb b/app/helpers/table_builder_helper/url.rb index f7ba703ae..a53ac5620 100644 --- a/app/helpers/table_builder_helper/url.rb +++ b/app/helpers/table_builder_helper/url.rb @@ -3,7 +3,7 @@ module TableBuilderHelper def self.polymorphic_url_parts(item, referential) polymorph_url = [] - unless item.is_a?(Calendar) || item.is_a?(Referential) + unless item.is_a?(Calendar) || item.is_a?(Referential) || item.is_a?(ComplianceControlSet) if referential polymorph_url << referential polymorph_url << item.line if item.respond_to? :line diff --git a/app/models/compliance_control_set.rb b/app/models/compliance_control_set.rb index 7801eb612..cefdfbf1f 100644 --- a/app/models/compliance_control_set.rb +++ b/app/models/compliance_control_set.rb @@ -1,3 +1,7 @@ class ComplianceControlSet < ActiveRecord::Base belongs_to :organisation + has_many :compliance_controls + + validates :name, presence: true + end diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 895ca03d9..ba65ad375 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -4,6 +4,7 @@ class Organisation < ActiveRecord::Base has_many :users, :dependent => :destroy has_many :referentials, :dependent => :destroy has_many :rule_parameter_sets, :dependent => :destroy + has_many :compliance_control_sets, :dependent => :destroy has_many :stop_area_referential_memberships has_many :stop_area_referentials, through: :stop_area_referential_memberships diff --git a/app/policies/compliance_control_set_policy.rb b/app/policies/compliance_control_set_policy.rb new file mode 100644 index 000000000..12b829aa4 --- /dev/null +++ b/app/policies/compliance_control_set_policy.rb @@ -0,0 +1,7 @@ +class ComplianceControlSetPolicy < ApplicationPolicy + class Scope < Scope + def resolve + scope + end + end +end diff --git a/app/views/compliance_control_sets/_filters.html.slim b/app/views/compliance_control_sets/_filters.html.slim new file mode 100644 index 000000000..8da629e9c --- /dev/null +++ b/app/views/compliance_control_sets/_filters.html.slim @@ -0,0 +1,33 @@ += search_form_for @q_for_form, url: workbench_path(@workbench.id), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f| + .ffg-row + .input-group.search_bar + = f.search_field :name_cont, class: 'form-control', placeholder: t('referentials.filters.name') + span.input-group-btn + button.btn.btn-default type='submit' + span.fa.fa-search + + .ffg-row + .form-group + = f.label t('activerecord.models.line.one').upcase, required: false, class: 'control-label' + = f.input :associated_lines_id_eq, as: :select, collection: @workbench.lines.includes(:company).order(:name), input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('referentials.filters.line') }, label: false, label_method: :display_name, wrapper_html: { class: 'select2ed'} + + .form-group.togglable + = f.label Referential.human_attribute_name(:status), required: false, class: 'control-label' + .form-group.checkbox_list + = f.input :archived_at_not_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at')}<span class='fa fa-archive'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } + = f.input :archived_at_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at_null')}<span class='sb sb-lg sb-preparing'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } + + .form-group.togglable + = f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label' + = f.input :organisation_name_eq_any, collection: Organisation.order('name').pluck(:name), as: :check_boxes, label: false, label_method: lambda{|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } + + .form-group.togglable + = f.label Referential.human_attribute_name(:validity_period), required: false, class: 'control-label' + .filter_menu + = f.simple_fields_for :validity_period do |p| + = p.input :begin_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true + = p.input :end_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true + + .actions + = link_to t('actions.erase'), @workbench, class: 'btn btn-link' + = f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn' diff --git a/app/views/compliance_control_sets/_form.html.slim b/app/views/compliance_control_sets/_form.html.slim new file mode 100644 index 000000000..cf144bbd9 --- /dev/null +++ b/app/views/compliance_control_sets/_form.html.slim @@ -0,0 +1,8 @@ += simple_form_for @compliance_control_set, html: { class: 'form-horizontal', id: 'compliance_control_set_form' }, wrapper: :horizontal_form do |f| + .row + .col-lg-12 + = f.input :name + + .separator + + = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'compliance_control_set_form' diff --git a/app/views/compliance_control_sets/edit.html.slim b/app/views/compliance_control_sets/edit.html.slim new file mode 100644 index 000000000..a9b8d7253 --- /dev/null +++ b/app/views/compliance_control_sets/edit.html.slim @@ -0,0 +1,10 @@ +/ PageHeader += pageheader 'modele-calendrier', + t('compliance_control_sets.index.edit') + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = render 'form' diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim new file mode 100644 index 000000000..16879af5a --- /dev/null +++ b/app/views/compliance_control_sets/index.html.slim @@ -0,0 +1,51 @@ +/ PageHeader +- header_params = ['jeux-de-donnees', + t('compliance_control_sets.index.title'), + ''] +- header_params << link_to(t('compliance_control_sets.actions.new'), new_compliance_control_set_path, class: 'btn btn-default') if policy(Calendar).create? += pageheader(*header_params) do + + / Below is secundary actions & optional contents (filters, ...) + .row.mb-sm + .col-lg-12.text-right + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-12 + /= render 'filters' + .row + .col-lg-12 + .select_table + = table_builder_2 @compliance_control_sets, + [ \ + TableBuilderHelper::Column.new( \ + key: :name, \ + attribute: 'name', \ + link_to: lambda do |compliance_control_set| \ + compliance_control_set_path(@compliance_control_sets, compliance_control_set) \ + end \ + ), \ + TableBuilderHelper::Column.new( \ + key: :assignment, \ + attribute: 'assignment' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :owner_jdc, \ + attribute: 'owner_jdc' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :control_numbers, \ + attribute: 'control_numbers' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :update, \ + attribute: '' \ + ) \ + ], + sortable: true, + links: [:show], + cls: 'table has-filter has-search' + + diff --git a/app/views/compliance_control_sets/new.html.slim b/app/views/compliance_control_sets/new.html.slim new file mode 100644 index 000000000..d6be41ee8 --- /dev/null +++ b/app/views/compliance_control_sets/new.html.slim @@ -0,0 +1,11 @@ +/ PageHeader += pageheader 'modele-calendrier', + t('compliance_control_sets.index.new') + + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = render 'form' diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim new file mode 100644 index 000000000..b4a5b2260 --- /dev/null +++ b/app/views/compliance_control_sets/show.html.slim @@ -0,0 +1,25 @@ +/ PageHeader += pageheader 'jeux-de-donnees', + @compliance_control_set.name, + 'Lorem ipsum dolor sit amet' + + / Below is secondary actions & optional contents (filters, ...) + .row.mb-sm + .col-lg-12.text-right + - @compliance_control_set.action_links.each do |link| + - if link.is_a?(HTMLElement) + = link.to_html(class: 'btn btn-primary') + - else + = link_to link.href, + method: link.method, + data: link.data, + class: 'btn btn-primary' do + = link.content + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-6.col-md-6.col-sm-12.col-xs-12 + = definition_list t('metadatas'), + ComplianceControlSet.human_attribute_name(:name) => @compliance_control_set.name
\ No newline at end of file diff --git a/app/views/compliance_controls/edit.html.slim b/app/views/compliance_controls/edit.html.slim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/compliance_controls/edit.html.slim diff --git a/app/views/compliance_controls/index.html.slim b/app/views/compliance_controls/index.html.slim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/compliance_controls/index.html.slim diff --git a/app/views/compliance_controls/new.html.slim b/app/views/compliance_controls/new.html.slim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/compliance_controls/new.html.slim diff --git a/app/views/compliance_controls/show.html.slim b/app/views/compliance_controls/show.html.slim new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/compliance_controls/show.html.slim diff --git a/app/views/layouts/navigation/_main_nav_left.html.slim b/app/views/layouts/navigation/_main_nav_left.html.slim index 4560f5fa0..12139c93b 100644 --- a/app/views/layouts/navigation/_main_nav_left.html.slim +++ b/app/views/layouts/navigation/_main_nav_left.html.slim @@ -11,7 +11,7 @@ .menu-item.panel .panel-heading h4.panel-title - = link_to '#miOne', data: { toggle: 'collapse', parent: '#menu-items' }, 'aria-expanded' => 'false' do + = link_to '#miOne', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do |Offres courantes #miOne.panel-collapse.collapse @@ -26,7 +26,7 @@ .menu-item.panel .panel-heading h4.panel-title - = link_to '#miTwo', data: { toggle: 'collapse', parent: '#menu-items' }, 'aria-expanded' => 'false' do + = link_to '#miTwo', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do |Espace de travail #miTwo.panel-collapse.collapse @@ -34,18 +34,18 @@ = link_to workbench_path(current_offer_workbench), class: "list-group-item #{params[:controller] == 'workbenches' ? 'active' : ''}" do span Jeux de données = link_to workbench_imports_path(current_offer_workbench), class: "list-group-item #{(params[:controller] == 'imports') ? 'active' : ''}" do - span Import + span Import = link_to calendars_path, class: 'list-group-item' do span Modèles de calendrier = link_to '#', class: 'list-group-item' do span Rapport de contrôle - = link_to '#', class: 'list-group-item' do + = link_to compliance_control_sets_path, class: 'list-group-item' do span Jeux de contrôle .menu-item.panel .panel-heading h4.panel-title - = link_to '#miThree', data: { toggle: 'collapse', parent: '#menu-items' }, 'aria-expanded' => 'false' do + = link_to '#miThree', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do |Données #miThree.panel-collapse.collapse @@ -74,7 +74,7 @@ .menu-item.panel .panel-heading h4.panel-title - = link_to '#miFour', data: { toggle: 'collapse', parent: '#menu-items' }, 'aria-expanded' => 'false' do + = link_to '#miFour', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do |Synchronisation #miFour.panel-collapse.collapse @@ -87,7 +87,7 @@ .menu-item.panel .panel-heading h4.panel-title - = link_to '#miFive', data: { toggle: 'collapse', parent: '#menu-items' }, 'aria-expanded' => 'false' do + = link_to '#miFive', data: {toggle: 'collapse', parent: '#menu-items'}, 'aria-expanded' => 'false' do |Outils #miFive.panel-collapse.collapse diff --git a/config/locales/compliance_control_sets.fr.yml b/config/locales/compliance_control_sets.fr.yml new file mode 100644 index 000000000..c230d593c --- /dev/null +++ b/config/locales/compliance_control_sets.fr.yml @@ -0,0 +1,21 @@ +fr: + compliance_control_sets: + index: + title: Jeux de contrôle + new: Création d'un jeux de contrôle + edit: Édition d'un jeux de contrôle + actions: + new: Ajouter + edit: Editer + destroy: Supprimer + destroy_confirm: Etes vous sûr de supprimer ce jeux de contrôle ? + activerecord: + models: + compliance_control_set: Calendrier + attributes: + compliance_control_set: + name: Nom + assignment: Affectation + owner_jdc: Propriétaire du jeu de contrôle + control_numbers: Nb contrôle + update: Mis a jour
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0f1b22e44..97e0257c2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,8 @@ ChouetteIhm::Application.routes.draw do end end + resources :compliance_control_sets + devise_for :users, :controllers => { :registrations => 'users/registrations', :invitations => 'users/invitations' } @@ -69,6 +71,10 @@ ChouetteIhm::Application.routes.draw do resources :api_keys, :only => [:edit, :update, :new, :create, :destroy] + resources :compliance_control_sets do + resources :compliance_controls + end + resources :stop_area_referentials, :only => [:show] do post :sync, on: :member resources :stop_areas diff --git a/spec/controllers/compliance_control_sets_controller_spec.rb b/spec/controllers/compliance_control_sets_controller_spec.rb new file mode 100644 index 000000000..25d0becfe --- /dev/null +++ b/spec/controllers/compliance_control_sets_controller_spec.rb @@ -0,0 +1,60 @@ +require 'rails_helper' + +RSpec.describe ComplianceControlSetsController, type: :controller do + login_user + + let(:compliance_control_set) { create :compliance_control_set } + + describe "GET show" do + it 'should be successful' do + get :show, id: compliance_control_set.id + expect(response).to be_success + end + end + + describe "GET index" do + it 'should be successful' do + get :index, id: compliance_control_set.id + expect(response).to be_success + end + end + + describe "GET #edit" do + it 'should be successful' do + get :edit, id: compliance_control_set.id + expect(response).to be_success + end + end + + describe 'GET #new' do + it 'should be successful' do + get :new, id: compliance_control_set.id + expect(response).to be_success + end + end + + describe 'POST #create' do + it 'should be successful' do + post :create, compliance_control_set: build(:compliance_control_set).as_json + expect(response).to have_http_status(302) + # expect(flash[:notice]).to eq(I18n.t('notice.compliance_control.created')) + end + end + + describe 'POST #update' do + it 'should be successful' do + post :update, id: compliance_control_set.id, compliance_control_set: compliance_control_set.as_json + expect(response).to redirect_to compliance_control_set_path(compliance_control_set) + # expect(flash[:notice]).to eq(I18n.t('notice.compliance_control.updated')) + end + end + + describe 'DELETE #destroy' do + it 'should be successful' do + delete :destroy, id: compliance_control_set.id + # expect(flash[:notice]).to eq I18n.t('notice.compliance_control.destroyed') + end + end + + +end diff --git a/spec/controllers/compliance_controls_controller_spec.rb b/spec/controllers/compliance_controls_controller_spec.rb new file mode 100644 index 000000000..165c00329 --- /dev/null +++ b/spec/controllers/compliance_controls_controller_spec.rb @@ -0,0 +1,59 @@ +require 'rails_helper' + +RSpec.describe ComplianceControlsController, type: :controller do + login_user + + let(:compliance_control) { create :compliance_control } + let(:compliance_control_set) { compliance_control.compliance_control_set } + + describe "GET show" do + it 'should be successful' do + get :show, compliance_control_set_id: compliance_control_set.id, id: compliance_control.id + expect(response).to be_success + end + end + + describe "GET index" do + it 'should be successful' do + get :index, compliance_control_set_id: compliance_control_set.id + expect(response).to be_success + end + end + + describe 'GET #edit' do + it 'should be successful' do + get :edit, compliance_control_set_id: compliance_control_set.id, id: compliance_control.id + expect(response).to be_success + end + end + + describe 'GET #new' do + it 'should be successful' do + get :new, compliance_control_set_id: compliance_control_set.id + expect(response).to be_success + end + end + + describe 'POST #create' do + it 'should be successful' do + post :create, compliance_control_set_id: compliance_control_set.id, compliance_control: build(:compliance_control).as_json + expect(response).to have_http_status(302) + expect(flash[:notice]).to eq(I18n.t('notice.compliance_control.created')) + end + end + + describe 'POST #update' do + it 'should be successful' do + post :update, compliance_control_set_id: compliance_control_set.id, id: compliance_control.id, compliance_control: compliance_control.as_json + expect(response).to redirect_to compliance_control_set_compliance_control_path(compliance_control_set, compliance_control) + expect(flash[:notice]).to eq(I18n.t('notice.compliance_control.updated')) + end + end + + describe 'DELETE #destroy' do + it 'should be successful' do + delete :destroy, compliance_control_set_id: compliance_control_set.id, id: compliance_control.id + expect(flash[:notice]).to eq I18n.t('notice.compliance_control.destroyed') + end + end +end diff --git a/spec/decorators/compliance_control_set_decorator_spec.rb b/spec/decorators/compliance_control_set_decorator_spec.rb new file mode 100644 index 000000000..64e9ff9e7 --- /dev/null +++ b/spec/decorators/compliance_control_set_decorator_spec.rb @@ -0,0 +1,4 @@ +require 'spec_helper' + +describe ComplianceControlSetDecorator do +end diff --git a/spec/factories/compliance_controls.rb b/spec/factories/compliance_controls.rb index 28b760383..8aa16b674 100644 --- a/spec/factories/compliance_controls.rb +++ b/spec/factories/compliance_controls.rb @@ -1,8 +1,8 @@ FactoryGirl.define do factory :compliance_control do sequence(:name) { |n| "Compliance control #{n}" } - type "Type" - criticity :info + type "ComplianceControl" + criticity :warning code "code" comment "Text" association :compliance_control_set diff --git a/spec/helpers/compliance_control_sets_helper_spec.rb b/spec/helpers/compliance_control_sets_helper_spec.rb new file mode 100644 index 000000000..981368561 --- /dev/null +++ b/spec/helpers/compliance_control_sets_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the ComplianceControlSetsHelper. For example: +# +# describe ComplianceControlSetsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe ComplianceControlSetsHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/compliance_control_set_spec.rb b/spec/models/compliance_control_set_spec.rb index fb46bc65a..ededec5e0 100644 --- a/spec/models/compliance_control_set_spec.rb +++ b/spec/models/compliance_control_set_spec.rb @@ -6,4 +6,7 @@ RSpec.describe ComplianceControlSet, type: :model do end it { should belong_to :organisation } + it { should have_many :compliance_controls } + + it { should validate_presence_of :name } end |
