Module: Selectivity::Rspec::FeatureHelpers
- Defined in:
- lib/selectivity/rspec.rb
Instance Method Summary collapse
Instance Method Details
#selectivity_select(value, *args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/selectivity/rspec.rb', line 5 def selectivity_select(value, *args) = args. fail('Selectivity input not set!') unless .has_key?(:from) from = .delete(:from) input = find_selectivity_input(from, ) items = _selectivity_multiselect?(input) ? args.unshift(value).uniq : [value] items.each do |item| _selectivity_select!(input, item) end end |
#selectivity_unselect(value, *args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/selectivity/rspec.rb', line 19 def selectivity_unselect(value, *args) = args. fail('Selectivity input not set!') unless .has_key?(:from) from = .delete(:from) input = find_selectivity_input(from, ) items = _selectivity_multiselect?(input) ? args.unshift(value).uniq : [value] items.each do |item| if _selectivity_multiselect?(input) _selectivity_unselect_multiple!(input, item) else _selectivity_unselect_single!(input) end end end |