Allow to register guest user
This commit is contained in:
parent
9657ef9480
commit
7461bf9bbc
2 changed files with 48 additions and 2 deletions
|
@ -42,6 +42,13 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||
|
||||
protected
|
||||
|
||||
# Build a devise resource passing in the session.
|
||||
# Useful to move temporary session data to the newly created user.
|
||||
def build_resource(hash = {})
|
||||
super
|
||||
resource.account ||= current_account if current_account&.user.nil?
|
||||
end
|
||||
|
||||
# The path used after sign up.
|
||||
def after_sign_up_path_for(_resource)
|
||||
super
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
Feature: Sign up
|
||||
Background:
|
||||
Scenario: as a visitor
|
||||
Given I visit "/users/sign_up"
|
||||
|
||||
Scenario:
|
||||
When I fill form with the following data:
|
||||
| key | value |
|
||||
| Email | user@example.com |
|
||||
|
@ -20,3 +19,43 @@ Feature: Sign up
|
|||
|
||||
When I try to sign in with email "user@example.com" and password "password"
|
||||
Then I am signed in as "user@example.com"
|
||||
|
||||
Scenario: as a guest account
|
||||
When I visit the main page
|
||||
Then I see the main page
|
||||
And I see the join button
|
||||
And I do not see the membership application button
|
||||
|
||||
When I click the button "Вступить"
|
||||
And I fill form with the following data:
|
||||
| key | value |
|
||||
| Фамилия | Иванов |
|
||||
| Имя | Иван |
|
||||
| Адрес электронной почты | user@example.com |
|
||||
| Телефон | 88005553535 |
|
||||
And I click the form button "Отправить заявление"
|
||||
Then I see the membership application tracking page
|
||||
|
||||
When I click the button "Регистрация"
|
||||
And I fill form with the following data:
|
||||
| key | value |
|
||||
| Email | user@example.com |
|
||||
| Пароль | password |
|
||||
| Подтверждение пароля | password |
|
||||
And I click the form button "Регистрация"
|
||||
Then I am successfully signed up, but my email is unconfirmed
|
||||
And I received confirmation email as "user@example.com"
|
||||
|
||||
When I follow confirmation link for email "user@example.com"
|
||||
Then I see that my email is confirmed
|
||||
|
||||
When I try to sign in with email "user@example.com" and password "password"
|
||||
Then I am signed in as "user@example.com"
|
||||
|
||||
When I visit the main page
|
||||
Then I see the main page
|
||||
And I do not see the join button
|
||||
And I see the membership application button
|
||||
|
||||
When I click the membership application button
|
||||
Then I see the membership application tracking page
|
||||
|
|
Reference in a new issue