Class: Caffeinate::RSpec::Matchers::BeSubscribedToCaffeinateCampaign
- Inherits:
-
Object
- Object
- Caffeinate::RSpec::Matchers::BeSubscribedToCaffeinateCampaign
- Defined in:
- lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_campaign) ⇒ BeSubscribedToCaffeinateCampaign
constructor
A new instance of BeSubscribedToCaffeinateCampaign.
- #matches?(hopeful_subscriber) ⇒ Boolean
- #with(**args) ⇒ Object
Constructor Details
#initialize(expected_campaign) ⇒ BeSubscribedToCaffeinateCampaign
Returns a new instance of BeSubscribedToCaffeinateCampaign.
15 16 17 |
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 15 def initialize(expected_campaign) @expected_campaign = expected_campaign end |
Instance Method Details
#description ⇒ Object
19 20 21 |
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 19 def description "be subscribed to the \"Campaign##{@expected_campaign.slug}\" campaign" end |
#failure_message ⇒ Object
23 24 25 |
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 23 def "expected #{@hopeful_subscriber.inspect} to be subscribed to the \"Campaign##{@expected_campaign.slug}\" campaign but wasn't" end |
#failure_message_when_negated ⇒ Object
38 39 40 |
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 38 def "expected #{@hopeful_subscriber.inspect} to not be subscribed to the \"Campaign##{@expected_campaign.slug}\" campaign but was" end |
#matches?(hopeful_subscriber) ⇒ Boolean
32 33 34 35 36 |
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 32 def matches?(hopeful_subscriber) @hopeful_subscriber = hopeful_subscriber @args ||= {} @expected_campaign.caffeinate_campaign_subscriptions.exists?(subscriber: hopeful_subscriber, **@args) end |
#with(**args) ⇒ Object
27 28 29 30 |
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 27 def with(**args) @args = args self end |