Class: Consent::Rspec::ConsentAction
- Inherits:
-
Object
- Object
- Consent::Rspec::ConsentAction
- Defined in:
- lib/consent/rspec/consent_action.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(action_key) ⇒ ConsentAction
constructor
A new instance of ConsentAction.
- #matches?(subject_key) ⇒ Boolean
- #with_views(*views) ⇒ Object
Constructor Details
#initialize(action_key) ⇒ ConsentAction
Returns a new instance of ConsentAction.
10 11 12 |
# File 'lib/consent/rspec/consent_action.rb', line 10 def initialize(action_key) @action_key = action_key end |
Instance Method Details
#description ⇒ Object
19 20 21 22 |
# File 'lib/consent/rspec/consent_action.rb', line 19 def description = "consents action #{@action_key}" "#{} with views #{@views}" if @views end |
#failure_message ⇒ Object
37 38 39 |
# File 'lib/consent/rspec/consent_action.rb', line 37 def 'to' end |
#failure_message_when_negated ⇒ Object
41 42 43 |
# File 'lib/consent/rspec/consent_action.rb', line 41 def 'to not' end |
#matches?(subject_key) ⇒ Boolean
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/consent/rspec/consent_action.rb', line 24 def matches?(subject_key) @subject_key = subject_key @action = Consent.find_action(@subject_key, @action_key) if @action && @views RSpec::Support::FuzzyMatcher.values_match?( @action.views.keys.sort, @views.sort ) else !@action.nil? end end |
#with_views(*views) ⇒ Object
14 15 16 17 |
# File 'lib/consent/rspec/consent_action.rb', line 14 def with_views(*views) @views = views self end |