Skip to content

Instantly share code, notes, and snippets.

@wkrsz
Forked from dsokolowski/README.md
Created May 3, 2012 13:43
Show Gist options
  • Save wkrsz/2585741 to your computer and use it in GitHub Desktop.
Save wkrsz/2585741 to your computer and use it in GitHub Desktop.
Integration capybara with minitest

##Integration capybara with minitest

Requirements:

  • ruby 1.9
  • gem capybara

All you have to do is to require file test_helper.rb at the beginning of your test files.

require File.expand_path(File.dirname(__FILE__))+ "/test_helper.rb"
describe 'Gmail' do
it 'shows error message when login and password are incorrect' do
visit 'http://gmail.com'
within('form#gaia_loginform') do
fill_in('Email', :with => 'qwerty@example.com')
fill_in('Passwd', :with => 'qwerty12345')
click_button('Sign in')
end
assert has_css?('span#errormsg_0_Passwd', :text => 'The username or password you entered is incorrect.')
end
end
require 'minitest/autorun'
require 'capybara/dsl'
MiniTest::Unit::TestCase.send(:include,Capybara::DSL)
Capybara.current_driver = :selenium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment