Created
November 6, 2015 13:51
-
-
Save lemig/3277a7bf17ccec81e105 to your computer and use it in GitHub Desktop.
Example of feature spec for search
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
RSpec.feature "View offers", :type => :feature do | |
let(:ludmilla) { create :customer, email: "ludmilla@schleiper.com", retailer: schleiper } | |
scenario "Basic search" do | |
sync do | |
create(:offer, name: "foo", :public => true) | |
create(:offer, name: "bar", :public => true) | |
end | |
login_as(ludmilla, :scope => :user) | |
visit offers_path(locale: "en") | |
expect(page).to have_http_status(200) | |
expect(page).to have_content '2 offers' | |
expect(page).to have_content 'foo' | |
expect(page).to have_content 'bar' | |
fill_in "Search query", with: "foo" | |
click_button "Filter results" | |
expect(page).to have_content '1 offer' | |
expect(page).to have_content 'foo' | |
expect(page).not_to have_content 'bar' | |
logout(:user) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment