Skip to content

Instantly share code, notes, and snippets.

@matisnape
Last active September 7, 2015 13:29
Show Gist options
  • Save matisnape/7287dcc21068b58f4a70 to your computer and use it in GitHub Desktop.
Save matisnape/7287dcc21068b58f4a70 to your computer and use it in GitHub Desktop.
require 'rails_helper'
feature "Business Search", js: true do
let(:user) { create :user }
let!(:business) { create :business, name: "Some Business" }
let!(:business2) { create :business, name: "The other Business" }
let(:businesses_page) { BusinessesPage.new }
let(:app) { App.new }
let(:search_field) { businesses_page.business_search }
let(:biz_container) { businesses_page.main.root_element }
context "nonregistered user" do
before do
businesses_page.load
end
it "should find the businesses you're looking for" do
search_field.set 'Business'
page.execute_script("$('form').submit()")
expect(biz_container).to have_content business.name
expect(biz_container).to have_content business2.name
end
it "shouldn't find the business you're not looking for" do
search_field.set 'Some'
page.execute_script("$('form').submit()")
expect(biz_container).to have_content business.name
expect(biz_container).to_not have_content business2.name
end
end
context "signed in user" do
before do
app.sign_in user
biz_page.load
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment