Created
November 5, 2012 19:09
-
-
Save gohuygo/4019657 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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