foyer 0.0.1 → 0.1.0

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 (55) hide show
  1. checksums.yaml +8 -8
  2. data/.rspec +1 -0
  3. data/LICENSE.txt +1 -1
  4. data/Rakefile +5 -0
  5. data/foyer.gemspec +3 -0
  6. data/lib/foyer/controller/helpers.rb +55 -0
  7. data/lib/foyer/engine.rb +9 -0
  8. data/lib/foyer/omniauth_callbacks_controller.rb +18 -0
  9. data/lib/foyer/rails.rb +17 -0
  10. data/lib/foyer/test_helpers.rb +11 -0
  11. data/lib/foyer/version.rb +1 -1
  12. data/lib/foyer.rb +19 -2
  13. data/spec/controllers/authenticated_controller_spec.rb +36 -0
  14. data/spec/dummy/app/assets/images/.keep +0 -0
  15. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  16. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  17. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  18. data/spec/dummy/app/controllers/authenticated_controller.rb +9 -0
  19. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  20. data/spec/dummy/app/controllers/sessions_controller.rb +11 -0
  21. data/spec/dummy/app/controllers/unauthenticated_controller.rb +5 -0
  22. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  23. data/spec/dummy/app/mailers/.keep +0 -0
  24. data/spec/dummy/app/models/.keep +0 -0
  25. data/spec/dummy/app/models/concerns/.keep +0 -0
  26. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/dummy/config/application.rb +26 -0
  28. data/spec/dummy/config/boot.rb +5 -0
  29. data/spec/dummy/config/database.yml +25 -0
  30. data/spec/dummy/config/environment.rb +5 -0
  31. data/spec/dummy/config/environments/development.rb +29 -0
  32. data/spec/dummy/config/environments/production.rb +80 -0
  33. data/spec/dummy/config/environments/test.rb +36 -0
  34. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  35. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  36. data/spec/dummy/config/initializers/inflections.rb +16 -0
  37. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  38. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  39. data/spec/dummy/config/initializers/session_store.rb +3 -0
  40. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  41. data/spec/dummy/config/locales/en.yml +23 -0
  42. data/spec/dummy/config/routes.rb +14 -0
  43. data/spec/dummy/config.ru +4 -0
  44. data/spec/dummy/log/.keep +0 -0
  45. data/spec/dummy/log/development.log +0 -0
  46. data/spec/dummy/log/test.log +340 -0
  47. data/spec/dummy/public/404.html +58 -0
  48. data/spec/dummy/public/422.html +58 -0
  49. data/spec/dummy/public/500.html +57 -0
  50. data/spec/dummy/public/favicon.ico +0 -0
  51. data/spec/foyer/controller/helpers_spec.rb +36 -0
  52. data/spec/foyer/omniauth_callbacks_controller_spec.rb +23 -0
  53. data/spec/integration/authenticate_via_route_constraint_spec.rb +28 -0
  54. data/spec/spec_helper.rb +15 -0
  55. metadata +121 -3
