* VRFS-856 - hopefully the fix
This commit is contained in:
parent
9943e4518b
commit
182242c7fb
|
|
@ -52,6 +52,9 @@ module JamAdmin
|
||||||
# Enable escaping HTML in JSON.
|
# Enable escaping HTML in JSON.
|
||||||
config.active_support.escape_html_entities_in_json = true
|
config.active_support.escape_html_entities_in_json = true
|
||||||
|
|
||||||
|
# suppress locale complaint: http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning
|
||||||
|
config.i18n.enforce_available_locales = false
|
||||||
|
|
||||||
# Use SQL instead of Active Record's schema dumper when creating the database.
|
# Use SQL instead of Active Record's schema dumper when creating the database.
|
||||||
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
||||||
# like if you have constraints or database-specific column types
|
# like if you have constraints or database-specific column types
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ end
|
||||||
gem 'rack-test'
|
gem 'rack-test'
|
||||||
# gem 'rb-fsevent', '0.9.1', :require => false
|
# gem 'rb-fsevent', '0.9.1', :require => false
|
||||||
# gem 'growl', '1.0.3'
|
# gem 'growl', '1.0.3'
|
||||||
gem 'poltergeist' #, :path => '/Users/seth/workspace/poltergeist/'
|
gem 'poltergeist'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,9 @@ if defined?(Bundler)
|
||||||
# Version of your assets, change this if you want to expire all your assets
|
# Version of your assets, change this if you want to expire all your assets
|
||||||
config.assets.version = '1.0'
|
config.assets.version = '1.0'
|
||||||
|
|
||||||
|
# suppress locale complaint: http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning
|
||||||
|
config.i18n.enforce_available_locales = false
|
||||||
|
|
||||||
# Add the assets/fonts directory to assets.paths
|
# Add the assets/fonts directory to assets.paths
|
||||||
config.assets.paths << "#{Rails.root}/app/assets/fonts"
|
config.assets.paths << "#{Rails.root}/app/assets/fonts"
|
||||||
|
|
||||||
|
|
@ -159,5 +162,6 @@ if defined?(Bundler)
|
||||||
|
|
||||||
config.ga_ua = 'UA-44184562-2' # google analytics
|
config.ga_ua = 'UA-44184562-2' # google analytics
|
||||||
config.ga_suppress_admin = true
|
config.ga_suppress_admin = true
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,18 @@ Spork.prefork do
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
config.append_after(:each) do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.after(:each) do
|
config.after(:each) do
|
||||||
|
Capybara.reset_sessions!
|
||||||
|
reset_session_mapper
|
||||||
|
|
||||||
if example.metadata[:js]
|
if example.metadata[:js]
|
||||||
Capybara.reset_sessions!
|
|
||||||
#sleep (ENV['SLEEP_JS'] || 0.2).to_i # necessary though otherwise intermittent failures: http://stackoverflow.com/questions/14265983/upgrading-capybara-from-1-0-1-to-1-1-4-makes-database-cleaner-break-my-specs
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# dump response.body if an example fails
|
# dump response.body if an example fails
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,35 @@
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
|
# holds a single test's session name's, mapped to pooled session names
|
||||||
|
$capybara_session_mapper = {}
|
||||||
|
|
||||||
|
# called in before (or after) test, to make sure each test run has it's own map of session names
|
||||||
|
def reset_session_mapper
|
||||||
|
$capybara_session_mapper.clear
|
||||||
|
end
|
||||||
|
|
||||||
|
# manages the mapped session name
|
||||||
|
def mapped_session_name(session_name)
|
||||||
|
return :default if session_name == :default # special treatment for the built-in session
|
||||||
|
$capybara_session_mapper[session_name] ||= $capybara_session_mapper.length
|
||||||
|
end
|
||||||
|
|
||||||
|
# in place of ever using Capybara.session_name directly,
|
||||||
|
# this utility is used to handle the mapping of session names in a way across all tests runs
|
||||||
|
def in_client(name)
|
||||||
|
session_name = name.class == JamRuby::User ? name.id : name
|
||||||
|
|
||||||
|
Capybara.session_name = mapped_session_name(session_name)
|
||||||
|
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def cookie_jar
|
def cookie_jar
|
||||||
Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
|
Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def in_client(name) # to assist multiple-client RSpec/Capybara testing
|
|
||||||
Capybara.session_name = name.class == JamRuby::User ? name.id : name
|
|
||||||
|
|
||||||
yield
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def sign_in(user)
|
def sign_in(user)
|
||||||
visit signin_path
|
visit signin_path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue