Merge remote branch 'yithian/1049-allow-plaintext-tags'

This commit is contained in:
Raphael Sofaer 2011-06-25 11:23:55 -07:00
commit b3556870d3
2 changed files with 10 additions and 0 deletions

View file

@ -20,6 +20,7 @@ class ProfilesController < ApplicationController
def update def update
# upload and set new profile photo # upload and set new profile photo
params[:profile] ||= {} params[:profile] ||= {}
params[:tags] << params[:profile][:tag_string] unless params[:profile][:tag_string].nil?
params[:profile][:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : "" params[:profile][:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : ""
params[:profile][:searchable] ||= false params[:profile][:searchable] ||= false
params[:profile][:photo] = Photo.where(:author_id => current_user.person.id, params[:profile][:photo] = Photo.where(:author_id => current_user.person.id,

View file

@ -49,6 +49,15 @@ describe ProfilesController do
put :update, params put :update, params
@user.person(true).profile.tag_list.to_set.should == ['apples', 'oranges'].to_set @user.person(true).profile.tag_list.to_set.should == ['apples', 'oranges'].to_set
end end
it 'sets plaintext tags' do
params = { :id => @user.person.id,
:tags => ',#apples,#oranges,',
:profile => {:tag_string => '#pears'} }
put :update, params
@user.person(true).profile.tag_list.to_set.should == ['apples', 'oranges', 'pears'].to_set
end
context 'with a profile photo set' do context 'with a profile photo set' do
before do before do