clearance 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of clearance might be problematic. Click here for more details.

Files changed (262) hide show
  1. data/CHANGELOG.md +9 -0
  2. data/Gemfile +21 -0
  3. data/Gemfile.lock +171 -0
  4. data/README.md +18 -30
  5. data/Rakefile +14 -123
  6. data/VERSION +1 -1
  7. data/{spec/rails_root/app → app}/views/layouts/application.html.erb +0 -2
  8. data/app/views/passwords/edit.html.erb +3 -4
  9. data/app/views/passwords/new.html.erb +2 -2
  10. data/{lib/rails/generators/clearance_views_templates/formtastic/erb → app/views}/users/_inputs.html.erb +0 -0
  11. data/lib/clearance/user.rb +11 -9
  12. data/lib/generators/clearance/features/features_generator.rb +18 -0
  13. data/lib/generators/clearance/install/install_generator.rb +46 -0
  14. data/lib/generators/clearance/install/templates/README +22 -0
  15. data/lib/{rails/generators/clearance_templates → generators/clearance/install/templates}/clearance.rb +0 -0
  16. data/lib/{rails/generators/clearance_templates/migrations/update_users.rb → generators/clearance/install/templates/db/migrate/upgrade_clearance_to_diesel.rb} +1 -1
  17. data/lib/{rails/generators/clearance_templates → generators/clearance/install/templates}/user.rb +0 -0
  18. data/lib/generators/clearance/views/views_generator.rb +8 -0
  19. data/test/controllers/sessions_controller_test.rb +0 -2
  20. data/test/controllers/users_controller_test.rb +0 -2
  21. data/{lib/rails/generators/clearance_templates → test}/factories.rb +1 -1
  22. data/test/models/user_test.rb +23 -0
  23. data/test/test_helper.rb +18 -8
  24. metadata +38 -478
  25. data/lib/rails/generators/clearance_features_generator.rb +0 -20
  26. data/lib/rails/generators/clearance_features_templates/features/password_reset.feature +0 -40
  27. data/lib/rails/generators/clearance_features_templates/features/sign_in.feature +0 -28
  28. data/lib/rails/generators/clearance_features_templates/features/sign_out.feature +0 -16
  29. data/lib/rails/generators/clearance_features_templates/features/sign_up.feature +0 -21
  30. data/lib/rails/generators/clearance_features_templates/features/step_definitions/clearance_steps.rb +0 -109
  31. data/lib/rails/generators/clearance_generator.rb +0 -72
  32. data/lib/rails/generators/clearance_templates/README +0 -24
  33. data/lib/rails/generators/clearance_templates/migrations/create_users.rb +0 -19
  34. data/lib/rails/generators/clearance_views_generator.rb +0 -14
  35. data/lib/rails/generators/clearance_views_templates/formtastic/erb/passwords/edit.html.erb +0 -21
  36. data/lib/rails/generators/clearance_views_templates/formtastic/erb/passwords/new.html.erb +0 -15
  37. data/lib/rails/generators/clearance_views_templates/formtastic/erb/sessions/new.html.erb +0 -21
  38. data/lib/rails/generators/clearance_views_templates/formtastic/erb/users/new.html.erb +0 -10
  39. data/spec/rails_root/Gemfile +0 -17
  40. data/spec/rails_root/Gemfile.lock +0 -143
  41. data/spec/rails_root/README +0 -244
  42. data/spec/rails_root/Rakefile +0 -10
  43. data/spec/rails_root/app/controllers/accounts_controller.rb +0 -10
  44. data/spec/rails_root/app/controllers/application_controller.rb +0 -6
  45. data/spec/rails_root/app/helpers/application_helper.rb +0 -2
  46. data/spec/rails_root/app/models/user.rb +0 -3
  47. data/spec/rails_root/app/views/accounts/edit.html.erb +0 -0
  48. data/spec/rails_root/app/views/passwords/edit.html.erb +0 -21
  49. data/spec/rails_root/app/views/passwords/new.html.erb +0 -15
  50. data/spec/rails_root/app/views/sessions/new.html.erb +0 -21
  51. data/spec/rails_root/app/views/users/_inputs.html.erb +0 -6
  52. data/spec/rails_root/app/views/users/new.html.erb +0 -10
  53. data/spec/rails_root/config.ru +0 -4
  54. data/spec/rails_root/config/application.rb +0 -46
  55. data/spec/rails_root/config/boot.rb +0 -6
  56. data/spec/rails_root/config/cucumber.yml +0 -8
  57. data/spec/rails_root/config/database.yml +0 -25
  58. data/spec/rails_root/config/environment.rb +0 -7
  59. data/spec/rails_root/config/environments/development.rb +0 -21
  60. data/spec/rails_root/config/environments/production.rb +0 -42
  61. data/spec/rails_root/config/environments/test.rb +0 -34
  62. data/spec/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  63. data/spec/rails_root/config/initializers/clearance.rb +0 -3
  64. data/spec/rails_root/config/initializers/inflections.rb +0 -10
  65. data/spec/rails_root/config/initializers/mime_types.rb +0 -5
  66. data/spec/rails_root/config/initializers/secret_token.rb +0 -7
  67. data/spec/rails_root/config/initializers/session_store.rb +0 -8
  68. data/spec/rails_root/config/locales/en.yml +0 -5
  69. data/spec/rails_root/config/routes.rb +0 -61
  70. data/spec/rails_root/db/development.sqlite3 +0 -0
  71. data/spec/rails_root/db/migrate/20110209234521_clearance_create_users.rb +0 -19
  72. data/spec/rails_root/db/schema.rb +0 -28
  73. data/spec/rails_root/db/test.sqlite3 +0 -0
  74. data/spec/rails_root/doc/README_FOR_APP +0 -2
  75. data/spec/rails_root/features/password_reset.feature +0 -40
  76. data/spec/rails_root/features/sign_in.feature +0 -28
  77. data/spec/rails_root/features/sign_out.feature +0 -16
  78. data/spec/rails_root/features/sign_up.feature +0 -21
  79. data/spec/rails_root/features/step_definitions/clearance_steps.rb +0 -109
  80. data/spec/rails_root/features/step_definitions/web_steps.rb +0 -219
  81. data/spec/rails_root/features/support/env.rb +0 -57
  82. data/spec/rails_root/features/support/paths.rb +0 -45
  83. data/spec/rails_root/lib/tasks/cucumber.rake +0 -53
  84. data/spec/rails_root/log/development.log +0 -536
  85. data/spec/rails_root/log/test.log +0 -7600
  86. data/spec/rails_root/public/404.html +0 -26
  87. data/spec/rails_root/public/422.html +0 -26
  88. data/spec/rails_root/public/500.html +0 -26
  89. data/spec/rails_root/public/favicon.ico +0 -0
  90. data/spec/rails_root/public/images/rails.png +0 -0
  91. data/spec/rails_root/public/javascripts/application.js +0 -2
  92. data/spec/rails_root/public/javascripts/controls.js +0 -965
  93. data/spec/rails_root/public/javascripts/dragdrop.js +0 -974
  94. data/spec/rails_root/public/javascripts/effects.js +0 -1123
  95. data/spec/rails_root/public/javascripts/prototype.js +0 -4874
  96. data/spec/rails_root/public/javascripts/rails.js +0 -118
  97. data/spec/rails_root/public/robots.txt +0 -5
  98. data/spec/rails_root/script/cucumber +0 -10
  99. data/spec/rails_root/script/rails +0 -9
  100. data/spec/rails_root/test/factories/clearance.rb +0 -13
  101. data/spec/rails_root/test/functional/accounts_controller_test.rb +0 -22
  102. data/spec/rails_root/test/performance/browsing_test.rb +0 -9
  103. data/spec/rails_root/test/test_helper.rb +0 -13
  104. data/spec/rails_root/vendor/Gemfile +0 -17
  105. data/spec/rails_root/vendor/Gemfile.lock +0 -143
  106. data/spec/rails_root/vendor/README +0 -244
  107. data/spec/rails_root/vendor/Rakefile +0 -10
  108. data/spec/rails_root/vendor/app/controllers/accounts_controller.rb +0 -10
  109. data/spec/rails_root/vendor/app/controllers/application_controller.rb +0 -6
  110. data/spec/rails_root/vendor/app/helpers/application_helper.rb +0 -2
  111. data/spec/rails_root/vendor/app/models/user.rb +0 -3
  112. data/spec/rails_root/vendor/app/views/accounts/edit.html.erb +0 -0
  113. data/spec/rails_root/vendor/app/views/layouts/application.html.erb +0 -24
  114. data/spec/rails_root/vendor/app/views/passwords/edit.html.erb +0 -21
  115. data/spec/rails_root/vendor/app/views/passwords/new.html.erb +0 -15
  116. data/spec/rails_root/vendor/app/views/sessions/new.html.erb +0 -21
  117. data/spec/rails_root/vendor/app/views/users/_inputs.html.erb +0 -6
  118. data/spec/rails_root/vendor/app/views/users/new.html.erb +0 -10
  119. data/spec/rails_root/vendor/config.ru +0 -4
  120. data/spec/rails_root/vendor/config/application.rb +0 -46
  121. data/spec/rails_root/vendor/config/boot.rb +0 -6
  122. data/spec/rails_root/vendor/config/cucumber.yml +0 -8
  123. data/spec/rails_root/vendor/config/database.yml +0 -25
  124. data/spec/rails_root/vendor/config/environment.rb +0 -7
  125. data/spec/rails_root/vendor/config/environments/development.rb +0 -21
  126. data/spec/rails_root/vendor/config/environments/production.rb +0 -42
  127. data/spec/rails_root/vendor/config/environments/test.rb +0 -34
  128. data/spec/rails_root/vendor/config/initializers/backtrace_silencers.rb +0 -7
  129. data/spec/rails_root/vendor/config/initializers/clearance.rb +0 -3
  130. data/spec/rails_root/vendor/config/initializers/inflections.rb +0 -10
  131. data/spec/rails_root/vendor/config/initializers/mime_types.rb +0 -5
  132. data/spec/rails_root/vendor/config/initializers/secret_token.rb +0 -7
  133. data/spec/rails_root/vendor/config/initializers/session_store.rb +0 -8
  134. data/spec/rails_root/vendor/config/locales/en.yml +0 -5
  135. data/spec/rails_root/vendor/config/routes.rb +0 -61
  136. data/spec/rails_root/vendor/db/development.sqlite3 +0 -0
  137. data/spec/rails_root/vendor/db/migrate/20101220184900_clearance_create_users.rb +0 -20
  138. data/spec/rails_root/vendor/db/schema.rb +0 -29
  139. data/spec/rails_root/vendor/db/test.sqlite3 +0 -0
  140. data/spec/rails_root/vendor/doc/README_FOR_APP +0 -2
  141. data/spec/rails_root/vendor/features/password_reset.feature +0 -33
  142. data/spec/rails_root/vendor/features/sign_in.feature +0 -35
  143. data/spec/rails_root/vendor/features/sign_out.feature +0 -15
  144. data/spec/rails_root/vendor/features/sign_up.feature +0 -45
  145. data/spec/rails_root/vendor/features/step_definitions/clearance_steps.rb +0 -138
  146. data/spec/rails_root/vendor/features/step_definitions/web_steps.rb +0 -219
  147. data/spec/rails_root/vendor/features/support/env.rb +0 -57
  148. data/spec/rails_root/vendor/features/support/paths.rb +0 -45
  149. data/spec/rails_root/vendor/lib/tasks/cucumber.rake +0 -53
  150. data/spec/rails_root/vendor/log/development.log +0 -663
  151. data/spec/rails_root/vendor/log/test.log +0 -22745
  152. data/spec/rails_root/vendor/plugins/dynamic_form/MIT-LICENSE +0 -20
  153. data/spec/rails_root/vendor/plugins/dynamic_form/README +0 -13
  154. data/spec/rails_root/vendor/plugins/dynamic_form/Rakefile +0 -10
  155. data/spec/rails_root/vendor/plugins/dynamic_form/init.rb +0 -5
  156. data/spec/rails_root/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +0 -300
  157. data/spec/rails_root/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +0 -8
  158. data/spec/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +0 -42
  159. data/spec/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +0 -370
  160. data/spec/rails_root/vendor/plugins/dynamic_form/test/test_helper.rb +0 -9
  161. data/spec/rails_root/vendor/public/404.html +0 -26
  162. data/spec/rails_root/vendor/public/422.html +0 -26
  163. data/spec/rails_root/vendor/public/500.html +0 -26
  164. data/spec/rails_root/vendor/public/favicon.ico +0 -0
  165. data/spec/rails_root/vendor/public/images/rails.png +0 -0
  166. data/spec/rails_root/vendor/public/javascripts/application.js +0 -2
  167. data/spec/rails_root/vendor/public/javascripts/controls.js +0 -965
  168. data/spec/rails_root/vendor/public/javascripts/dragdrop.js +0 -974
  169. data/spec/rails_root/vendor/public/javascripts/effects.js +0 -1123
  170. data/spec/rails_root/vendor/public/javascripts/prototype.js +0 -4874
  171. data/spec/rails_root/vendor/public/javascripts/rails.js +0 -118
  172. data/spec/rails_root/vendor/public/robots.txt +0 -5
  173. data/spec/rails_root/vendor/script/cucumber +0 -10
  174. data/spec/rails_root/vendor/script/rails +0 -9
  175. data/spec/rails_root/vendor/test/factories/clearance.rb +0 -13
  176. data/spec/rails_root/vendor/test/functional/accounts_controller_test.rb +0 -22
  177. data/spec/rails_root/vendor/test/performance/browsing_test.rb +0 -9
  178. data/spec/rails_root/vendor/test/test_helper.rb +0 -13
  179. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/MIT-LICENSE +0 -20
  180. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/README +0 -13
  181. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/Rakefile +0 -10
  182. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/init.rb +0 -5
  183. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +0 -300
  184. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +0 -8
  185. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +0 -42
  186. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +0 -370
  187. data/spec/rails_root/vendor/vendor/plugins/dynamic_form/test/test_helper.rb +0 -9
  188. data/test/rails_root/Gemfile +0 -17
  189. data/test/rails_root/Gemfile.lock +0 -145
  190. data/test/rails_root/README +0 -244
  191. data/test/rails_root/Rakefile +0 -10
  192. data/test/rails_root/app/controllers/accounts_controller.rb +0 -10
  193. data/test/rails_root/app/controllers/application_controller.rb +0 -6
  194. data/test/rails_root/app/helpers/application_helper.rb +0 -2
  195. data/test/rails_root/app/models/user.rb +0 -3
  196. data/test/rails_root/app/views/accounts/edit.html.erb +0 -0
  197. data/test/rails_root/app/views/layouts/application.html.erb +0 -24
  198. data/test/rails_root/app/views/passwords/edit.html.erb +0 -21
  199. data/test/rails_root/app/views/passwords/new.html.erb +0 -15
  200. data/test/rails_root/app/views/sessions/new.html.erb +0 -21
  201. data/test/rails_root/app/views/users/_inputs.html.erb +0 -6
  202. data/test/rails_root/app/views/users/new.html.erb +0 -10
  203. data/test/rails_root/config.ru +0 -4
  204. data/test/rails_root/config/application.rb +0 -46
  205. data/test/rails_root/config/boot.rb +0 -6
  206. data/test/rails_root/config/cucumber.yml +0 -8
  207. data/test/rails_root/config/database.yml +0 -25
  208. data/test/rails_root/config/environment.rb +0 -7
  209. data/test/rails_root/config/environments/development.rb +0 -21
  210. data/test/rails_root/config/environments/production.rb +0 -42
  211. data/test/rails_root/config/environments/test.rb +0 -34
  212. data/test/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  213. data/test/rails_root/config/initializers/clearance.rb +0 -3
  214. data/test/rails_root/config/initializers/inflections.rb +0 -10
  215. data/test/rails_root/config/initializers/mime_types.rb +0 -5
  216. data/test/rails_root/config/initializers/secret_token.rb +0 -7
  217. data/test/rails_root/config/initializers/session_store.rb +0 -8
  218. data/test/rails_root/config/locales/en.yml +0 -5
  219. data/test/rails_root/config/routes.rb +0 -61
  220. data/test/rails_root/db/development.sqlite3 +0 -0
  221. data/test/rails_root/db/migrate/20110209234101_clearance_create_users.rb +0 -19
  222. data/test/rails_root/db/schema.rb +0 -28
  223. data/test/rails_root/db/test.sqlite3 +0 -0
  224. data/test/rails_root/doc/README_FOR_APP +0 -2
  225. data/test/rails_root/features/password_reset.feature +0 -40
  226. data/test/rails_root/features/sign_in.feature +0 -28
  227. data/test/rails_root/features/sign_out.feature +0 -16
  228. data/test/rails_root/features/sign_up.feature +0 -21
  229. data/test/rails_root/features/step_definitions/clearance_steps.rb +0 -109
  230. data/test/rails_root/features/step_definitions/web_steps.rb +0 -219
  231. data/test/rails_root/features/support/env.rb +0 -57
  232. data/test/rails_root/features/support/paths.rb +0 -45
  233. data/test/rails_root/lib/tasks/cucumber.rake +0 -53
  234. data/test/rails_root/log/development.log +0 -938
  235. data/test/rails_root/log/test.log +0 -20303
  236. data/test/rails_root/public/404.html +0 -26
  237. data/test/rails_root/public/422.html +0 -26
  238. data/test/rails_root/public/500.html +0 -26
  239. data/test/rails_root/public/favicon.ico +0 -0
  240. data/test/rails_root/public/images/rails.png +0 -0
  241. data/test/rails_root/public/javascripts/application.js +0 -2
  242. data/test/rails_root/public/javascripts/controls.js +0 -965
  243. data/test/rails_root/public/javascripts/dragdrop.js +0 -974
  244. data/test/rails_root/public/javascripts/effects.js +0 -1123
  245. data/test/rails_root/public/javascripts/prototype.js +0 -4874
  246. data/test/rails_root/public/javascripts/rails.js +0 -118
  247. data/test/rails_root/public/robots.txt +0 -5
  248. data/test/rails_root/script/cucumber +0 -10
  249. data/test/rails_root/script/rails +0 -9
  250. data/test/rails_root/test/factories/clearance.rb +0 -13
  251. data/test/rails_root/test/functional/accounts_controller_test.rb +0 -22
  252. data/test/rails_root/test/performance/browsing_test.rb +0 -9
  253. data/test/rails_root/test/test_helper.rb +0 -13
  254. data/test/rails_root/vendor/plugins/dynamic_form/MIT-LICENSE +0 -20
  255. data/test/rails_root/vendor/plugins/dynamic_form/README +0 -13
  256. data/test/rails_root/vendor/plugins/dynamic_form/Rakefile +0 -10
  257. data/test/rails_root/vendor/plugins/dynamic_form/init.rb +0 -5
  258. data/test/rails_root/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +0 -300
  259. data/test/rails_root/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +0 -8
  260. data/test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +0 -42
  261. data/test/rails_root/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +0 -370
  262. data/test/rails_root/vendor/plugins/dynamic_form/test/test_helper.rb +0 -9
