tags should be case insensitive

This commit is contained in:
Diaspora Europe 2012-02-08 18:36:58 +01:00 committed by Maxwell Salzberg
parent 56d9da6e04
commit 55cb328fe2
2 changed files with 3 additions and 3 deletions

View file

@ -41,7 +41,7 @@ class TagsController < ApplicationController
def tag_followed?
if @tag_followed.nil?
@tag_followed = TagFollowing.joins(:tag).where(:tags => {:name => params[:name]}, :user_id => current_user.id).exists?
@tag_followed = TagFollowing.joins(:tag).where(:tags => {:name => params[:name].downcase}, :user_id => current_user.id).exists?
end
@tag_followed
end

View file

@ -76,10 +76,10 @@ describe TagsController do
sign_in bob
@tag = ActsAsTaggableOn::Tag.create!(:name => "partytimeexcellent")
@controller.stub(:current_user).and_return(bob)
@controller.stub(:params).and_return({:name => "partytimeexcellent"})
@controller.stub(:params).and_return({:name => "PARTYTIMEexcellent"})
end
it 'returns true if the following already exists' do
it 'returns true if the following already exists and should be case insensitive' do
TagFollowing.create!(:tag => @tag, :user => bob )
@controller.tag_followed?.should be_true
end