heroku_config_vars 0.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +1 -0
  3. data/Rakefile +30 -0
  4. data/app/assets/javascripts/heroku_config_vars/application.js +15 -0
  5. data/app/assets/javascripts/heroku_config_vars/var_form.js +28 -0
  6. data/app/assets/stylesheets/heroku_config_vars/application.css +31 -0
  7. data/app/assets/stylesheets/heroku_config_vars/button.css.scss +54 -0
  8. data/app/assets/stylesheets/heroku_config_vars/menu.css.scss +36 -0
  9. data/app/assets/stylesheets/heroku_config_vars/table.css.scss +28 -0
  10. data/app/controllers/heroku_config_vars/application_controller.rb +46 -0
  11. data/app/controllers/heroku_config_vars/heroku_apps_controller.rb +50 -0
  12. data/app/helpers/heroku_config_vars/application_helper.rb +8 -0
  13. data/app/models/heroku_config_vars/heroku_app.rb +138 -0
  14. data/app/views/heroku_config_vars/application/env.html.erb +14 -0
  15. data/app/views/heroku_config_vars/application/recommend_https.html.erb +6 -0
  16. data/app/views/heroku_config_vars/heroku_apps/_errors.html.erb +5 -0
  17. data/app/views/heroku_config_vars/heroku_apps/confirmation.html.erb +73 -0
  18. data/app/views/heroku_config_vars/heroku_apps/edit.html.erb +37 -0
  19. data/app/views/heroku_config_vars/heroku_apps/new.html.erb +21 -0
  20. data/app/views/heroku_config_vars/heroku_apps/show.html.erb +20 -0
  21. data/app/views/layouts/heroku_config_vars/application.html.erb +20 -0
  22. data/config/routes.rb +5 -0
  23. data/lib/heroku_config_vars/engine.rb +12 -0
  24. data/lib/heroku_config_vars/version.rb +3 -0
  25. data/lib/heroku_config_vars.rb +5 -0
  26. data/lib/tasks/heroku_config_vars_tasks.rake +4 -0
  27. data/spec/dummy/README.rdoc +261 -0
  28. data/spec/dummy/Rakefile +7 -0
  29. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  30. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  31. data/spec/dummy/app/controllers/application_controller.rb +8 -0
  32. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  33. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  34. data/spec/dummy/config/application.rb +49 -0
  35. data/spec/dummy/config/boot.rb +10 -0
  36. data/spec/dummy/config/environment.rb +5 -0
  37. data/spec/dummy/config/environments/development.rb +29 -0
  38. data/spec/dummy/config/environments/test.rb +29 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/inflections.rb +15 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  43. data/spec/dummy/config/initializers/session_store.rb +8 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +5 -0
  46. data/spec/dummy/config/routes.rb +4 -0
  47. data/spec/dummy/config.ru +4 -0
  48. data/spec/dummy/log/test.log +6002 -0
  49. data/spec/dummy/public/404.html +26 -0
  50. data/spec/dummy/public/422.html +26 -0
  51. data/spec/dummy/public/500.html +25 -0
  52. data/spec/dummy/public/favicon.ico +0 -0
  53. data/spec/dummy/script/rails +6 -0
  54. data/spec/dummy/tmp/cache/assets/C20/540/sprockets%2F9f7052464a49612e023f9088fa442053 +0 -0
  55. data/spec/dummy/tmp/cache/assets/C97/2C0/sprockets%2F3945d527e8ea800568e77dd095c67391 +0 -0
  56. data/spec/dummy/tmp/cache/assets/C9B/060/sprockets%2Fa20484759fec963d3f51839934c3848f +0 -0
  57. data/spec/dummy/tmp/cache/assets/CAC/5E0/sprockets%2F425b0f4900e04b7736af6e64c4f46902 +0 -0
  58. data/spec/dummy/tmp/cache/assets/CBA/440/sprockets%2F8291695bea92c347d6a509dfa2379810 +0 -0
  59. data/spec/dummy/tmp/cache/assets/CBF/C20/sprockets%2Fdd57917c8268e99fe0a17332550ef632 +0 -0
  60. data/spec/dummy/tmp/cache/assets/CD9/8E0/sprockets%2F0681932233ab9af521f58c34cbf091f5 +0 -0
  61. data/spec/dummy/tmp/cache/assets/CF0/D20/sprockets%2F6997e8f2f3f34b07c51d6689d3ec5120 +0 -0
  62. data/spec/dummy/tmp/cache/assets/CFA/C10/sprockets%2Fca5852e7ebc212e12405091c0ca7a449 +0 -0
  63. data/spec/dummy/tmp/cache/assets/D0C/BD0/sprockets%2F7e5673b3d2e6c24b8a290ff222a4843d +0 -0
  64. data/spec/dummy/tmp/cache/assets/D0F/CF0/sprockets%2Fa54d897b366850d6aff2583dcd21141b +0 -0
  65. data/spec/dummy/tmp/cache/assets/D11/650/sprockets%2Fa79c1979284b6712e0a09bdde83c711b +0 -0
  66. data/spec/dummy/tmp/cache/assets/D2A/5E0/sprockets%2F8f9f3295a33983dafe83cbc75895a346 +0 -0
  67. data/spec/dummy/tmp/cache/assets/D2F/830/sprockets%2Fd6b510595130dc04df17a75eae623ee0 +0 -0
  68. data/spec/dummy/tmp/cache/assets/D3A/0E0/sprockets%2F12c0c4243a0757c81af09989ece2d4dc +0 -0
  69. data/spec/dummy/tmp/cache/assets/D3A/B10/sprockets%2Fa6033a4a85f3d8f4f5a68c3215bc64b6 +0 -0
  70. data/spec/dummy/tmp/cache/assets/D44/BB0/sprockets%2F6f8a1b369f3e20121751ff9356bebf8c +0 -0
  71. data/spec/dummy/tmp/cache/assets/D70/B70/sprockets%2Fa1415c8ffaef728e4e786c0e48061ac2 +0 -0
  72. data/spec/dummy/tmp/cache/assets/D94/CA0/sprockets%2Fb36822d80e1aee3257c5cf2f4ddeb043 +0 -0
  73. data/spec/dummy/tmp/cache/assets/DAA/850/sprockets%2F7e2ddb2b088e0c526941fef48af19ff5 +0 -0
  74. data/spec/dummy/tmp/cache/assets/DC3/970/sprockets%2Fd5d2e0cc86cec4e411aa31c549fcb870 +0 -0
  75. data/spec/dummy/tmp/capybara/capybara-201302162255389397158257.html +56 -0
  76. data/spec/dummy/tmp/capybara/capybara-201302162255545698499887.html +56 -0
  77. data/spec/dummy/tmp/capybara/capybara-201302162256212974676040.html +56 -0
  78. data/spec/dummy/tmp/capybara/capybara-201302162256278576954261.html +56 -0
  79. data/spec/dummy/tmp/capybara/capybara-201302200948319507521481.html +26 -0
  80. data/spec/dummy/tmp/capybara/capybara-20130220094839395273181.html +46 -0
  81. data/spec/dummy/tmp/pids/server.pid +1 -0
  82. data/spec/features/config_vars/edit_spec.rb +102 -0
  83. data/spec/features/config_vars/show_spec.rb +39 -0
  84. data/spec/features/env/show_spec.rb +16 -0
  85. data/spec/features/security/requires_admin_spec.rb +9 -0
  86. data/spec/features/security/suggests_ssl_spec.rb +28 -0
  87. data/spec/features/setup/new_app_spec.rb +42 -0
  88. data/spec/helpers/application_helper_spec.rb +15 -0
  89. data/spec/lib/heroku_config_vars_spec.rb +6 -0
  90. data/spec/models/heroku_config_vars/heroku_app_spec.rb +185 -0
  91. data/spec/spec_helper.rb +39 -0
  92. data/spec/support/heroku_responses.rb +35 -0
  93. data/spec/views/heroku_config_vars/application/recommend_https_spec.rb +14 -0
  94. metadata +336 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>HerokuConfigVars</title>
