Conformity
Created mainly for use with the contact-congress project. Uses capybara with the addition of a Form class and a #field method that lets you fill out a form with different inputs each time.
Installation
Add this line to your application's Gemfile:
gem 'conformity'
And then execute:
$ bundle
Or install it yourself as:
$ gem install conformity
Usage
include Conformity
form = Form.new('http://www.google.com/') do
visit '/'
fill_in 'q', with: field(:query)
click_on 'Google Search'
# optional conditions to verify form submission success
has_status_code? 200
has_content? 'Search Tools'
end
form.field_names
# => [:query]
# returns Capybara::Session, can call #html etc. on it
form.fill_with(query: 'news') # perform google search for 'news'
form.fill_with(query: 'what is the third planet from the sun')
form.fill_with(query: 'alternatives to gmail')
# check if the last form submission succeeded (if success conditions were set)
form.success?
Contributing
- Fork it ( http://github.com/
/conformity/fork ) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request