@@ -1,20 +0,0 @@
1
- class ClearanceFeaturesGenerator < Rails::Generators::Base
2
- desc "Put the clearance features in place"
3
-
4
- def self.source_root
5
- @_clearance_source_root ||= File.join(File.dirname(__FILE__), "clearance_features_templates")
6
- end
7
-
8
- def install
9
- directory "features"
10
-
11
- inject_into_file "features/support/paths.rb", :after => "# Add more mappings here.\n" do
12
- " when /the sign up page/i
13
- sign_up_path
14
- when /the sign in page/i
15
- sign_in_path
16
- when /the password reset request page/i
17
- new_password_path\n"
18
- end
19
- end
20
- end
@@ -1,40 +0,0 @@
1
- Feature: Password reset
2
-
3
- In order to sign in even if I forgot my password
4
- As a user
5
- I want to reset my password
6
-
7
- Scenario: User is not signed up
8
- Given no user exists with an email of "email@person.com"
9
- When I request password reset link to be sent to "email@person.com"
10
- Then I should see "Unknown email"
11
-
12
- Scenario: User is signed up and requests password reset
13
- Given I signed up with "email@person.com/password"
14
- When I request password reset link to be sent to "email@person.com"
15
- Then I should see "instructions for changing your password"
16
- And a password reset message should be sent to "email@person.com"
17
-
18
- Scenario: User is signed up updated his password and types wrong confirmation
19
- Given I signed up with "email@person.com/password"
20
- And I go to the password reset request page
21
- And I fill in "Email address" with "email@person.com"
22
- And I press "Reset password"
23
- When I follow the password reset link sent to "email@person.com"
24
- And I update my password with "newpassword/wrongconfirmation"
25
- Then I should see an error message
26
- And I should be signed out
27
-
28
- Scenario: User is signed up and updates his password
29
- Given I signed up with "email@person.com/password"
30
- And I go to the password reset request page
31
- And I fill in "Email address" with "email@person.com"
32
- And I press "Reset password"
33
- When I follow the password reset link sent to "email@person.com"
34
- And I update my password with "newpassword/newpassword"
35
- Then I should be signed in
36
- When I sign out
37
- Then I should be signed out
38
- And I sign in as "email@person.com/newpassword"
39
- Then I should be signed in
40
-
@@ -1,28 +0,0 @@
1
- Feature: Sign in
2
-
3
- In order to get access to protected sections of the site
4
- As a user
5
- I want to sign in
6
-
7
- Scenario: User is not signed up
8
- Given no user exists with an email of "email@person.com"
9
- When I go to the sign in page
10
- And I sign in as "email@person.com/password"
11
- Then I should see "Bad email or password"
12
- And I should be signed out
13
-
14
- Scenario: User enters wrong password
15
- Given I am signed up as "email@person.com/password"
16
- When I go to the sign in page
17
- And I sign in as "email@person.com/wrongpassword"
18
- Then I should see "Bad email or password"
19
- And I should be signed out
20
-
21
- Scenario: User signs in successfully
22
- Given I am signed up as "email@person.com/password"
23
- When I go to the sign in page
24
- And I sign in as "email@person.com/password"
25
- Then I should see "Signed in"
26
- And I should be signed in
27
- When I return next time
28
- Then I should be signed in
@@ -1,16 +0,0 @@
1
- Feature: Sign out
2
-
3
- In order to protect my account from unauthorized access
4
- As a signed in user
5
- I want to sign out
6
-
7
- Scenario: User signs out
8
- Given I am signed up as "email@person.com/password"
9
- When I sign in as "email@person.com/password"
10
- Then I should be signed in
11
- And I sign out
12
- Then I should see "Signed out"
13
- And I should be signed out
14
- When I return next time
15
- Then I should be signed out
16
-
@@ -1,21 +0,0 @@
1
- Feature: Sign up
2
-
3
- In order to get access to protected sections of the site
4
- As a user
5
- I want to sign up
6
-
7
- Scenario: User signs up with invalid data
8
- When I go to the sign up page
9
- And I fill in "Email" with "invalidemail"
10
- And I fill in "Password" with "password"
11
- And I fill in "Confirm password" with ""
12
- And I press "Sign up"
13
- Then I should see error messages
14
-
15
- Scenario: User signs up with valid data
16
- When I go to the sign up page
17
- And I fill in "Email" with "email@person.com"
18
- And I fill in "Password" with "password"
19
- And I fill in "Confirm password" with "password"
20
- And I press "Sign up"
21
- Then I should see "signed up"
@@ -1,109 +0,0 @@
1
- # General
2
-
3
- Then /^I should see error messages$/ do
4
- Then %{I should see "errors prohibited"}
5
- end
6
-
7
- Then /^I should see an error message$/ do
8
- Then %{I should see "error prohibited"}
9
- end
10
-
11
- # Database
12
-
13
- Given /^no user exists with an email of "(.*)"$/ do |email|
14
- assert_nil User.find_by_email(email)
15
- end
16
-
17
- Given /^(?:I am|I have|I) signed up (?:as|with) "(.*)\/(.*)"$/ do |email, password|
18
- Factory(:user,
19
- :email => email,
20
- :password => password,
21
- :password_confirmation => password)
22
- end
23
-
24
- # Session
25
-
26
- Then /^I should be signed in$/ do
27
- Given %{I am on the homepage}
28
- Then %{I should see "Sign out"}
29
- end
30
-
31
- Then /^I should be signed out$/ do
32
- Given %{I am on the homepage}
33
- Then %{I should see "Sign in"}
34
- end
35
-
36
- When /^session is cleared$/ do
37
- # TODO: This doesn't work with Capybara
38
- # TODO: I tried Capybara.reset_sessions! but that didn't work
39
- #request.reset_session
40
- #controller.instance_variable_set(:@_current_user, nil)
41
- end
42
-
43
- Given /^(?:I am|I have|I) signed in (?:with|as) "(.*)\/(.*)"$/ do |email, password|
44
- Given %{I am signed up as "#{email}/#{password}"}
45
- And %{I sign in as "#{email}/#{password}"}
46
- end
47
-
48
- Given /^I sign in$/ do
49
- email = Factory.next(:email)
50
- Given %{I have signed in with "#{email}/password"}
51
- end
52
-
53
- # Emails
54
-
55
- Then /^a password reset message should be sent to "(.*)"$/ do |email|
56
- user = User.find_by_email(email)
57
- assert !user.confirmation_token.blank?
58
- assert !ActionMailer::Base.deliveries.empty?
59
- result = ActionMailer::Base.deliveries.any? do |email|
60
- email.to == [user.email] &&
61
- email.subject =~ /password/i &&
62
- email.body =~ /#{user.confirmation_token}/
63
- end
64
- assert result
65
- end
66
-
67
- When /^I follow the password reset link sent to "(.*)"$/ do |email|
68
- user = User.find_by_email(email)
69
- visit edit_user_password_path(:user_id => user,
70
- :token => user.confirmation_token)
71
- end
72
-
73
- When /^I try to change the password of "(.*)" without token$/ do |email|
74
- user = User.find_by_email(email)
75
- visit edit_user_password_path(:user_id => user)
76
- end
77
-
78
- # Actions
79
-
80
- When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
81
- When %{I go to the sign in page}
82
- And %{I fill in "Email" with "#{email}"}
83
- And %{I fill in "Password" with "#{password}"}
84
- And %{I press "Sign in"}
85
- end
86
-
87
- When "I sign out" do
88
- steps %{
89
- When I go to the homepage
90
- And I follow "Sign out"
91
- }
92
- end
93
-
94
- When /^I request password reset link to be sent to "(.*)"$/ do |email|
95
- When %{I go to the password reset request page}
96
- And %{I fill in "Email address" with "#{email}"}
97
- And %{I press "Reset password"}
98
- end
99
-
100
- When /^I update my password with "(.*)\/(.*)"$/ do |password, confirmation|
101
- And %{I fill in "Choose password" with "#{password}"}
102
- And %{I fill in "Confirm password" with "#{confirmation}"}
103
- And %{I press "Save this password"}
104
- end
105
-
106
- When /^I return next time$/ do
107
- When %{session is cleared}
108
- And %{I go to the homepage}
109
- end
@@ -1,72 +0,0 @@
1
- require 'rails/generators/active_record'
2
-
3
- class ClearanceGenerator < ActiveRecord::Generators::Base
4
- desc "Setup the basic stuff needed for Clearance"
5
-
6
- argument :name, :type => :string, :default => "migration_source_name"
7
-
8
- def self.source_root
9
- @_clearance_source_root ||= File.join(File.dirname(__FILE__), "clearance_templates")
10
- end
11
-
12
- def install
13
- template "clearance.rb", "config/initializers/clearance.rb"
14
-
15
- inject_into_class "app/controllers/application_controller.rb", ApplicationController do
16
- " include Clearance::Authentication\n"
17
- end
18
-
19
- user_model = "app/models/user.rb"
20
- if File.exists?(user_model)
21
- inject_into_class user_model, User do
22
- "include Clearance::User"
23
- end
24
- else
25
- template "user.rb", user_model
26
- end
27
-
28
- if File.exists?("spec")
29
- template "factories.rb", "spec/factories/clearance.rb"
30
- else
31
- template "factories.rb", "test/factories/clearance.rb"
32
- end
33
-
34
- migration_template "migrations/#{migration_source_name}.rb",
35
- "db/migrate/clearance_#{migration_target_name}"
36
-
37
- #readme "README"
38
- end
39
-
40
- private
41
-
42
- def schema_version_constant
43
- if upgrading_clearance_again?
44
- "To#{schema_version.gsub('_', '')}"
45
- end
46
- end
47
-
48
- def migration_source_name
49
- if ActiveRecord::Base.connection.table_exists?(:users)
50
- 'update_users'
51
- else
52
- 'create_users'
53
- end
54
- end
55
-
56
- def migration_target_name
57
- if upgrading_clearance_again?
58
- "update_users_to_#{schema_version}"
59
- else
60
- 'create_users'
61
- end
62
- end
63
-
64
- def schema_version
65
- IO.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'VERSION')).strip.gsub(/[^\d]/, '_')
66
- end
67
-
68
- def upgrading_clearance_again?
69
- ActiveRecord::Base.connection.table_exists?(:users)
70
- end
71
-
72
- end
@@ -1,24 +0,0 @@
1
-
2
- *******************************************************************************
3
-
4
- Next:
5
-
6
- 1. Configure default url options for the mailer to generate URLs in emails.
7
- In production.rb it must be the actual host your application is deployed to.
8
- In config/environments/test.rb and config/environments/development.rb:
9
-
10
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
11
-
12
- 2. Migrate:
13
-
14
- rake db:migrate
15
-
16
- 4. Make sure you're displaying flashes somewhere. For instance, in a layout:
17
-
18
- <div id="flash">
19
- <% flash.each do |key, value| -%>
20
- <div id="flash_<%= key %>"><%=h value %></div>
21
- <% end -%>
22
- </div>
23
-
24
- *******************************************************************************
@@ -1,19 +0,0 @@
1
- class ClearanceCreateUsers < ActiveRecord::Migration
2
- def self.up
3
- create_table(:users) do |t|
4
- t.string :email
5
- t.string :encrypted_password, :limit => 128
6
- t.string :salt, :limit => 128
7
- t.string :confirmation_token, :limit => 128
8
- t.string :remember_token, :limit => 128
9
- t.timestamps
10
- end
11
-
12
- add_index :users, :email
13
- add_index :users, :remember_token
14
- end
15
-
16
- def self.down
17
- drop_table :users
18
- end
19
- end
@@ -1,14 +0,0 @@
1
- class ClearanceViewsGenerator < Rails::Generators::Base
2
- desc "Put the clearance views in place"
3
-
4
- def self.source_root
5
- @_clearance_source_root ||= File.join(File.dirname(__FILE__), "clearance_views_templates")
6
- end
7
-
8
- def install
9
- strategy = "formtastic"
10
- template_strategy = "erb"
11
-
12
- directory "#{strategy}/#{template_strategy}", "app/views"
13
- end
14
- end
@@ -1,21 +0,0 @@
1
- <h2>Change your password</h2>
2
-
3
- <p>
4
- Your password has been reset. Choose a new password below.
5
- </p>
6
-
7
- <%= semantic_form_for(:user,
8
- :url => user_password_path(@user, :token => @user.confirmation_token),
9
- :html => { :method => :put }) do |form| %>
10
- <%= form.error_messages %>
11
- <%= form.inputs do -%>
12
- <%= form.input :password, :as => :password,
13
- :label => "Choose password" %>
14
- <%= form.input :password_confirmation, :as => :password,
15
- :label => "Confirm password" %>
16
- <% end -%>
17
- <%= form.buttons do -%>
18
- <%= form.commit_button "Save this password" %>
19
- <% end -%>
20
- <% end %>
21
-
@@ -1,15 +0,0 @@
1
- <h2>Reset your password</h2>
2
-
3
- <p>
4
- We will email you a link to reset your password.
5
- </p>
6
-
7
- <%= semantic_form_for :password, :url => passwords_path do |form| -%>
8
- <%= form.inputs do -%>
9
- <%= form.input :email, :label => "Email address" %>
10
- <% end -%>
11
- <%= form.buttons do -%>
12
- <%= form.commit_button "Reset password" %>
13
- <% end -%>
14
- <% end -%>
15
-
@@ -1,21 +0,0 @@
1
- <h2>Sign in</h2>
2
-
3
- <%= semantic_form_for :session, :url => session_path do |form| %>
4
- <%= form.inputs do %>
5
- <%= form.input :email %>
6
- <%= form.input :password, :as => :password %>
7
- <% end %>
8
- <%= form.buttons do %>
9
- <%= form.commit_button "Sign in" %>
10
- <% end %>
11
- <% end %>
12
-
13
- <ul>
14
- <li>
15
- <%= link_to "Sign up", sign_up_path %>
16
- </li>
17
- <li>
18
- <%= link_to "Forgot password?", new_password_path %>
19
- </li>
20
- </ul>
21
-
@@ -1,10 +0,0 @@
1
- <h2>Sign up</h2>
2
-
3
- <%= semantic_form_for @user do |form| %>
4
- <%= form.error_messages %>
5
- <%= render :partial => "/users/inputs", :locals => { :form => form } %>
6
- <%= form.buttons do %>
7
- <%= form.commit_button "Sign up" %>
8
- <% end %>
9
- <% end %>
10
-