Commit 1c9cd1cbdf102644c1f3a1463d0d281841ae4b95
1 parent
1a384d81
Exists in
master
and in
29 other branches
Fix HTTP caching scheme
(ActionItem2357)
Showing
4 changed files
with
18 additions
and
1 deletions
Show diff stats
features/session_and_cookies_handling.feature
| ... | ... | @@ -16,6 +16,15 @@ Feature: session and cookies handling |
| 16 | 16 | When I go to the homepage |
| 17 | 17 | Then there must be no cookies |
| 18 | 18 | |
| 19 | + Scenario: user_data, not logged in | |
| 20 | + When I make a AJAX request to the user data path | |
| 21 | + Then there must be no cookies | |
| 22 | + | |
| 23 | + Scenario: user_data, logged in | |
| 24 | + Given I am logged in as admin | |
| 25 | + When I make a AJAX request to the user data path | |
| 26 | + Then there must be a cookie "_noosfero_session" | |
| 27 | + | |
| 19 | 28 | # FIXME for some reason I could not test this scenario, although manual tests |
| 20 | 29 | # indicate this works! |
| 21 | 30 | # Scenario: logout | ... | ... |
features/step_definitions/noosfero_steps.rb
| ... | ... | @@ -576,3 +576,8 @@ end |
| 576 | 576 | Given /^the cache is turned (on|off)$/ do |state| |
| 577 | 577 | ActionController::Base.perform_caching = (state == 'on') |
| 578 | 578 | end |
| 579 | + | |
| 580 | +When /^I make a AJAX request to (.*)$/ do |page| | |
| 581 | + header 'X-Requested-With', 'XMLHttpRequest' | |
| 582 | + visit(path_to(page)) | |
| 583 | +end | ... | ... |
features/support/paths.rb
vendor/plugins/noosfero_caching/init.rb
| ... | ... | @@ -27,7 +27,7 @@ module NoosferoHttpCaching |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | def noosfero_session_check |
| 30 | - return if params[:controller] == 'account' || request.xhr? | |
| 30 | + return if (params[:controller] == 'account' && params[:action] != 'user_data') | |
| 31 | 31 | headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s |
| 32 | 32 | end |
| 33 | 33 | ... | ... |