Created
June 20, 2012 06:51
-
-
Save jugyo/2958495 to your computer and use it in GitHub Desktop.
capybara helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage | |
# ----- | |
# | |
# spec_helper.rb | |
# | |
# RSpec.configure do |config| | |
# ... | |
# config.include CapybaraHelper, :type => :request | |
# ... | |
# end | |
# | |
# xxx_spec.rb | |
# | |
# it 'xxxxx' do | |
# ... | |
# fill 'Name' => 'foo', | |
# 'EMail' => '[email protected]' | |
# click 'Update' | |
# ... | |
# end | |
# | |
module CapybaraHelper | |
def fill(hash) | |
hash.each do |k, v| | |
fill_in k, with: v | |
end | |
end | |
def click(*args) | |
click_on(*args) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment