43 lines
1.2 KiB
Ruby
43 lines
1.2 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe Search do
|
|
|
|
before(:each) do
|
|
end
|
|
|
|
|
|
def create_peachy_data
|
|
@user = FactoryGirl.create(:user, first_name: "Peach", last_name: "Pit", email: "user@example.com", musician: true, city: "Apex", state: "NC", country:"US")
|
|
@fan = FactoryGirl.create(:user, first_name: "Peach Peach", last_name: "Pit", email: "fan@example.com", musician: false, city: "Apex", state: "NC", country:"US")
|
|
@band = FactoryGirl.create(:band, name: "Peach pit", website: "www.bands.com", biography: "zomg we rock", city: "Apex", state: "NC", country:"US")
|
|
end
|
|
|
|
def assert_peachy_data
|
|
search = Search.musician_search('peach')
|
|
search.results.length.should == 1
|
|
obj = search.results[0]
|
|
obj.should be_a_kind_of User
|
|
obj.id.should == @user.id
|
|
|
|
search = Search.fan_search('peach')
|
|
search.results.length.should == 1
|
|
obj = search.results[0]
|
|
obj.should be_a_kind_of User
|
|
obj.id.should == @fan.id
|
|
|
|
search = Search.band_search('peach')
|
|
search.results.length.should == 1
|
|
obj = search.results[0]
|
|
obj.should be_a_kind_of Band
|
|
obj.id.should == @band.id
|
|
|
|
end
|
|
|
|
it "search for band & musician " do
|
|
create_peachy_data
|
|
|
|
assert_peachy_data
|
|
end
|
|
|
|
end
|