This file contains 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 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