Guest User

Untitled

a guest
Feb 21st, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.14 KB | None | 0 0
  1. Feature: User Account
  2. In order to use the application
  3. I want to have an user account
  4.  
  5. #
  6. # Account Creation: Get entry form
  7. #
  8. Scenario: Anonymous user can start creating an account
  9. Given an anonymous user
  10. When she goes to /signup
  11. Then she should be at the 'users/new' page
  12. And the page should look AWESOME
  13. And she should see a <form> containing a textfield: Login, textfield: Email, password: Password, password: 'Confirm Password', submit: 'Sign up'
  14.  
  15.  
  16. #
  17. # Account Creation
  18. #
  19. Scenario: Anonymous user can create an account
  20. Given an anonymous user
  21. And no user with login: 'Oona' exists
  22. When she registers an account as the preloaded 'Oona'
  23. Then she should be redirected to the home page
  24. When she follows that redirect!
  25. Then she should see a notice message 'Thanks for signing up!'
  26. And a user with login: 'oona' should exist
  27. And the user should have login: 'oona', and email: 'unactivated@example.com'
  28. And the user's activation_code should not be nil
  29. And the user's activated_at should be nil
  30. And she should not be logged in
  31.  
  32.  
  33. #
  34. # Account Creation Failure: Account exists
  35. #
  36.  
  37. Scenario: Anonymous user can not create an account replacing a non-activated account
  38. Given an anonymous user
  39. And a registered user named 'Reggie'
  40. And the user has activation_code: 'activate_me', activated_at: nil!
  41. And we try hard to remember the user's updated_at, and created_at
  42. When she registers an account with login: 'reggie', password: 'monkey', and email: 'different@example.com'
  43. Then she should be at the 'users/new' page
  44. And she should see an errorExplanation message 'Login has already been taken'
  45. And she should not see an errorExplanation message 'Email has already been taken'
  46. And a user with login: 'reggie' should exist
  47. And the user should have email: 'registered@example.com'
  48. And the user's activation_code should not be nil
  49. And the user's activated_at should be nil
  50. And the user's created_at should stay the same under to_s
  51. And the user's updated_at should stay the same under to_s
  52. And she should not be logged in
  53.  
  54. Scenario: Anonymous user can not create an account replacing an activated account
  55. Given an anonymous user
  56. And an activated user named 'Reggie'
  57. And we try hard to remember the user's updated_at, and created_at
  58. When she registers an account with login: 'reggie', password: 'monkey', and email: 'reggie@example.com'
  59. Then she should be at the 'users/new' page
  60. And she should see an errorExplanation message 'Login has already been taken'
  61. And she should not see an errorExplanation message 'Email has already been taken'
  62. And a user with login: 'reggie' should exist
  63. And the user should have email: 'registered@example.com'
  64. And the user's activation_code should be nil
  65. And the user's activated_at should not be nil
  66. And the user's created_at should stay the same under to_s
  67. And the user's updated_at should stay the same under to_s
  68. And she should not be logged in
  69.  
  70. #
  71. # Account Creation Failure: Incomplete input
  72. #
  73. Scenario: Anonymous user can not create an account with incomplete or incorrect input
  74. Given an anonymous user
  75. And no user with login: 'Oona' exists
  76. When she registers an account with login: '', password: 'monkey', password_confirmation: 'monkey' and email: 'unactivated@example.com'
  77. Then she should be at the 'users/new' page
  78. And she should see an errorExplanation message 'Login can't be blank'
  79. And no user with login: 'oona' should exist
  80.  
  81. Scenario: Anonymous user can not create an account with no password
  82. Given an anonymous user
  83. And no user with login: 'Oona' exists
  84. When she registers an account with login: 'oona', password: '', password_confirmation: 'monkey' and email: 'unactivated@example.com'
  85. Then she should be at the 'users/new' page
  86. And she should see an errorExplanation message 'Password can't be blank'
  87. And no user with login: 'oona' should exist
  88.  
  89. Scenario: Anonymous user can not create an account with no password_confirmation
  90. Given an anonymous user
  91. And no user with login: 'Oona' exists
  92. When she registers an account with login: 'oona', password: 'monkey', password_confirmation: '' and email: 'unactivated@example.com'
  93. Then she should be at the 'users/new' page
  94. And she should see an errorExplanation message 'Password confirmation can't be blank'
  95. And no user with login: 'oona' should exist
  96.  
  97. Scenario: Anonymous user can not create an account with mismatched password & password_confirmation
  98. Given an anonymous user
  99. And no user with login: 'Oona' exists
  100. When she registers an account with login: 'oona', password: 'monkey', password_confirmation: 'monkeY' and email: 'unactivated@example.com'
  101. Then she should be at the 'users/new' page
  102. And she should see an errorExplanation message 'Password doesn't match confirmation'
  103. And no user with login: 'oona' should exist
  104.  
  105. Scenario: Anonymous user can not create an account with bad email
  106. Given an anonymous user
  107. And no user with login: 'Oona' exists
  108. When she registers an account with name: 'Oona', login: 'oona', password: 'monkey', password_confirmation: 'monkey' and email: ''
  109. Then she should be at the 'users/new' page
  110. And she should see an errorExplanation message 'Email can't be blank'
  111. And no user with login: 'oona' should exist
  112. When she registers an account with name: 'Oona', login: 'oona', password: 'monkey', password_confirmation: 'monkey' and email: 'unactivated@example.com'
  113. Then she should be redirected to the home page
  114. When she follows that redirect!
  115. Then she should see a notice message 'Thanks for signing up!'
  116. And a user with login: 'oona' should exist
  117. And the user should have login: 'oona', and email: 'unactivated@example.com'
  118. And the user's activation_code should not be nil
  119. And the user's activated_at should be nil
  120. And she should not be logged in
Add Comment
Please, Sign In to add comment