devise-verifiable 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +14 -0
  4. data/Rakefile +37 -0
  5. data/app/controllers/devise/verification_controller.rb +37 -0
  6. data/app/views/devise/verification/new.erb +17 -0
  7. data/config/locales/en.yml +4 -0
  8. data/lib/devise-verifiable.rb +20 -0
  9. data/lib/devise/controller/helpers.rb +22 -0
  10. data/lib/devise/models/verifiable.rb +59 -0
  11. data/lib/devise/verifiable/engine.rb +12 -0
  12. data/lib/devise/verifiable/routes.rb +18 -0
  13. data/lib/devise/verifiable/version.rb +5 -0
  14. data/lib/tasks/devise_verifiable_tasks.rake +4 -0
  15. data/test/devise_verifiable_test.rb +7 -0
  16. data/test/dummy/Rakefile +6 -0
  17. data/test/dummy/app/assets/javascripts/application.js +13 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  19. data/test/dummy/app/controllers/application_controller.rb +5 -0
  20. data/test/dummy/app/controllers/home_controller.rb +6 -0
  21. data/test/dummy/app/helpers/application_helper.rb +2 -0
  22. data/test/dummy/app/models/user.rb +6 -0
  23. data/test/dummy/app/views/home/index.html.erb +2 -0
  24. data/test/dummy/app/views/layouts/application.html.erb +17 -0
  25. data/test/dummy/bin/bundle +3 -0
  26. data/test/dummy/bin/rails +4 -0
  27. data/test/dummy/bin/rake +4 -0
  28. data/test/dummy/bin/setup +29 -0
  29. data/test/dummy/config.ru +4 -0
  30. data/test/dummy/config/application.rb +13 -0
  31. data/test/dummy/config/boot.rb +5 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +5 -0
  34. data/test/dummy/config/environments/development.rb +41 -0
  35. data/test/dummy/config/environments/production.rb +79 -0
  36. data/test/dummy/config/environments/test.rb +42 -0
  37. data/test/dummy/config/initializers/assets.rb +11 -0
  38. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  40. data/test/dummy/config/initializers/devise.rb +267 -0
  41. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  42. data/test/dummy/config/initializers/inflections.rb +16 -0
  43. data/test/dummy/config/initializers/mime_types.rb +4 -0
  44. data/test/dummy/config/initializers/session_store.rb +3 -0
  45. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/test/dummy/config/locales/devise.en.yml +62 -0
  47. data/test/dummy/config/locales/en.yml +23 -0
  48. data/test/dummy/config/routes.rb +6 -0
  49. data/test/dummy/config/secrets.yml +22 -0
  50. data/test/dummy/db/development.sqlite3 +0 -0
  51. data/test/dummy/db/migrate/20160326191549_create_users.rb +13 -0
  52. data/test/dummy/db/migrate/20160326200137_add_devise_to_users.rb +49 -0
  53. data/test/dummy/db/schema.rb +39 -0
  54. data/test/dummy/db/test.sqlite3 +0 -0
  55. data/test/dummy/log/development.log +723 -0
  56. data/test/dummy/log/test.log +14134 -0
  57. data/test/dummy/public/404.html +67 -0
  58. data/test/dummy/public/422.html +67 -0
  59. data/test/dummy/public/500.html +66 -0
  60. data/test/dummy/public/favicon.ico +0 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v3.0/0P64YMvGLyegqKbcLGgQEMgpMem2a76XNfbXIz9-Ey0.cache +1 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1dJiU-fQPONR0DpPbDVF8uV-KnmaNjmvmOwPj96fQjM.cache +0 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v3.0/534R9hua9PcmJx52xsGKCkjQOOpAz82i1NVXrew7wRI.cache +0 -0
  64. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
  65. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BJSW3SvCsdyDxfrPXPEX-SdPn6WpFejINpQC-ohzq1M.cache +1 -0
  66. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ch2bQFHkYziI9Erdkuj8uoPJyw0W2aA5prtYAqlccww.cache +1 -0
  67. data/test/dummy/tmp/cache/assets/sprockets/v3.0/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +2 -0
  68. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FsGm4YIKEUTAAoLtBvqu9W2QJph2IK0QwuDkhZTX9Po.cache +1 -0
  69. data/test/dummy/tmp/cache/assets/sprockets/v3.0/IvDM1j8-H1H6kEjVCsyIW8N2zla-aIp9q_OE9PVZtVw.cache +1 -0
  70. data/test/dummy/tmp/cache/assets/sprockets/v3.0/J7VgE3aDZL9AndrYm8x10MZyJhmtGgOqKVF7sDlAn6g.cache +0 -0
  71. data/test/dummy/tmp/cache/assets/sprockets/v3.0/JMWwR7l28LmBEVBcM5dlvxSMN8WXl5AYuCL_61oGl0o.cache +0 -0
  72. data/test/dummy/tmp/cache/assets/sprockets/v3.0/K9ZheMi0hi4DNLzmDMRnv9A_lOVz33kNImc16Now42o.cache +1 -0
  73. data/test/dummy/tmp/cache/assets/sprockets/v3.0/LHgjtAV8kdldaJ_dX0RCznzjmWYRuLdhU29fZCJ0VmU.cache +1 -0
  74. data/test/dummy/tmp/cache/assets/sprockets/v3.0/NnUCa7jNYx9HCmEB7E7WPWT00DwaM4IYICy1Ju1jjcs.cache +1 -0
  75. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
  76. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OlBX9JIv9SAOmK2t35x1SYDx1sxCXF0yvqpna3WMyH0.cache +1 -0
  77. data/test/dummy/tmp/cache/assets/sprockets/v3.0/YrZ0OIHu42cExs1kqngMA6ShVDKhfGmhyW-E9haNo5Y.cache +1 -0
  78. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dGmwK2w4ea6Db33cXkyKS6ufPhxdaAcKsHWKqy4q7u8.cache +0 -0
  79. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fLS-tnaEaPlVn0Fq4Ug11zN5DgVroLYMXYN2OdjFjsk.cache +0 -0
  80. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +2 -0
  81. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gpiWtnqpufka8lRtMznM6Ko0aWJrcH_j8cfZwdYmzNI.cache +1 -0
  82. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
  83. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jd9LtCHlkjxlA-wzs0l6_1jn61CDnMmqYnjRMYnEHlE.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/sprockets/v3.0/kzdSvu57G4i6eTuarsZCAfbhbICnkRa0Xhi0b9ua6qk.cache +1 -0
  85. data/test/dummy/tmp/cache/assets/sprockets/v3.0/n9y1tI8pEiZFScheiDHWNB37EK6_rfbXTYMY5nC6bd0.cache +0 -0
  86. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
  87. data/test/dummy/tmp/cache/assets/sprockets/v3.0/rCO5-bHVJ6Y_GsPBmOPUL23pfjvc2Gw2zt_ODmZsygw.cache +1 -0
  88. data/test/dummy/tmp/cache/assets/sprockets/v3.0/s6AtMNZlL_Kj-d3p2Resd_EU2Dy2v2Nn3rQnZvlmML4.cache +0 -0
  89. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sFqi-B8R6HSSCM6DhcvfXJk3vZeoIUDAR02K9P3JRBs.cache +0 -0
  90. data/test/dummy/tmp/cache/assets/sprockets/v3.0/x3o-vQBj2yHdj2-2aquYbWr5KEAIYG1rFAAx70fHJDc.cache +0 -0
  91. data/test/dummy/tmp/pids/server.pid +1 -0
  92. data/test/fixtures/users.yml +11 -0
  93. data/test/integration/navigation_test.rb +24 -0
  94. data/test/integration/verification_test.rb +39 -0
  95. data/test/models/verifiable_test.rb +31 -0
  96. data/test/routes_test.rb +26 -0
  97. data/test/support/integration_case.rb +23 -0
  98. data/test/support/matchers.rb +13 -0
  99. data/test/test_helper.rb +30 -0
  100. metadata +284 -0
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1 @@
1
+ "%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
@@ -0,0 +1 @@
1
+ "%Ѱč@�����6H�uZoX�Z�gbh0W��V
@@ -0,0 +1 @@
1
+ I"�app/assets/stylesheets/application.css?type=text/css&pipeline=debug&id=4c251396459c0628f54a882140aab3497d06bfbaa89e65e07f355a15c2160921:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"?processors:type=text/css&file_type=text/css&pipeline=debug;TTI"9file-digest://app/assets/stylesheets/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI")file-digest://app/assets/stylesheets;TT
@@ -0,0 +1 @@
1
+ "%�W\�yho9S���ƫ˥��)|�~���(���
@@ -0,0 +1 @@
1
+ I"}app/assets/stylesheets/application.css?type=text/css&id=5bcdd5d40fb42f4cf3001ea37f61eda1a4867b6d09dbdf71d86deef08c51fa1f:ET
@@ -0,0 +1 @@
1
+ I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=e74045e523a0f0554e54d279dd0fe5a0f731f44776d810f5927ff053852fb675:ET
@@ -0,0 +1 @@
1
+ I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=03c24e81f2c6e83cd825083cd04be838e5c9fd3ed3706f079ab99616583b26e3:ET
@@ -0,0 +1 @@
1
+ I"}app/assets/stylesheets/application.css?type=text/css&id=6569fdefcee0c0b2b3f17830ef4303a5a202a4b04e9d24164327faba507eeb00:ET
@@ -0,0 +1 @@
1
+ I"�app/assets/javascripts/application.js?type=application/javascript&id=1662de21a95bc3465dc4f4bb53e686cb8977cf0f7513e222bc336a23b9794af1:ET
@@ -0,0 +1 @@
1
+ I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=4bdd62eedd3ae9d5c276d2475ab5b2ad2b3f34a10795f359208c740be33600cd:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"[processors:type=application/javascript&file_type=application/javascript&pipeline=debug;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI")file-digest://app/assets/javascripts;TT
@@ -0,0 +1 @@
1
+ I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=0a0b4fcc59c3f825a8a30bb85caf96a62e11d369401d7da7b52a2042128b5ef7:ET
@@ -0,0 +1 @@
1
+ I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=debug&id=3c98c1eaefb5bfbfc59fd0a39c12206a5e58c40e0b4738ac59f20d61fe178e0a:ET
@@ -0,0 +1 @@
1
+ I"�app/assets/javascripts/application.js?type=application/javascript&id=9199d54bd931f681d1345339b306a0a956fb7e8f3cad1947bb43dd8701f4b419:ET
@@ -0,0 +1 @@
1
+ 81555
@@ -0,0 +1,11 @@
1
+
2
+ john:
3
+ email: "john@gmail.com"
4
+ encrypted_password: <%= Devise::Encryptor.digest(User, '12345678') %>
5
+
6
+
7
+ verified_john:
8
+ email: "verified-john@gmail.com"
9
+ encrypted_password: <%= Devise::Encryptor.digest(User, '12345678') %>
10
+ full_name: Verified John Doe
11
+ address: 551, 5th Street
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActiveSupport::IntegrationCase
4
+ test 'root path requires users authentication' do
5
+ visit root_path
6
+
7
+ assert_equal current_path, '/users/sign_in'
8
+ end
9
+
10
+ test 'unverified user is redirected to verification' do
11
+ sign_in_user
12
+ visit root_path
13
+
14
+ assert_equal current_path, '/users/verification/new'
15
+ end
16
+
17
+ test 'verified user is not redirected to verification' do
18
+ sign_in_user users(:verified_john)
19
+ visit root_path
20
+
21
+ assert_equal current_path, root_path
22
+ end
23
+ end
24
+
@@ -0,0 +1,39 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActiveSupport::IntegrationCase
4
+ test 'verification page shows form with fields for verification' do
5
+ sign_in_user
6
+ visit new_user_verification_path
7
+
8
+ assert_current_path '/users/verification/new'
9
+
10
+ assert_text 'Full name'
11
+ assert_text 'Address'
12
+ assert_button 'Verify'
13
+ end
14
+
15
+ test 'verifies the user filling all fields for verification' do
16
+ sign_in_user
17
+ visit new_user_verification_path
18
+
19
+ fill_in 'user_full_name', with: 'John Doe'
20
+ fill_in 'user_address', with: '555, 5th Street'
21
+
22
+ click_button 'Verify'
23
+
24
+ assert_current_path root_path
25
+ assert_text 'Your account has been verified!'
26
+ end
27
+
28
+ test 'shows errors messages when invalid user' do
29
+ sign_in_user
30
+ visit new_user_verification_path
31
+
32
+ click_button 'Verify'
33
+
34
+ assert_current_path user_verification_path
35
+
36
+ assert_text 'Full name can\'t be blank'
37
+ assert_text 'Address can\'t be blank'
38
+ end
39
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class VerifiableTest < ActiveSupport::TestCase
4
+
5
+ test 'Devise configuration' do
6
+ assert_equal User.fields_for_verification, [:full_name, :address]
7
+ end
8
+
9
+ test 'refuting when user isnt verified' do
10
+ refute User.new.verified?
11
+ end
12
+
13
+ test 'asserting when user is verified' do
14
+ user = User.new(full_name: 'Rodrigo Ra', address: '501, My Address')
15
+
16
+ assert user.verified?
17
+ end
18
+
19
+ test 'adding errors for empty fields for verification' do
20
+ john = users(:john)
21
+
22
+ refute john.valid_for_verification?
23
+
24
+ assert_equal 2, john.errors.size
25
+ assert_not_nil john.errors[:full_name]
26
+ assert_not_nil john.errors[:address]
27
+
28
+ assert_equal ['can\'t be blank'], john.errors[:full_name]
29
+ assert_equal ['can\'t be blank'], john.errors[:address]
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+
4
+ class DefaultRoutingTest < ActionController::TestCase
5
+ test 'map new user verification' do
6
+ assert_recognizes(
7
+ { controller: 'devise/verification', action: 'new' },
8
+ { path: 'users/verification/new', method: :get }
9
+ )
10
+ assert_named_route "/users/verification/new", :new_user_verification_path
11
+ end
12
+
13
+ test 'map user verification' do
14
+ assert_recognizes(
15
+ { controller: 'devise/verification', action: 'create' },
16
+ { path: 'users/verification', method: :post }
17
+ )
18
+ # assert_named_route "/users/sign_in", :user_session_path
19
+ end
20
+
21
+ protected
22
+
23
+ def assert_named_route(result, *args)
24
+ assert_equal result, @routes.url_helpers.send(*args)
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ class ActiveSupport::IntegrationCase < ActionDispatch::IntegrationTest
2
+ include Capybara::DSL
3
+ include Rails.application.routes.url_helpers
4
+ include Warden::Test::Helpers
5
+
6
+ def setup
7
+ logout(:user)
8
+ end
9
+
10
+ def sign_in_user(user = nil, options = {})
11
+ user = users(:john) unless user.present?
12
+
13
+ visit new_user_session_path
14
+
15
+ assert_equal current_path, '/users/sign_in'
16
+
17
+ fill_in 'user_email', with: user.email
18
+ fill_in 'user_password', with: options[:password] || '12345678'
19
+
20
+ click_button 'Log in'
21
+ user
22
+ end
23
+ end