Here's my Rspec/Capybara code
visit new_user_registration_path
page.fill_in 'Email', with: 'manager@test.com'
page.fill_in 'Password (8 characters minimum)', with: 'Password'
page.fill_in 'Password confirmation', with: 'Password'
page.fill_in 'Promo code', with: "test100"
page.click_button "Sign up"
It returns this error:
1) Sign up Sign in with promo code when new user signs up with 100% promo
Failure/Error: page.click_button "Sign up"
NoMethodError:
undefined method `active=' for #<Subscription:0x007f9b5f868c68>
# ./app/models/subscription.rb:24:in `activate'
# ./app/models/subscription.rb:17:in `setup'
# ./app/controllers/users/registrations_controller.rb:37:in `create'
# ./spec/integration/signup_spec.rb:18:in `block (3 levels) in <top (required)>'
However if I manually enter the info to sign up there's no error:
Here is the model code.
def setup
if has_full_discount?
activate
elsif create_stripe_customer and charge_stripe_customer
activate
end
end
def activate
self.update_attribute(:active, true)
end
Aucun commentaire:
Enregistrer un commentaire