Skip to content

Instantly share code, notes, and snippets.

@gohuygo
Created November 5, 2012 19:09
Show Gist options
  • Select an option

  • Save gohuygo/4019657 to your computer and use it in GitHub Desktop.

Select an option

Save gohuygo/4019657 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe 'CheckPrice', type: :request, js: true do
it "should create a new CheckPrice record when user clicks Check Price on topic page" do
city = create :city, name: "Bilboa", country: create(:country, name: "USA")
partner_restaurant = create :partner_restaurant
restaurant = create :restaurant, name: 'McDonalds', city: city, contact_phone: "123-123-1234"
matched_restaurant = create :matched_restaurant, restaurant: restaurant, partner_restaurant: partner_restaurant
visit '/mcdonalds-bilboa-restaurant' #this link does not have the check prices button
sleep 2
click_button "Check Prices"
response.should change(CheckPrice.count).by(1)
end
end
factory :restaurant do
name { Faker::Name.first_name }
city
end
factory :matched_restaurant do
partner_restaurant
restaurant
end
factory :partner_restaurant do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment