Class: CemSpecHelper::ResourceDataSpec::Resource
- Inherits:
-
Object
- Object
- CemSpecHelper::ResourceDataSpec::Resource
- Defined in:
- lib/cem_spec_helper/resource_data_spec.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #controls(include_special: true) ⇒ Object
-
#initialize(title, data) ⇒ Resource
constructor
A new instance of Resource.
- #params ⇒ Object
- #verify_no_duplicate_controls ⇒ Object
Constructor Details
#initialize(title, data) ⇒ Resource
Returns a new instance of Resource.
127 128 129 130 131 132 133 |
# File 'lib/cem_spec_helper/resource_data_spec.rb', line 127 def initialize(title, data) @title = title @data = data @type = @data['type'] @no_params = false @control_data = load_control_data end |
Instance Attribute Details
#title ⇒ Object (readonly)
Returns the value of attribute title.
125 126 127 |
# File 'lib/cem_spec_helper/resource_data_spec.rb', line 125 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
125 126 127 |
# File 'lib/cem_spec_helper/resource_data_spec.rb', line 125 def type @type end |
Instance Method Details
#controls(include_special: true) ⇒ Object
135 136 137 138 139 140 |
# File 'lib/cem_spec_helper/resource_data_spec.rb', line 135 def controls(include_special: true) ctrls = @no_params ? @control_data : @control_data.keys return ctrls if include_special ctrls.reject { |c| SPECIAL_CONTROLS.include?(c) } end |
#params ⇒ Object
142 143 144 145 146 |
# File 'lib/cem_spec_helper/resource_data_spec.rb', line 142 def params # rubocop:disable Style/CollectionMethods control_data.map { |_, v| v if v.is_a?(Hash) }.flatten.compact.uniq.inject(:merge) # rubocop:enable Style/CollectionMethods end |
#verify_no_duplicate_controls ⇒ Object
148 149 150 |
# File 'lib/cem_spec_helper/resource_data_spec.rb', line 148 def verify_no_duplicate_controls controls.uniq == controls end |