できる!Rails
Usefull Helper methods for Ruby on Rails
Rails version support
Rails 5.1 は ~> 0.1.0
Installation
Add this line to your application's Gemfile:
gem 'dekiru'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dekiru
Capybara Helpers
以下の設定をすると Capybara 用のヘルパーメソッドが使えるようになる。
require 'dekiru/capybara/helpers'
RSpec.configure do |config|
config.include Dekiru::Capybara::Helpers, type: :feature
end
examples
# Ajax処理の終了待ち
click_link 'Ajax link!'
wait_for_ajax
expect(page).to have_content 'created element!'
# Bootstrap3 のモーダルの出現終了待ち(待たないとモーダル内のノードのクリックに失敗することがある)
wait_for_event('shown.bs.modal') do
click_link 'Open bootstrap3 modal'
end
click_on 'Button in modal'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request