diff --git a/features/session_and_cookies_handling.feature b/features/session_and_cookies_handling.feature index 57d70b8..5a644d5 100644 --- a/features/session_and_cookies_handling.feature +++ b/features/session_and_cookies_handling.feature @@ -16,6 +16,15 @@ Feature: session and cookies handling When I go to the homepage Then there must be no cookies + Scenario: user_data, not logged in + When I make a AJAX request to the user data path + Then there must be no cookies + + Scenario: user_data, logged in + Given I am logged in as admin + When I make a AJAX request to the user data path + Then there must be a cookie "_noosfero_session" + # FIXME for some reason I could not test this scenario, although manual tests # indicate this works! # Scenario: logout diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index d77d1f0..5522551 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -576,3 +576,8 @@ end Given /^the cache is turned (on|off)$/ do |state| ActionController::Base.perform_caching = (state == 'on') end + +When /^I make a AJAX request to (.*)$/ do |page| + header 'X-Requested-With', 'XMLHttpRequest' + visit(path_to(page)) +end diff --git a/features/support/paths.rb b/features/support/paths.rb index 89be7f8..03daa8a 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -96,6 +96,9 @@ module NavigationHelpers when /^chat$/ '/chat' + when /the user data path/ + '/account/user_data' + # Add more mappings here. # Here is a more fancy example: # diff --git a/vendor/plugins/noosfero_caching/init.rb b/vendor/plugins/noosfero_caching/init.rb index ecc2804..ba951bf 100644 --- a/vendor/plugins/noosfero_caching/init.rb +++ b/vendor/plugins/noosfero_caching/init.rb @@ -27,7 +27,7 @@ module NoosferoHttpCaching end def noosfero_session_check - return if params[:controller] == 'account' || request.xhr? + return if (params[:controller] == 'account' && params[:action] != 'user_data') headers["X-Noosfero-Auth"] = (session[:user] != nil).to_s end -- libgit2 0.21.2