From bcc2ef99fd58998cacbdf51da67a19d3bd150529 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 21 Nov 2012 11:49:59 +1100 Subject: [PATCH] Ensure that AUTH_TOKEN var is set in tests, since spree's admin JS errors without it --- app/overrides/set_auth_token_in_test.rb | 9 +++++++++ app/views/layouts/_auth_token_script.html.haml | 4 ++++ 2 files changed, 13 insertions(+) create mode 100644 app/overrides/set_auth_token_in_test.rb create mode 100644 app/views/layouts/_auth_token_script.html.haml diff --git a/app/overrides/set_auth_token_in_test.rb b/app/overrides/set_auth_token_in_test.rb new file mode 100644 index 0000000000..eb1b7128b3 --- /dev/null +++ b/app/overrides/set_auth_token_in_test.rb @@ -0,0 +1,9 @@ +Deface::Override.new(:virtual_path => "spree/layouts/spree_application", + :insert_bottom => "[data-hook='inside_head']", + :partial => "layouts/auth_token_script", + :name => "auth_token_script") + +Deface::Override.new(:virtual_path => "spree/layouts/admin", + :insert_bottom => "[data-hook='admin_inside_head']", + :partial => "layouts/auth_token_script", + :name => "auth_token_script") diff --git a/app/views/layouts/_auth_token_script.html.haml b/app/views/layouts/_auth_token_script.html.haml new file mode 100644 index 0000000000..bc0f6c8dc4 --- /dev/null +++ b/app/views/layouts/_auth_token_script.html.haml @@ -0,0 +1,4 @@ +:javascript + if(typeof AUTH_TOKEN === 'undefined') { + var AUTH_TOKEN = ''; + }