Class: Capybara::RackTest::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/roundabout/monkey/capybara.rb

Instance Method Summary collapse

Instance Method Details

#follow_with_recording(method, path, attributes = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/roundabout/monkey/capybara.rb', line 4

def follow_with_recording(method, path, attributes = {})
  return if path.gsub(/^#{request_path}/, '').start_with?('#')
  begin
    Roundabout.record_transition Roundabout.normalize_url(URI.parse(driver.current_url).path), Roundabout.normalize_url(path, method), method, :link
  rescue => e
    p e
  end

  follow_without_recording method, path, attributes
end

#submit_with_recording(method, path, attributes) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/roundabout/monkey/capybara.rb', line 16

def submit_with_recording(method, path, attributes)
  begin
    p = (path.nil? || path.empty?) ? request_path : path
    m = attributes['_method'] || method
    Roundabout.record_transition Roundabout.normalize_url(URI.parse(driver.current_url).path), Roundabout.normalize_url(p, m), m, :form
  rescue => e
    p e
  end

  submit_without_recording method, path, attributes
end