5
+ <link href="/assets/heroku_config_vars/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/heroku_config_vars/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+
11
+ <h2>
12
+ valid_app_name
13
+ </h2>
14
+
15
+ <table>
16
+ <tr>
17
+ <th>
18
+ VAR1
19
+ </th>
20
+ <td>
21
+ value 1
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <th>
26
+ VAR2
27
+ </th>
28
+ <td>
29
+ value 2
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th>
34
+ VAR3
35
+ </th>
36
+ <td>
37
+ value 3
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <th>
42
+ VAR4
43
+ </th>
44
+ <td>
45
+ value 4
46
+ </td>
47
+ </tr>
48
+ </table>
49
+
50
+ <p>
51
+ <a href="/heroku_config_vars/heroku_app/edit">Edit</a>
52
+ </p>
53
+
54
+
55
+ </body>
56
+ </html>
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>HerokuConfigVars</title>
5
+ <link href="/assets/heroku_config_vars/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/heroku_config_vars/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+
11
+ <h2>
12
+ valid_app_name
13
+ </h2>
14
+
15
+ <table>
16
+ <tr>
17
+ <th>
18
+ VAR3
19
+ </th>
20
+ <td>
21
+ value 3
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <th>
26
+ VAR2
27
+ </th>
28
+ <td>
29
+ value 2
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th>
34
+ VAR1
35
+ </th>
36
+ <td>
37
+ value 1
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <th>
42
+ VAR4
43
+ </th>
44
+ <td>
45
+ value 4
46
+ </td>
47
+ </tr>
48
+ </table>
49
+
50
+ <p>
51
+ <a href="/heroku_config_vars/heroku_app/edit">Edit</a>
52
+ </p>
53
+
54
+
55
+ </body>
56
+ </html>
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>HerokuConfigVars</title>
5
+ <link href="/assets/heroku_config_vars/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/heroku_config_vars/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+
11
+ <h2>
12
+ valid_app_name
13
+ </h2>
14
+
15
+ <table>
16
+ <tr>
17
+ <th>
18
+ VAR3
19
+ </th>
20
+ <td>
21
+ value 3
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <th>
26
+ VAR2
27
+ </th>
28
+ <td>
29
+ value 2
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th>
34
+ VAR1
35
+ </th>
36
+ <td>
37
+ value 1
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <th>
42
+ VAR4
43
+ </th>
44
+ <td>
45
+ value 4
46
+ </td>
47
+ </tr>
48
+ </table>
49
+
50
+ <p>
51
+ <a href="/heroku_config_vars/heroku_app/edit">Edit</a>
52
+ </p>
53
+
54
+
55
+ </body>
56
+ </html>
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>HerokuConfigVars</title>
5
+ <link href="/assets/heroku_config_vars/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/heroku_config_vars/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+
11
+ <h2>
12
+ valid_app_name
13
+ </h2>
14
+
15
+ <table>
16
+ <tr>
17
+ <th>
18
+ VAR3
19
+ </th>
20
+ <td>
21
+ value 3
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <th>
26
+ VAR2
27
+ </th>
28
+ <td>
29
+ value 2
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th>
34
+ VAR1
35
+ </th>
36
+ <td>
37
+ value 1
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <th>
42
+ VAR4
43
+ </th>
44
+ <td>
45
+ value 4
46
+ </td>
47
+ </tr>
48
+ </table>
49
+
50
+ <p>
51
+ <a href="/heroku_config_vars/heroku_app/edit">Edit</a>
52
+ </p>
53
+
54
+
55
+ </body>
56
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>HerokuConfigVars</title>
5
+ <link href="/assets/heroku_config_vars/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/heroku_config_vars/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+ <h1>Heroku Configurator</h1>
11
+
12
+ <ul class="submenu">
13
+ <li><span class="menu-option">Heroku Configuration Variables</span></li>
14
+ <li><a href="/heroku_config_vars/env"><span class="menu-option">Native Environment</span></a></li>
15
+ </ul>
16
+
17
+ <h2>WARNING</h2>
18
+
19
+ <p>You are trying to view sensitive application configuration over an <strong>insecure connection</strong>.</p>
20
+ <p>It is highly recommended that you view this over https.</p>
21
+ <a href="https://www.example.com/heroku_config_vars/heroku_app" class="happy button">Switch to secure connection</a>
22
+ <a href="/heroku_config_vars/heroku_app?insecure=ok" class="sad button">Continue insecurely</a>
23
+
24
+
25
+ </body>
26
+ </html>
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>HerokuConfigVars</title>
5
+ <link href="/assets/heroku_config_vars/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/heroku_config_vars/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+ <h1>Heroku Configurator</h1>
11
+
12
+ <ul class="submenu">
13
+ <li><span class="menu-option">Heroku Configuration Variables</span></li>
14
+ <li><a href="/heroku_config_vars/env"><span class="menu-option">Native Environment</span></a></li>
15
+ </ul>
16
+
17
+ <h2>
18
+ valid_app_name
19
+ </h2>
20
+
21
+ <table>
22
+ <tr>
23
+ <th>
24
+ HEROKU_API_KEY
25
+ </th>
26
+ <td>
27
+ valid_api_key
28
+ </td>
29
+ </tr>
30
+ <tr>
31
+ <th>
32
+ HEROKU_APP_NAME
33
+ </th>
34
+ <td>
35
+ valid_app_name
36
+ </td>
37
+ </tr>
38
+ </table>
39
+
40
+ <p>
41
+ <a href="/heroku_config_vars/heroku_app/edit">Edit</a>
42
+ </p>
43
+
44
+
45
+ </body>
46
+ </html>
@@ -0,0 +1 @@
1
+ 1956
@@ -0,0 +1,102 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'Edit Herkou configuration' do
4
+
5
+ stub_heroku_responses
6
+ setup_app
7
+
8
+ let(:live_vars) do
9
+ {
10
+ 'VAR3' => 'value 3',
11
+ 'VAR2' => 'value 2',
12
+ 'VAR1' => 'value 1',
13
+ 'VAR4' => 'value 4'
14
+ }
15
+ end
16
+
17
+ # TODO: move most of this into a view spec
18
+ scenario 'Vist the edit page' do
19
+ visit edit_heroku_app_url(protocol: 'https')
20
+
21
+ within 'h2' do
22
+ expect(page).to have_link valid_app_name, href: heroku_app_path
23
+ expect(page).to have_text "Edit Configuration"
24
+ end
25
+
26
+ (1..4).each do |i|
27
+ within "tr:nth(#{i})" do
28
+ expect(page).to have_selector 'th', text: "VAR#{i}"
29
+ expect(page).to have_field "VAR#{i}", with: "value #{i}"
30
+ expect(page).to have_unchecked_field 'Delete'
31
+ end
32
+ end
33
+
34
+ within 'tr:last' do
35
+ expect(page).to have_field 'add[][key]'
36
+ expect(page).to have_field 'add[][value]'
37
+ end
38
+
39
+ expect(page).to have_button 'Prepare...'
40
+ expect(page).to have_link 'Cancel', href: heroku_app_path
41
+ end
42
+
43
+ ## ----
44
+
45
+ let(:set_vars) do
46
+ {
47
+ "VAR2" => "value 2 updated",
48
+ "NEW_KEY" => "a new value"
49
+ }
50
+ end
51
+
52
+ let(:delete_var) { 'VAR1' }
53
+
54
+ def visit_form
55
+ visit heroku_app_url(protocol: 'https')
56
+ click_link 'Edit'
57
+ end
58
+
59
+ def cancel
60
+ click_link 'Cancel'
61
+ end
62
+
63
+ def fill_out_form
64
+ fill_in 'VAR2', with: 'value 2 updated'
65
+ within 'tr:first' do |variable|
66
+ check 'Delete'
67
+ end
68
+ fill_in 'add[][key]', with: 'NEW_KEY'
69
+ fill_in 'add[][value]', with: 'a new value'
70
+ click_button 'Prepare...'
71
+ # expect the changes to displayed
72
+ end
73
+
74
+ def confirm
75
+ click_button 'Update and restart app'
76
+ # expect the vars to be updated
77
+ end
78
+
79
+ scenario 'Cancel update' do
80
+ visit_form
81
+ cancel
82
+
83
+ expect(current_path).to eq heroku_app_path
84
+ end
85
+
86
+ scenario 'Update vars and confirm' do
87
+ visit_form
88
+ fill_out_form
89
+ confirm
90
+
91
+ expect(current_path).to eq edit_heroku_app_path
92
+ end
93
+
94
+ scenario 'Update vars and cancel' do
95
+ visit_form
96
+ fill_out_form
97
+ cancel
98
+
99
+ expect(current_path).to eq edit_heroku_app_path
100
+ end
101
+
102
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ feature "Show heroku config vars" do
4
+
5
+ stub_heroku_responses
6
+ setup_app
7
+
8
+ let(:live_vars) do
9
+ {
10
+ 'VAR3' => 'value 3',
11
+ 'VAR2' => 'value 2',
12
+ 'VAR1' => 'value 1',
13
+ 'VAR4' => 'value 4'
14
+ }
15
+ end
16
+
17
+ scenario "Visit vars path" do
18
+ visit heroku_app_url(protocol: 'https')
19
+
20
+ expect(page).to have_selector 'h2', text: valid_app_name
21
+
22
+ expect(page).to have_selector 'tr:nth(1) th', text: 'VAR1'
23
+ expect(page).to have_selector 'tr:nth(1) td', text: 'value 1'
24
+
25
+ expect(page).to have_selector 'tr:nth(2) th', text: 'VAR2'
26
+ expect(page).to have_selector 'tr:nth(2) td', text: 'value 2'
27
+
28
+ expect(page).to have_selector 'tr:nth(3) th', text: 'VAR3'
29
+ expect(page).to have_selector 'tr:nth(3) td', text: 'value 3'
30
+
31
+ expect(page).to have_selector 'tr:nth(4) th', text: 'VAR4'
32
+ expect(page).to have_selector 'tr:nth(4) td', text: 'value 4'
33
+
34
+ expect(page).to have_link 'Edit', href: edit_heroku_app_path
35
+
36
+ # check for menu
37
+ expect(page).to have_selector 'li', text: 'Heroku Configuration Variables'
38
+ end
39
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ feature "Show ENV" do
4
+
5
+ before do
6
+ ENV['FOO'] = 'bar'
7
+ end
8
+
9
+ scenario "Visit env path" do
10
+ visit env_url(protocol: 'https')
11
+
12
+ expect(page).to have_selector 'h2', text: 'ENV'
13
+ expect(page).to have_selector 'th', text: 'FOO'
14
+ expect(page).to have_selector 'td', text: 'bar'
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ feature "Requires admin" do
4
+
5
+ scenario 'non-admin user visits' do
6
+ expect { visit root_path protocol: 'http', admin: false }.to raise_error ActionController::RoutingError
7
+ end
8
+
9
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ feature "Suggests SSL" do
4
+
5
+ scenario "Switch to secure connection" do
6
+ visit root_path protocol: 'http'
7
+ click_link 'Switch to secure connection'
8
+
9
+ expect(current_url).to start_with 'https'
10
+ expect(current_path).to start_with root_path
11
+ end
12
+
13
+ scenario 'Remain insecure' do
14
+ visit root_path protocol: 'http'
15
+ click_link 'Continue insecurely'
16
+
17
+ expect(current_url).to start_with 'http'
18
+ expect(current_path).to start_with root_path
19
+
20
+ # Make sure our insecure choice is remembered
21
+ visit root_path protocol: 'http'
22
+
23
+ expect(current_url).to start_with 'http'
24
+ expect(page).not_to have_link 'Continue insecurely'
25
+ end
26
+
27
+
28
+ end