Skip to content

Instantly share code, notes, and snippets.

@ma2gedev
Created July 18, 2013 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ma2gedev/6030356 to your computer and use it in GitHub Desktop.
Save ma2gedev/6030356 to your computer and use it in GitHub Desktop.
capybara
require 'capybara/rspec'
require 'capybara/mechanize'
Capybara.configure do |c|
c.app = 'avoid "mechanize requires a rack application" error'
c.default_driver = :mechanize
c.app_host = 'http://www.bing.com'
# if you use proxy set the following
# Capybara.current_session.driver.browser.agent.set_proxy('proxy.host', 'proxy.port')
end
RSpec.configure do |c|
c.include Capybara::DSL
end
require 'spec_helper'
describe 'top page' do
before do
visit '/'
end
it 'shows gundam' do
find_field('sb_form_q').set('ガンダム')
click_button('sb_form_go')
expect(page).to have_content 'gundam'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment