Top Level Namespace

Defined Under Namespace

Modules: MuckCommerce, MuckCommerceCustomFormBuilder, MuckCommerceTestDefinitions

Instance Method Summary collapse

Instance Method Details

#default_billing(options = {}) ⇒ Object



117
118
119
120
121
122
123
124
125
# File 'lib/test/muck_commerce_factories.rb', line 117

def default_billing(options = {})
  { :first_name => 'test',
    :last_name => 'dude',
    :postal_code => '99999',
    :credit_card_type => 'bogus',
    :credit_card_number => '1',
    :credit_card_expiration => Date.new((Time.now.year + 2), 10, 10),
    :verification_value => '999'}.merge(options)
end

#populate_cart(user) ⇒ Object



127
128
129
130
131
# File 'lib/test/muck_commerce_factories.rb', line 127

def populate_cart(user)
  cart = Factory(:cart, :cartable => user)
  # TODO add stuff to the cart....
  cart
end

#setup_live_user_and_billing(options = {}) ⇒ Object



133
134
135
136
137
138
139
140
# File 'lib/test/muck_commerce_factories.rb', line 133

def setup_live_user_and_billing(options = {})
  user = Factory(:user)
  cart = populate_cart(user)
  country = Factory(:country, :name => 'United States of America', :abbreviation => 'US')
  state = Factory(:state, :name => 'Illinois', :abbreviation => 'IL', :country => country)
  billing = user.billing_informations.create(Factory.attributes_for(:live_billing_information, :city => 'Chicago').merge(options))
  [user, billing]
end

#setup_user_and_billing(options = {}) ⇒ Object



142
143
144
145
146
147
148
149
# File 'lib/test/muck_commerce_factories.rb', line 142

def setup_user_and_billing(options = {})
  user = Factory(:user)
  cart = populate_cart(user)
  country = Factory(:country, :name => 'United States of America', :abbreviation => 'US')
  state = Factory(:state, :name => 'Illinois', :abbreviation => 'IL', :country => country)
  billing = user.billing_informations.create(Factory.attributes_for(:billing_information, :city => 'Chicago').merge(options))
  [user, billing]
end