tags should be case insensitive
This commit is contained in:
parent
56d9da6e04
commit
55cb328fe2
2 changed files with 3 additions and 3 deletions
|
|
@ -41,7 +41,7 @@ class TagsController < ApplicationController
|
||||||
|
|
||||||
def tag_followed?
|
def tag_followed?
|
||||||
if @tag_followed.nil?
|
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
|
end
|
||||||
@tag_followed
|
@tag_followed
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,10 @@ describe TagsController do
|
||||||
sign_in bob
|
sign_in bob
|
||||||
@tag = ActsAsTaggableOn::Tag.create!(:name => "partytimeexcellent")
|
@tag = ActsAsTaggableOn::Tag.create!(:name => "partytimeexcellent")
|
||||||
@controller.stub(:current_user).and_return(bob)
|
@controller.stub(:current_user).and_return(bob)
|
||||||
@controller.stub(:params).and_return({:name => "partytimeexcellent"})
|
@controller.stub(:params).and_return({:name => "PARTYTIMEexcellent"})
|
||||||
end
|
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 )
|
TagFollowing.create!(:tag => @tag, :user => bob )
|
||||||
@controller.tag_followed?.should be_true
|
@controller.tag_followed?.should be_true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue