Class: RSpecStripe::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-stripe/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recipes) ⇒ Runner

Returns a new instance of Runner.



5
6
7
# File 'lib/rspec-stripe/runner.rb', line 5

def initialize(recipes)
  @recipes = recipes
end

Instance Attribute Details

#cardObject

Returns the value of attribute card.



3
4
5
# File 'lib/rspec-stripe/runner.rb', line 3

def card
  @card
end

#customerObject

Returns the value of attribute customer.



3
4
5
# File 'lib/rspec-stripe/runner.rb', line 3

def customer
  @customer
end

#planObject

Returns the value of attribute plan.



3
4
5
# File 'lib/rspec-stripe/runner.rb', line 3

def plan
  @plan
end

#recipesObject

Returns the value of attribute recipes.



3
4
5
# File 'lib/rspec-stripe/runner.rb', line 3

def recipes
  @recipes
end

#subscriptionObject

Returns the value of attribute subscription.



3
4
5
# File 'lib/rspec-stripe/runner.rb', line 3

def subscription
  @subscription
end

Instance Method Details

#call!Object



9
10
11
12
13
14
# File 'lib/rspec-stripe/runner.rb', line 9

def call!
  @customer = customer_factory.get if recipes[:customer]
  @plan = plan_factory.get if recipes[:plan]
  @card = card_factory.get if recipes[:card]
  @subscription = subscription_factory.get if recipes[:subscription]
end

#cleanup!Object



16
17
18
19
20
# File 'lib/rspec-stripe/runner.rb', line 16

def cleanup!
  factories.reject(&:nil?).each do |factory|
    factory.cleanup
  end
end