add spec to ake sure background query is only set when a full diaspora id is given.
This commit is contained in:
parent
ac8cd8368e
commit
7d3a6a061c
2 changed files with 11 additions and 1 deletions
|
|
@ -35,7 +35,7 @@ class PeopleController < ApplicationController
|
||||||
if diaspora_id?(search_query)
|
if diaspora_id?(search_query)
|
||||||
@people = Person.where(:diaspora_handle => search_query.downcase)
|
@people = Person.where(:diaspora_handle => search_query.downcase)
|
||||||
Webfinger.in_background(search_query) if @people.empty?
|
Webfinger.in_background(search_query) if @people.empty?
|
||||||
@background_query = search_query
|
@background_query = search_query.downcase
|
||||||
end
|
end
|
||||||
@people = @people.paginate(:page => params[:page], :per_page => 15)
|
@people = @people.paginate(:page => params[:page], :per_page => 15)
|
||||||
@hashes = hashes_for_people(@people, @aspects)
|
@hashes = hashes_for_people(@people, @aspects)
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,11 @@ describe PeopleController do
|
||||||
get :index, :q => "Eugene@Example.ORG"
|
get :index, :q => "Eugene@Example.ORG"
|
||||||
assigns[:people][0].id.should == @unsearchable_eugene.id
|
assigns[:people][0].id.should == @unsearchable_eugene.id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'sets the background query task' do
|
||||||
|
get :index, :q => "Eugene@Example.ORG"
|
||||||
|
assigns[:background_query].should == "eugene@example.org"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'query is a tag' do
|
context 'query is a tag' do
|
||||||
|
|
@ -77,6 +82,11 @@ describe PeopleController do
|
||||||
assigns[:hashes].should_not be_nil
|
assigns[:hashes].should_not be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not set the background query task' do
|
||||||
|
get :index, :q => "Korth"
|
||||||
|
assigns[:background_query].should_not be_present
|
||||||
|
end
|
||||||
|
|
||||||
it "assigns people" do
|
it "assigns people" do
|
||||||
eugene2 = Factory(:person,
|
eugene2 = Factory(:person,
|
||||||
:profile => Factory.build(:profile, :first_name => "Eugene",
|
:profile => Factory.build(:profile, :first_name => "Eugene",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue