Module: Hephaestus::Webmocks::BrowserWebmock

Defined in:
lib/hephaestus/support/hephaestus/webmocks/browser_webmock.rb

Instance Method Summary collapse

Instance Method Details

#browser_mock(status: 200) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hephaestus/support/hephaestus/webmocks/browser_webmock.rb', line 7

def browser_mock(status: 200)
  browser_mock = Object.new
  Ferrum::Browser.stubs(:new).returns(browser_mock)
  browser_mock.stubs(:go_to)
  browser_mock.stubs(:quit)
  response_mock = Ferrum::Network::Response.new("", "")
  response_mock.stubs(:wait_for_idle).returns(true)
  network_response_mock = Object.new
  browser_mock.stubs(:network).returns(network_response_mock)
  network_response_mock.stubs(:response).returns(response_mock)
  response_mock.stubs(:status).returns(status)
end