Skip to content

Instantly share code, notes, and snippets.

View jwood's full-sized avatar

John Wood jwood

View GitHub Profile
after_filter -> { sleep(0.25) }
expect(page).to_not have_css(".some-class")
expect(page).to have_no_css(".some-class")
expect(page).to !have_css(".some-class")
expect(page).to have_field("#some-text-field", with: "Some value")
expect(page.find("#some-text-field").value).to eql("Some value")
@jwood
jwood / application.html.erb
Last active March 15, 2021 16:03
Disable animations
<!-- app/views/layouts/application.html.erb -->
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ... -->
<% if Rails.application.config.disable_animations %>
<%= stylesheet_link_tag('disable_animations') %>
<!-- Turn off animations in jQuery -->
<script>$.fx.off = true;</script>
@jwood
jwood / use_actions.rb
Last active August 29, 2015 14:17
Fix Flakey Feature Tests by Using Capybara's APIs Properly - 4
click_link("#foo")
expect(find(".message")).to have_text("Loaded successfully")
@jwood
jwood / use_matchers.rb
Last active August 29, 2015 14:17
Fix Flakey Feature Tests by Using Capybara's APIs Properly - 3
find("#foo").click
expect(find(".message")).to have_text("Loaded successfully")
@jwood
jwood / use_find.rb
Last active August 29, 2015 14:17
Fix Flakey Feature Tests by Using Capybara's APIs Properly - 2
find("#foo").click
expect(find(".message").value).to eql("Loaded successfully")