@@ -0,0 +1,14 @@
1
+ Rails.application.routes.draw do
2
+
3
+ post '/sign_in' => 'sessions#developer'
4
+
5
+ get '/authenticated' => "authenticated#index"
6
+
7
+ authenticate do
8
+ get '/authenticated_by_route_constraint' => 'unauthenticated#index'
9
+ end
10
+
11
+ authenticate lambda { |user| false } do
12
+ get '/authenticated_by_route_constraint_which_blocks_all_users' => 'unauthenticated#index'
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
File without changes
File without changes
@@ -0,0 +1,340 @@
1
+ Processing by AuthenticatedController#index as HTML
2
+ Completed 500 Internal Server Error in 0ms
3
+ Processing by AuthenticatedController#index as HTML
4
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
5
+ Filter chain halted as :authenticate_user! rendered or redirected
6
+ Completed 302 Found in 0ms
7
+ Processing by AuthenticatedController#index as HTML
8
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
9
+ Filter chain halted as :authenticate_user! rendered or redirected
10
+ Completed 302 Found in 1ms
11
+ Processing by AuthenticatedController#index as HTML
12
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
13
+ Filter chain halted as :authenticate_user! rendered or redirected
14
+ Completed 302 Found in 1ms
15
+ Processing by AuthenticatedController#index as HTML
16
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
17
+ Filter chain halted as :authenticate_user! rendered or redirected
18
+ Completed 302 Found in 0ms
19
+ Processing by AuthenticatedController#index as HTML
20
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
21
+ Filter chain halted as :authenticate_user! rendered or redirected
22
+ Completed 302 Found in 0ms
23
+ Processing by AuthenticatedController#index as HTML
24
+ Completed 500 Internal Server Error in 0ms
25
+ Processing by AuthenticatedController#index as HTML
26
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
27
+ Filter chain halted as :authenticate_user! rendered or redirected
28
+ Completed 302 Found in 0ms
29
+ Processing by AuthenticatedController#index as HTML
30
+ Completed 500 Internal Server Error in 0ms
31
+ Processing by AuthenticatedController#index as HTML
32
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
33
+ Filter chain halted as :authenticate_user! rendered or redirected
34
+ Completed 302 Found in 1ms
35
+ Processing by AuthenticatedController#index as HTML
36
+ Completed 200 OK in 13ms (Views: 12.9ms)
37
+ Processing by AuthenticatedController#index as HTML
38
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
39
+ Filter chain halted as :authenticate_user! rendered or redirected
40
+ Completed 302 Found in 1ms
41
+ Processing by AuthenticatedController#index as HTML
42
+ Completed 200 OK in 8ms (Views: 8.2ms)
43
+ Processing by AuthenticatedController#index as HTML
44
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
45
+ Filter chain halted as :authenticate_user! rendered or redirected
46
+ Completed 302 Found in 1ms
47
+ Processing by AuthenticatedController#index as HTML
48
+ Completed 200 OK in 9ms (Views: 8.8ms)
49
+ Processing by AuthenticatedController#index as HTML
50
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
51
+ Filter chain halted as :authenticate_user! rendered or redirected
52
+ Completed 302 Found in 1ms
53
+ Processing by AuthenticatedController#index as HTML
54
+ Completed 200 OK in 10ms (Views: 9.8ms)
55
+ Processing by AuthenticatedController#index as HTML
56
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
57
+ Filter chain halted as :authenticate_user! rendered or redirected
58
+ Completed 302 Found in 1ms
59
+ Processing by AuthenticatedController#index as HTML
60
+ Completed 200 OK in 9ms (Views: 8.4ms)
61
+ Processing by AuthenticatedController#index as HTML
62
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
63
+ Filter chain halted as :authenticate_user! rendered or redirected
64
+ Completed 302 Found in 0ms
65
+ Processing by AuthenticatedController#index as HTML
66
+ Completed 200 OK in 9ms (Views: 8.6ms)
67
+ Processing by AuthenticatedController#index as HTML
68
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
69
+ Filter chain halted as :authenticate_user! rendered or redirected
70
+ Completed 302 Found in 1ms
71
+ Processing by AuthenticatedController#index as HTML
72
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
73
+ Filter chain halted as :authenticate_user! rendered or redirected
74
+ Completed 302 Found in 0ms
75
+ Processing by AuthenticatedController#index as HTML
76
+ Completed 200 OK in 9ms (Views: 8.5ms)
77
+ Processing by AuthenticatedController#index as HTML
78
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
79
+ Filter chain halted as :authenticate_user! rendered or redirected
80
+ Completed 302 Found in 0ms
81
+ Processing by AuthenticatedController#index as HTML
82
+ Redirected to http://test.host/auth/?origin=%2Fauthenticated
83
+ Filter chain halted as :authenticate_user! rendered or redirected
84
+ Completed 302 Found in 0ms
85
+ Processing by AuthenticatedController#index as HTML
86
+ Completed 200 OK in 9ms (Views: 9.2ms)
87
+ Processing by AuthenticatedController#index as HTML
88
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
89
+ Filter chain halted as :authenticate_user! rendered or redirected
90
+ Completed 302 Found in 1ms
91
+ Processing by AuthenticatedController#index as HTML
92
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
93
+ Filter chain halted as :authenticate_user! rendered or redirected
94
+ Completed 302 Found in 0ms
95
+ Processing by AuthenticatedController#index as HTML
96
+ Completed 200 OK in 9ms (Views: 8.5ms)
97
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:24:17 -0500
98
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:24:40 -0500
99
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:24:56 -0500
100
+ Processing by UnauthenticatedController#index as HTML
101
+ Rendered text template (0.0ms)
102
+ Completed 200 OK in 12ms (Views: 11.9ms)
103
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:25:22 -0500
104
+ Processing by UnauthenticatedController#index as HTML
105
+ Rendered text template (0.0ms)
106
+ Completed 200 OK in 9ms (Views: 8.4ms)
107
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:27:15 -0500
108
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:27:24 -0500
109
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:27:51 -0500
110
+ Processing by UnauthenticatedController#index as HTML
111
+ Rendered text template (0.0ms)
112
+ Completed 200 OK in 9ms (Views: 8.5ms)
113
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:27:59 -0500
114
+ Processing by UnauthenticatedController#index as HTML
115
+ Rendered text template (0.0ms)
116
+ Completed 200 OK in 9ms (Views: 8.6ms)
117
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:28:04 -0500
118
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:30:55 -0500
119
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:32:35 -0500
120
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:32:44 -0500
121
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:33:59 -0500
122
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:34:12 -0500
123
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:34:20 -0500
124
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:35:20 -0500
125
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:36:57 -0500
126
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:37:31 -0500
127
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:38:36 -0500
128
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:38:58 -0500
129
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:39:19 -0500
130
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:39:35 -0500
131
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:40:47 -0500
132
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:40:55 -0500
133
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:42:10 -0500
134
+ Processing by AuthenticatedController#index as HTML
135
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
136
+ Filter chain halted as :authenticate_user! rendered or redirected
137
+ Completed 302 Found in 1ms
138
+ Processing by AuthenticatedController#index as HTML
139
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
140
+ Filter chain halted as :authenticate_user! rendered or redirected
141
+ Completed 302 Found in 0ms
142
+ Processing by AuthenticatedController#index as HTML
143
+ Completed 200 OK in 34ms (Views: 33.6ms)
144
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-16 13:43:50 -0500
145
+ Processing by AuthenticatedController#index as HTML
146
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
147
+ Filter chain halted as :authenticate_user! rendered or redirected
148
+ Completed 302 Found in 1ms
149
+ Processing by AuthenticatedController#index as HTML
150
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
151
+ Filter chain halted as :authenticate_user! rendered or redirected
152
+ Completed 302 Found in 0ms
153
+ Processing by AuthenticatedController#index as HTML
154
+ Completed 200 OK in 42ms (Views: 41.8ms)
155
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:28:15 -0500
156
+ Processing by AuthenticatedController#index as HTML
157
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
158
+ Filter chain halted as :authenticate_user! rendered or redirected
159
+ Completed 302 Found in 1ms
160
+ Processing by AuthenticatedController#index as HTML
161
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
162
+ Filter chain halted as :authenticate_user! rendered or redirected
163
+ Completed 302 Found in 0ms
164
+ Processing by AuthenticatedController#index as HTML
165
+ Completed 200 OK in 34ms (Views: 33.7ms)
166
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:30:02 -0500
167
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:20 -0500
168
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:45:20 -0500
169
+ Processing by SessionsController#developer as HTML
170
+ Completed 204 No Content in 0ms
171
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:20 -0500
172
+ Processing by UnauthenticatedController#index as HTML
173
+ Completed 200 OK in 34ms (Views: 34.0ms)
174
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:29 -0500
175
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:29 -0500
176
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:43 -0500
177
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:43 -0500
178
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:52 -0500
179
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:45:52 -0500
180
+ Processing by SessionsController#developer as HTML
181
+ Completed 204 No Content in 0ms
182
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:45:52 -0500
183
+ Processing by UnauthenticatedController#index as HTML
184
+ Completed 200 OK in 37ms (Views: 36.6ms)
185
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:49:31 -0500
186
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:49:31 -0500
187
+ Processing by SessionsController#developer as HTML
188
+ Completed 204 No Content in 0ms
189
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:49:31 -0500
190
+ Processing by UnauthenticatedController#index as HTML
191
+ Completed 200 OK in 33ms (Views: 32.7ms)
192
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:49:31 -0500
193
+ Processing by SessionsController#developer as HTML
194
+ Completed 204 No Content in 0ms
195
+ Started GET "/authenticated_by_route_constraint_which_blocks_all_users" for 127.0.0.1 at 2014-01-20 15:49:31 -0500
196
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:50:19 -0500
197
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:50:19 -0500
198
+ Processing by SessionsController#developer as HTML
199
+ Completed 204 No Content in 0ms
200
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:50:19 -0500
201
+ Processing by UnauthenticatedController#index as HTML
202
+ Completed 200 OK in 33ms (Views: 32.7ms)
203
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:50:19 -0500
204
+ Processing by SessionsController#developer as HTML
205
+ Completed 204 No Content in 0ms
206
+ Started GET "/authenticated_by_route_constraint_which_blocks_all_users" for 127.0.0.1 at 2014-01-20 15:50:19 -0500
207
+ Processing by AuthenticatedController#index as HTML
208
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
209
+ Filter chain halted as :authenticate_user! rendered or redirected
210
+ Completed 302 Found in 1ms
211
+ Processing by AuthenticatedController#index as HTML
212
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
213
+ Filter chain halted as :authenticate_user! rendered or redirected
214
+ Completed 302 Found in 0ms
215
+ Processing by AuthenticatedController#index as HTML
216
+ Completed 200 OK in 35ms (Views: 35.1ms)
217
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:51:08 -0500
218
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:51:08 -0500
219
+ Processing by SessionsController#developer as HTML
220
+ Completed 204 No Content in 0ms
221
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-01-20 15:51:08 -0500
222
+ Processing by UnauthenticatedController#index as HTML
223
+ Completed 200 OK in 1ms (Views: 0.4ms)
224
+ Started POST "/sign_in" for 127.0.0.1 at 2014-01-20 15:51:08 -0500
225
+ Processing by SessionsController#developer as HTML
226
+ Completed 204 No Content in 0ms
227
+ Started GET "/authenticated_by_route_constraint_which_blocks_all_users" for 127.0.0.1 at 2014-01-20 15:51:08 -0500
228
+ Processing by AuthenticatedController#index as HTML
229
+ Completed 500 Internal Server Error in 1ms
230
+ Processing by AuthenticatedController#index as HTML
231
+ Completed 500 Internal Server Error in 1ms
232
+ Processing by AuthenticatedController#index as HTML
233
+ Completed 500 Internal Server Error in 1ms
234
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:51:12 -0500
235
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:51:12 -0500
236
+ Processing by SessionsController#developer as HTML
237
+ Completed 500 Internal Server Error in 1ms
238
+ Processing by AuthenticatedController#index as HTML
239
+ Completed 500 Internal Server Error in 1ms
240
+ Processing by AuthenticatedController#index as HTML
241
+ Completed 500 Internal Server Error in 1ms
242
+ Processing by AuthenticatedController#index as HTML
243
+ Completed 500 Internal Server Error in 1ms
244
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:51:25 -0500
245
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:51:25 -0500
246
+ Processing by SessionsController#developer as HTML
247
+ Completed 500 Internal Server Error in 1ms
248
+ Processing by AuthenticatedController#index as HTML
249
+ Completed 500 Internal Server Error in 1ms
250
+ Processing by AuthenticatedController#index as HTML
251
+ Completed 500 Internal Server Error in 1ms
252
+ Processing by AuthenticatedController#index as HTML
253
+ Completed 500 Internal Server Error in 1ms
254
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:51:42 -0500
255
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:51:42 -0500
256
+ Processing by SessionsController#developer as HTML
257
+ Completed 500 Internal Server Error in 1ms
258
+ Processing by AuthenticatedController#index as HTML
259
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
260
+ Filter chain halted as :authenticate_user! rendered or redirected
261
+ Completed 302 Found in 1ms
262
+ Processing by AuthenticatedController#index as HTML
263
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
264
+ Filter chain halted as :authenticate_user! rendered or redirected
265
+ Completed 302 Found in 1ms
266
+ Processing by AuthenticatedController#index as HTML
267
+ Completed 200 OK in 14ms (Views: 14.1ms)
268
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:52:02 -0500
269
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:52:02 -0500
270
+ Processing by SessionsController#developer as HTML
271
+ Completed 204 No Content in 14ms
272
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:52:02 -0500
273
+ Processing by AuthenticatedController#index as HTML
274
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
275
+ Filter chain halted as :authenticate_user! rendered or redirected
276
+ Completed 302 Found in 1ms
277
+ Processing by AuthenticatedController#index as HTML
278
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
279
+ Filter chain halted as :authenticate_user! rendered or redirected
280
+ Completed 302 Found in 0ms
281
+ Processing by AuthenticatedController#index as HTML
282
+ Completed 200 OK in 8ms (Views: 7.5ms)
283
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:52:21 -0500
284
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:52:21 -0500
285
+ Processing by SessionsController#developer as HTML
286
+ Completed 204 No Content in 15ms
287
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:52:21 -0500
288
+ Processing by AuthenticatedController#index as HTML
289
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
290
+ Filter chain halted as :authenticate_user! rendered or redirected
291
+ Completed 302 Found in 1ms
292
+ Processing by AuthenticatedController#index as HTML
293
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
294
+ Filter chain halted as :authenticate_user! rendered or redirected
295
+ Completed 302 Found in 0ms
296
+ Processing by AuthenticatedController#index as HTML
297
+ Completed 200 OK in 8ms (Views: 7.7ms)
298
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:53:05 -0500
299
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:53:05 -0500
300
+ Processing by SessionsController#developer as HTML
301
+ Completed 204 No Content in 16ms
302
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:53:05 -0500
303
+ Processing by AuthenticatedController#index as HTML
304
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
305
+ Filter chain halted as :authenticate_user! rendered or redirected
306
+ Completed 302 Found in 1ms
307
+ Processing by AuthenticatedController#index as HTML
308
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
309
+ Filter chain halted as :authenticate_user! rendered or redirected
310
+ Completed 302 Found in 0ms
311
+ Processing by AuthenticatedController#index as HTML
312
+ Completed 200 OK in 8ms (Views: 7.6ms)
313
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:53:26 -0500
314
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:53:26 -0500
315
+ Processing by SessionsController#developer as HTML
316
+ Completed 204 No Content in 0ms
317
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:53:26 -0500
318
+ Processing by UnauthenticatedController#index as HTML
319
+ Completed 200 OK in 1ms (Views: 0.4ms)
320
+ Processing by AuthenticatedController#index as HTML
321
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
322
+ Filter chain halted as :authenticate_user! rendered or redirected
323
+ Completed 302 Found in 1ms
324
+ Processing by AuthenticatedController#index as HTML
325
+ Redirected to http://test.host/auth/gaggleamp?origin=%2Fauthenticated
326
+ Filter chain halted as :authenticate_user! rendered or redirected
327
+ Completed 302 Found in 0ms
328
+ Processing by AuthenticatedController#index as HTML
329
+ Completed 200 OK in 8ms (Views: 7.6ms)
330
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:53:39 -0500
331
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:53:39 -0500
332
+ Processing by SessionsController#developer as HTML
333
+ Completed 204 No Content in 0ms
334
+ Started GET "/authenticated_by_route_constraint" for 127.0.0.1 at 2014-02-04 21:53:39 -0500
335
+ Processing by UnauthenticatedController#index as HTML
336
+ Completed 200 OK in 1ms (Views: 0.4ms)
337
+ Started POST "/sign_in" for 127.0.0.1 at 2014-02-04 21:53:39 -0500
338
+ Processing by SessionsController#developer as HTML
339
+ Completed 204 No Content in 0ms
340
+ Started GET "/authenticated_by_route_constraint_which_blocks_all_users" for 127.0.0.1 at 2014-02-04 21:53:39 -0500
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Foyer::Controller::Helpers do
4
+ class IncludesFoyerControllerHelpers
5
+ def self.helper_method(*)
6
+ nil
7
+ end
8
+
9
+ include Foyer::Controller::Helpers
10
+ end
11
+
12
+ subject { IncludesFoyerControllerHelpers.new }
13
+
14
+ describe ".set_user_finder" do
15
+ it "sets the :user_finder configuration to the provided block" do
16
+ expect {
17
+ subject.class_eval do
18
+ set_user_finder do |user_id|
19
+ user_id
20
+ end
21
+ end
22
+ }.to change(Foyer, :user_finder)
23
+ end
24
+ end
25
+
26
+ describe "#find_user_by_id" do
27
+ it "calls the user_finder method" do
28
+ @called = false
29
+ Foyer.user_finder = lambda { |_| @called = true }
30
+
31
+ subject.find_user_by_id '_'
32
+
33
+ expect(@called).to eq true
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module Foyer
4
+ describe OmniauthCallbacksController, type: :controller do
5
+ describe "#after_sign_in_path" do
6
+ before do
7
+ allow(controller).to receive(:root_path).and_return '/'
8
+ end
9
+
10
+ it "defaults to root path" do
11
+ expect(controller.after_sign_in_path).to eq('/')
12
+ end
13
+
14
+ it "returns omniauth.origin if available" do
15
+ origin = '/some_path'
16
+ @request.env['omniauth.origin'] = origin
17
+
18
+ expect(controller.after_sign_in_path).to eq(origin)
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ require 'ostruct'
2
+ require 'spec_helper'
3
+
4
+ describe "authentication via routes helper" do
5
+ it "does not allow an unauthenticated user to access to route" do
6
+ expect {
7
+ get '/authenticated_by_route_constraint'
8
+ }.to raise_error(ActionController::RoutingError)
9
+ end
10
+
11
+ it "allows authenticated users to access the route" do
12
+ post '/sign_in'
13
+
14
+ get '/authenticated_by_route_constraint'
15
+
16
+ expect(response).to be_success
17
+ end
18
+
19
+ it "allows only certain users to access the route" do
20
+ Foyer.user_finder = lambda { |user_id| nil }
21
+
22
+ post '/sign_in'
23
+
24
+ expect {
25
+ get '/authenticated_by_route_constraint_which_blocks_all_users'
26
+ }.to raise_error(ActionController::RoutingError)
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+
5
+ require 'rspec/rails'
6
+
7
+ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
8
+
9
+ # Requires supporting ruby files with custom matchers and macros, etc,
10
+ # in spec/support/ and its subdirectories.
11
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
12
+
13
+ RSpec.configure do |config|
14
+ config.include Foyer::TestHelpers, :type => :controller
15
+ end