vrfs988: replaced global search with text-type search test

This commit is contained in:
Jonathan Kolyer 2014-01-12 03:40:32 -06:00
parent e0d8dd286a
commit 5bc7ceaba3
2 changed files with 3 additions and 13 deletions

View File

@ -59,7 +59,7 @@ describe "Musician Search API", :type => :api do
it "gets no musicians for unused instruments" do
get_query({:instrument => 'tuba'})
good_response
expect(json.count).to be 0
expect(json.count).to eq(0)
end
end

View File

@ -16,7 +16,7 @@ describe "Search API", :type => :api do
it "empty search" do
get '/api/search.json'
last_response.status.should == 200
JSON.parse(last_response.body).should eql(JSON.parse('{}'))
JSON.parse(last_response.body).should eql({'search_type'=>nil})
end
it "simple search" do
@ -25,25 +25,15 @@ describe "Search API", :type => :api do
@band = Band.save(nil, "Peach pit", "www.bands.com", "zomg we rock", "Apex", "NC", "US", ["hip hop"], user.id, nil, nil)
@band2 = Band.save(nil, "Peach", "www.bands2.com", "zomg we rock", "Apex", "NC", "US", ["hip hop"], user.id, nil, nil)
get '/api/search.json?query=peach'
get '/api/search.json?query=peach&search_text_type=bands'
last_response.status.should == 200
response = JSON.parse(last_response.body)
response["musicians"].length.should == 1
musician = response["musicians"][0]
musician["id"].should == @musician.id
response["fans"].length.should == 1
fan = response["fans"][0]
fan["id"].should == @fan.id
response["bands"].length.should == 2
bands = response["bands"]
bands = [bands[0]["id"], bands[1]["id"]]
bands.should include(@band.id)
bands.should include(@band2.id)
response["recordings"].should == nil
end
end
end