Module: RackSessionAccess::Capybara

Defined in:
lib/rack_session_access/capybara.rb

Instance Method Summary collapse

Instance Method Details

#get_rack_sessionObject



13
14
15
16
17
18
# File 'lib/rack_session_access/capybara.rb', line 13

def get_rack_session
  visit ::RackSessionAccess.path + '.raw'
  has_content?("Raw rack session data")
  raw_data = find(:xpath, '//body/pre').text
  ::RackSessionAccess.decode(raw_data)
end

#get_rack_session_key(key) ⇒ Object



20
21
22
# File 'lib/rack_session_access/capybara.rb', line 20

def get_rack_session_key(key)
  get_rack_session.fetch(key)
end

#set_rack_session(hash) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/rack_session_access/capybara.rb', line 3

def set_rack_session(hash)
  data = ::RackSessionAccess.encode(hash)

  visit ::RackSessionAccess.edit_path
  has_content?("Update rack session")
  fill_in "data", :with => data
  click_button "Update"
  has_content?("Rack session data")
end