Created
November 11, 2016 14:23
-
-
Save jnicklas/fcfa5e480bf47adbcf7abf08577e59cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "My page" do | |
it "lists the item" do | |
item = create_item | |
within item_row(item) do | |
expect(page).to mention_item(item) | |
end | |
end | |
private | |
def item_row(item) | |
find(".test-item-#{item.id}") | |
end | |
def mention_item(item) | |
have_content(item.title) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.add_selector :item_row do | |
css { |item| ".test-item-#{item.id}" } | |
end | |
describe "My page" do | |
it "lists the item" do | |
item = create_item | |
within :item_row, item do | |
expect(page).to mention_item(item) | |
end | |
end | |
private | |
def mention_item(item) | |
have_content(item.title) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment