diff --git a/lib/acts_as_follower/followable.rb b/lib/acts_as_follower/followable.rb index 2c91272..1378e7a 100644 --- a/lib/acts_as_follower/followable.rb +++ b/lib/acts_as_follower/followable.rb @@ -87,6 +87,7 @@ def followed_by?(follower) end def block(follower) + return if follower == self get_follow_for(follower) ? block_existing_follow(follower) : block_future_follow(follower) end diff --git a/test/acts_as_followable_test.rb b/test/acts_as_followable_test.rb index b7416a7..e8d400b 100644 --- a/test/acts_as_followable_test.rb +++ b/test/acts_as_followable_test.rb @@ -112,6 +112,16 @@ class ActsAsFollowableTest < ActiveSupport::TestCase end context "blocking a follower" do + context "self blocking" do + setup do + @jon.block(@jon) + end + + should "not be able to block" do + assert_equal 0, @jon.blocked_followers_count + end + end + context "in my following list" do setup do @jon.block(@sam)