diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 8128c03d2..c5a679393 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -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 diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb index fcce6b312..b08a8602d 100644 --- a/spec/controllers/tags_controller_spec.rb +++ b/spec/controllers/tags_controller_spec.rb @@ -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