Fixed pending people_controller spec; cleaned up person.search(this is ruby :D ); fyi, calling should_receive stubs that method, hence this test confusion
This commit is contained in:
parent
cf6850b3f6
commit
e1dd0cf6be
4 changed files with 12 additions and 27 deletions
21
Gemfile.lock
21
Gemfile.lock
|
|
@ -122,7 +122,6 @@ GEM
|
|||
selenium-webdriver (>= 0.0.3)
|
||||
childprocess (0.0.7)
|
||||
ffi (~> 0.6.3)
|
||||
columnize (0.3.1)
|
||||
crack (0.1.8)
|
||||
cucumber (0.9.2)
|
||||
builder (~> 2.1.2)
|
||||
|
|
@ -163,7 +162,6 @@ GEM
|
|||
i18n (0.4.1)
|
||||
json (1.4.6)
|
||||
json_pure (1.4.6)
|
||||
linecache (0.43)
|
||||
mail (2.2.7)
|
||||
activesupport (>= 2.3.6)
|
||||
mime-types
|
||||
|
|
@ -223,14 +221,8 @@ GEM
|
|||
rspec-mocks (2.0.0)
|
||||
rspec-core (= 2.0.0)
|
||||
rspec-expectations (= 2.0.0)
|
||||
rspec-rails (2.0.0.beta.17)
|
||||
rspec (>= 2.0.0.beta.14)
|
||||
webrat (>= 0.7.0)
|
||||
ruby-debug (0.10.3)
|
||||
columnize (>= 0.1)
|
||||
ruby-debug-base (~> 0.10.3.0)
|
||||
ruby-debug-base (0.10.3)
|
||||
linecache (>= 0.3)
|
||||
rspec-rails (2.0.0)
|
||||
rspec (= 2.0.0)
|
||||
rubyzip (0.9.4)
|
||||
selenium-webdriver (0.0.29)
|
||||
childprocess (>= 0.0.7)
|
||||
|
|
@ -253,10 +245,6 @@ GEM
|
|||
webmock (1.3.5)
|
||||
addressable (>= 2.1.1)
|
||||
crack (>= 0.1.7)
|
||||
webrat (0.7.1)
|
||||
nokogiri (>= 1.2.0)
|
||||
rack (>= 1.0)
|
||||
rack-test (>= 0.5.3)
|
||||
will_paginate (3.0.pre2)
|
||||
xml-simple (1.0.12)
|
||||
|
||||
|
|
@ -290,9 +278,8 @@ DEPENDENCIES
|
|||
rails (= 3.0.0)
|
||||
redfinger!
|
||||
roxml!
|
||||
rspec (>= 2.0.0.beta.17)
|
||||
rspec-rails (= 2.0.0.beta.17)
|
||||
ruby-debug
|
||||
rspec (>= 2.0.0)
|
||||
rspec-rails (>= 2.0.0)
|
||||
sprinkle!
|
||||
thin
|
||||
webmock
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ class PeopleController < ApplicationController
|
|||
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
|
||||
@aspect = :all
|
||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
|
||||
|
||||
respond_with @people
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -35,19 +35,17 @@ class Person
|
|||
|
||||
def self.search(query)
|
||||
return Person.all if query.to_s.empty?
|
||||
qTokens = query.to_s.strip.split(" ")
|
||||
fullQueryText = Regexp.escape( query.to_s.strip )
|
||||
query_tokens = query.to_s.strip.split(" ")
|
||||
full_query_text = Regexp.escape( query.to_s.strip )
|
||||
|
||||
p = []
|
||||
|
||||
qTokens.each {
|
||||
|token|
|
||||
|
||||
query_tokens.each do |token|
|
||||
q = Regexp.escape( token.to_s.strip )
|
||||
p = Person.all('profile.first_name' => /^#{q}/i) \
|
||||
| Person.all('profile.last_name' => /^#{q}/i) \
|
||||
| p
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
return p
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@ describe PeopleController do
|
|||
end
|
||||
|
||||
it "index should yield search results for substring of person name" do
|
||||
pending "wait, what???"
|
||||
Person.should_receive(:search)
|
||||
|
||||
eugene = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
||||
get :index, :q => "Eu"
|
||||
assigns[:people].should include eugene
|
||||
end
|
||||
|
||||
it 'should go to the current_user show page' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue