Capybara::BootstrapDatepicker
Helper for triggering date input for bootstrap-datepicker javascript library
All this gem does is something very simple : allow you to trigger Bootstrap datepicker to select the date you want.
Installation
Add this line to your application's Gemfile:
gem 'capybara-bootstrap-datepicker', group: :test
Or, add it into your test group
group :test do
gem 'capybara-bootstrap-datepicker'
...
end
And then execute:
$ bundle
Or install it yourself as:
$ gem install capybara-bootstrap-datepicker
The gem automatically hook itself into rspec helper using Rspec.configure.
Usage
Just use this method inside your capybara test:
select_date(2.weeks.ago, from: "Label of the date input")
Or even:
select_date(Date.tomorrow, from: "Label of the date input", format: "%d/%m/%Y")
select_date("2013-05-24", xpath: "//path_to//your_date_input", datepicker: :bootstrap)
Available options are:
- from: the label of your date input
- xpath: the path to your date input
- format: the format used to fill your date input
- datepicker: the way to fill your date input (:bootstrap = by clicking the popover using bootstrap-datepicker) ; by default it just fill the input date.
Contributing
- Fork it
- 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