Skip to content

Instantly share code, notes, and snippets.

@lemig
Created November 6, 2015 13:51
Show Gist options
  • Save lemig/3277a7bf17ccec81e105 to your computer and use it in GitHub Desktop.
Save lemig/3277a7bf17ccec81e105 to your computer and use it in GitHub Desktop.
Example of feature spec for search
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