Render user app in test env

This commit is contained in:
2015-01-13 11:59:12 +01:00
parent f11bf57854
commit b614eeeaef
3 changed files with 4 additions and 3 deletions
@@ -1,7 +1,7 @@
module Users module Users
class ApplicationController < ::ApplicationController class ApplicationController < ::ApplicationController
before_action :allow_all_origins before_action :allow_all_origins
before_action :user_authentication, :unless => ->(c){ %w(obtain_token).include?(c.action_name) } # , except: [:obtain_token, :index] before_action :user_authentication, unless: ->(c){ %w(obtain_token).include?(c.action_name) } # , except: [:obtain_token, :index]
private private
@@ -11,6 +11,7 @@ module Users
sign_in user if user sign_in user if user
sign_out current_user if current_user && !user # Other token attempt of logged in user sign_out current_user if current_user && !user # Other token attempt of logged in user
else else
return if Rails.env.test? and action_name == 'index'
authenticate_user! authenticate_user!
end end
+1 -1
View File
@@ -1 +1 @@
0.9.47 0.9.48
+1 -1
View File
@@ -29,7 +29,7 @@ module SpecRouteHelpers
# currentRouteName does not include model information: /list/123 => currentRouteName == 'list' # currentRouteName does not include model information: /list/123 => currentRouteName == 'list'
# page.evaluate_script %|App.__container__.lookup('controller:application').get('currentRouteName')| # page.evaluate_script %|App.__container__.lookup('controller:application').get('currentRouteName')|
# page.evaluate_script %|App.__container__.lookup('router:main').location.lastSetURL| # not working for direct path supplier#/settings # page.evaluate_script %|App.__container__.lookup('router:main').location.lastSetURL| # not working for direct path supplier#/settings
route = page.evaluate_script %{App.__container__ && (window.location.hash || "#/").substr(1)} route = page.evaluate_script(%{App.__container__ && (window.location.hash || "#/").substr(1)})
unless omit_should_raise unless omit_should_raise
def route.should(*) def route.should(*)
raise "Cannot call should on ember route. Use ember_route_should_be instead" raise "Cannot call should on ember route. Use ember_route_should_be instead"