Merge branch 'master' of github.com:diaspora/diaspora into import
This commit is contained in:
commit
f2bdc98b47
5 changed files with 14 additions and 29 deletions
4
Gemfile
4
Gemfile
|
|
@ -47,8 +47,8 @@ end
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara', '~> 0.3.9'
|
gem 'capybara', '~> 0.3.9'
|
||||||
gem 'cucumber-rails', '0.3.2'
|
gem 'cucumber-rails', '0.3.2'
|
||||||
gem 'rspec', '>= 2.0.0.beta.17'
|
gem 'rspec', '>= 2.0.0'
|
||||||
gem 'rspec-rails', '2.0.0.beta.17'
|
gem 'rspec-rails', '>= 2.0.0'
|
||||||
gem 'mocha'
|
gem 'mocha'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
|
|
|
||||||
21
Gemfile.lock
21
Gemfile.lock
|
|
@ -122,7 +122,6 @@ GEM
|
||||||
selenium-webdriver (>= 0.0.3)
|
selenium-webdriver (>= 0.0.3)
|
||||||
childprocess (0.0.7)
|
childprocess (0.0.7)
|
||||||
ffi (~> 0.6.3)
|
ffi (~> 0.6.3)
|
||||||
columnize (0.3.1)
|
|
||||||
crack (0.1.8)
|
crack (0.1.8)
|
||||||
cucumber (0.9.2)
|
cucumber (0.9.2)
|
||||||
builder (~> 2.1.2)
|
builder (~> 2.1.2)
|
||||||
|
|
@ -163,7 +162,6 @@ GEM
|
||||||
i18n (0.4.1)
|
i18n (0.4.1)
|
||||||
json (1.4.6)
|
json (1.4.6)
|
||||||
json_pure (1.4.6)
|
json_pure (1.4.6)
|
||||||
linecache (0.43)
|
|
||||||
mail (2.2.7)
|
mail (2.2.7)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
mime-types
|
mime-types
|
||||||
|
|
@ -223,14 +221,8 @@ GEM
|
||||||
rspec-mocks (2.0.0)
|
rspec-mocks (2.0.0)
|
||||||
rspec-core (= 2.0.0)
|
rspec-core (= 2.0.0)
|
||||||
rspec-expectations (= 2.0.0)
|
rspec-expectations (= 2.0.0)
|
||||||
rspec-rails (2.0.0.beta.17)
|
rspec-rails (2.0.0)
|
||||||
rspec (>= 2.0.0.beta.14)
|
rspec (= 2.0.0)
|
||||||
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)
|
|
||||||
rubyzip (0.9.4)
|
rubyzip (0.9.4)
|
||||||
selenium-webdriver (0.0.29)
|
selenium-webdriver (0.0.29)
|
||||||
childprocess (>= 0.0.7)
|
childprocess (>= 0.0.7)
|
||||||
|
|
@ -253,10 +245,6 @@ GEM
|
||||||
webmock (1.4.0)
|
webmock (1.4.0)
|
||||||
addressable (>= 2.2.2)
|
addressable (>= 2.2.2)
|
||||||
crack (>= 0.1.7)
|
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)
|
will_paginate (3.0.pre2)
|
||||||
xml-simple (1.0.12)
|
xml-simple (1.0.12)
|
||||||
|
|
||||||
|
|
@ -290,9 +278,8 @@ DEPENDENCIES
|
||||||
rails (= 3.0.0)
|
rails (= 3.0.0)
|
||||||
redfinger!
|
redfinger!
|
||||||
roxml!
|
roxml!
|
||||||
rspec (>= 2.0.0.beta.17)
|
rspec (>= 2.0.0)
|
||||||
rspec-rails (= 2.0.0.beta.17)
|
rspec-rails (>= 2.0.0)
|
||||||
ruby-debug
|
|
||||||
sprinkle!
|
sprinkle!
|
||||||
thin
|
thin
|
||||||
webmock
|
webmock
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ class PeopleController < ApplicationController
|
||||||
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
|
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
|
||||||
@aspect = :all
|
@aspect = :all
|
||||||
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
|
@people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC'
|
||||||
|
|
||||||
respond_with @people
|
respond_with @people
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,19 +35,17 @@ class Person
|
||||||
|
|
||||||
def self.search(query)
|
def self.search(query)
|
||||||
return Person.all if query.to_s.empty?
|
return Person.all if query.to_s.empty?
|
||||||
qTokens = query.to_s.strip.split(" ")
|
query_tokens = query.to_s.strip.split(" ")
|
||||||
fullQueryText = Regexp.escape( query.to_s.strip )
|
full_query_text = Regexp.escape( query.to_s.strip )
|
||||||
|
|
||||||
p = []
|
p = []
|
||||||
|
|
||||||
qTokens.each {
|
query_tokens.each do |token|
|
||||||
|token|
|
|
||||||
|
|
||||||
q = Regexp.escape( token.to_s.strip )
|
q = Regexp.escape( token.to_s.strip )
|
||||||
p = Person.all('profile.first_name' => /^#{q}/i) \
|
p = Person.all('profile.first_name' => /^#{q}/i) \
|
||||||
| Person.all('profile.last_name' => /^#{q}/i) \
|
| Person.all('profile.last_name' => /^#{q}/i) \
|
||||||
| p
|
| p
|
||||||
|
end
|
||||||
}
|
|
||||||
|
|
||||||
return p
|
return p
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@ describe PeopleController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "index should yield search results for substring of person name" do
|
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"
|
get :index, :q => "Eu"
|
||||||
|
assigns[:people].should include eugene
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should go to the current_user show page' do
|
it 'should go to the current_user show page' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue