Skip to content

Instantly share code, notes, and snippets.

@jnicklas
Created November 14, 2012 12:40
Show Gist options
  • Save jnicklas/4071870 to your computer and use it in GitHub Desktop.
Save jnicklas/4071870 to your computer and use it in GitHub Desktop.

Revisions

  1. jnicklas created this gist Nov 14, 2012.
    4 changes: 4 additions & 0 deletions selector.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    Capybara.add_selector :record do
    xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
    match { |record| record.is_a?(ActiveRecord::Base) }
    end
    8 changes: 8 additions & 0 deletions use_it_like_this.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    post = Post.first

    find(post).click_link("Hello")

    within post do
    fill_in("What's going on here", :with => "Holy shit this works??")
    click_button("Yes")
    end