Module: Caffeinate::RSpec::Matchers

Defined in:
lib/caffeinate/rspec/matchers/subscribe_to_caffeinate_campaign.rb,
lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb,
lib/caffeinate/rspec/matchers/end_caffeinate_campaign_subscription.rb,
lib/caffeinate/rspec/matchers/unsubscribe_from_caffeinate_campaign.rb

Defined Under Namespace

Classes: BeSubscribedToCaffeinateCampaign, EndCaffeinateCampaignSubscription, SubscribeToCaffeinateCampaign, UnsubscribeFromCaffeinateCampaign

Instance Method Summary collapse

Instance Method Details

#be_subscribed_to_caffeinate_campaign(expected_campaign) ⇒ BeSubscribedTo

Check if the subject subscribes to a given campaign. Only checks for presence.

This can be easily accessed via ‘UserOnboardingDripper.campaign`

Parameters:

  • expected_campaign (Caffeinate::Campaign)

    The campaign to be passed as an argument to BeSubscribedTo new.

Returns:

  • (BeSubscribedTo)

    A new BeSubscribedTo instance with the expected campaign as its argument.



10
11
12
# File 'lib/caffeinate/rspec/matchers/be_subscribed_to_caffeinate_campaign.rb', line 10

def be_subscribed_to_caffeinate_campaign(expected_campaign)
  BeSubscribedToCaffeinateCampaign.new(expected_campaign)
end

#end_caffeinate_campaign_subscription(expected_campaign, subscriber, **args) ⇒ UnsubscribeFromCaffeinateCampaign

Creates an RSpec matcher for testing whether an action results in a ‘Caffeinate::CampaignSubscription` becoming `ended?`.

Parameters:

  • expected_campaign (Caffeinate::Campaign)

    The expected campaign.

  • subscriber (Object)

    The subscriber being tested.

  • args (Hash)

    Additional arguments passed to the Caffeinate::CampaignSubscriber.

Options Hash (**args):

  • :user (Object)

    The user associated with the subscriber.

Returns:



12
13
14
# File 'lib/caffeinate/rspec/matchers/end_caffeinate_campaign_subscription.rb', line 12

def end_caffeinate_campaign_subscription(expected_campaign, subscriber, **args)
  EndCaffeinateCampaignSubscription.new(expected_campaign, subscriber, **args)
end

#subscribe_to_caffeinate_campaign(expected_campaign, subscriber, **args) ⇒ SubscribeToCaffeinateCampaign

Creates an RSpec matcher for testing whether an action results in a subscribe to a specified campaign.

Parameters:

  • expected_campaign (Caffeinate::Campaign)

    The expected campaign.

  • subscriber (Object)

    The subscriber being tested.

  • args (Hash)

    Additional arguments passed to the Caffeinate::CampaignSubscriber.

Options Hash (**args):

  • :user (Object)

    The user associated with the subscriber.

Returns:



12
13
14
# File 'lib/caffeinate/rspec/matchers/subscribe_to_caffeinate_campaign.rb', line 12

def subscribe_to_caffeinate_campaign(expected_campaign, subscriber, **args)
  SubscribeToCaffeinateCampaign.new(expected_campaign, subscriber, **args)
end

#unsubscribe_from_caffeinate_campaign(expected_campaign, subscriber, **args) ⇒ UnsubscribeFromCaffeinateCampaign

Creates an RSpec matcher for testing whether an action results in an unsubscribe from a specified campaign.

Parameters:

  • expected_campaign (Caffeinate::Campaign)

    The expected campaign.

  • subscriber (Object)

    The subscriber being tested.

  • args (Hash)

    Additional arguments passed to the Caffeinate::CampaignSubscriber.

Options Hash (**args):

  • :user (Object)

    The user associated with the subscriber.

Returns:



12
13
14
# File 'lib/caffeinate/rspec/matchers/unsubscribe_from_caffeinate_campaign.rb', line 12

def unsubscribe_from_caffeinate_campaign(expected_campaign, subscriber, **args)
  UnsubscribeFromCaffeinateCampaign.new(expected_campaign, subscriber, **args)
end