Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dei79/rspec-capybara-simple_form-rails
A small rspec extension to verify simple form elements with the help of capybara.
https://github.com/dei79/rspec-capybara-simple_form-rails
Last synced: about 1 month ago
JSON representation
A small rspec extension to verify simple form elements with the help of capybara.
- Host: GitHub
- URL: https://github.com/dei79/rspec-capybara-simple_form-rails
- Owner: dei79
- License: mit
- Created: 2013-12-30T12:06:30.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-30T18:10:59.000Z (about 11 years ago)
- Last Synced: 2023-03-24T14:13:53.775Z (almost 2 years ago)
- Language: Ruby
- Size: 113 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Rspec::Capybara::SimpleForm::Rails
A small rspec extension to verify simple form elements with the help of capybara.
[![Gem Version](https://badge.fury.io/rb/rspec-capybara-simple_form-rails.png)](http://badge.fury.io/rb/rspec-capybara-simple_form-rails)
## Installation
Add this line to your application's Gemfile:
gem 'rspec-capybara-simple_form-rails'
And then execute:
$ bundle
Add the following lines to your spec_helper.rb
# load capybara
require 'capybara/rspec'
require 'rspec/capybara/simple_form'## Usage
In a view spec just use the following matchers
have_input_field(model, attribute, options)
have_textarea_field(model, attribute, options)The following example illustrates a full example:
it "renders the form correct" do
# assign model
@app = assign(:app, build(:app))# render the view
render# do the checks
rendered.should have_input_field(@app, :name, :required => true)
rendered.should have_textarea_field(@app, :description, :required => true)
end## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request