From 7d3a6a061c97b604a08350aff3c7d8f9b9939ca5 Mon Sep 17 00:00:00 2001 From: Steven Fuchs <stwf@yahoo.com> Date: Thu, 16 Feb 2012 07:03:20 -0500 Subject: [PATCH] add spec to ake sure background query is only set when a full diaspora id is given. --- app/controllers/people_controller.rb | 2 +- spec/controllers/people_controller_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 840ce0bc3a..4a0c511fc0 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -35,7 +35,7 @@ class PeopleController < ApplicationController if diaspora_id?(search_query) @people = Person.where(:diaspora_handle => search_query.downcase) Webfinger.in_background(search_query) if @people.empty? - @background_query = search_query + @background_query = search_query.downcase end @people = @people.paginate(:page => params[:page], :per_page => 15) @hashes = hashes_for_people(@people, @aspects) diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index a03b8e86a9..d195a14423 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -52,6 +52,11 @@ describe PeopleController do get :index, :q => "Eugene@Example.ORG" assigns[:people][0].id.should == @unsearchable_eugene.id end + + it 'sets the background query task' do + get :index, :q => "Eugene@Example.ORG" + assigns[:background_query].should == "eugene@example.org" + end end context 'query is a tag' do @@ -77,6 +82,11 @@ describe PeopleController do assigns[:hashes].should_not be_nil 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 eugene2 = Factory(:person, :profile => Factory.build(:profile, :first_name => "Eugene", -- GitLab