Module: Capybara::Lockstep::Helper

Defined in:
lib/capybara-lockstep/helper.rb

Constant Summary collapse

JS_PATH =
File.expand_path('../helper.js', __FILE__)
HELPER_JS =
IO.read(JS_PATH)

Instance Method Summary collapse

Instance Method Details

#capybara_lockstep(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/capybara-lockstep/helper.rb', line 12

def capybara_lockstep(options = {})
  tag_options = {}

  # Add a CSRF nonce if supported by our Rails version
  if Rails.version >= '5'
    tag_options[:nonce] = options.fetch(:nonce, true)
  end

  javascript_tag(capybara_lockstep_js(options), tag_options)
end

#capybara_lockstep_js(options = {}) ⇒ Object



8
9
10
# File 'lib/capybara-lockstep/helper.rb', line 8

def capybara_lockstep_js(options = {})
  HELPER_JS + capybara_lockstep_config_js(options)
end