Github
Alternative: Bitbucket, git (private server)
None
| # Borrowed from https://github.com/y310/rspec-retry/blob/master/lib/rspec/retry.rb | |
| # Drop this script into spec/support | |
| # To test snippet just set timeout to 1 | |
| RSpec.configure do |config| | |
| Capybara.javascript_driver = :poltergeist | |
| Capybara.register_driver(:poltergeist) do |app| | |
| Capybara::Poltergeist::Driver.new app, |
| # Navigating | |
| visit '/projects' | |
| visit post_comments_path(@post) | |
| # Clicking links and buttons | |
| click_link 'id_of_link' | |
| click_link 'Link Text' | |
| click_button 'Save' |
| # updated from the original @ http://cheat.errtheblog.com/s/rspec_shoulda | |
| # just a subset -- models -- is included here. I'll update this, and create cheat sheets for others, as I go along. | |
| # I marked the ones I added with NEW and also added the links to the corresponding code, as I think it's useful. | |
| # Any comments/corrections are welcome! | |
| # ================= Data and Associations ======================= | |
| # https://github.com/thoughtbot/shoulda-matchers/tree/master/lib/shoulda/matchers/active_record | |
| it { is_expected.not_to have_db_column(:admin).of_type(:boolean) } | |
| it { is_expected.to have_db_column(:salary). |