Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove ability to block oneself #23

Open
wants to merge 3 commits into from

2 participants

@ryandrake08

Hi,

Great gem, saved me a lot of code! I've forked and made two bug fixes and one improvement suggestion. Please review, and feel free to pull one or more of them:

  1. Latest factory_girl version is not compatible with ruby 1.8, so I locked the gem to a version that works with 1.8 and 1.9.

  2. Latest shoulda has deprecated & removed should_change, which your tests use. Locked the gem to an older version that still has this method.

  3. Since an object cannot follow oneself, it makes no sense to be able to block oneself. I removed the ability and added a test to verify a followable cannot block oneself.

Regards, Ryan

@rtdp

Is this not being maintained anymore ?

From above commits, this fix is imp for tests to run now - ryandrake08@9b883fd

Please consider getting it in. thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 10, 2012
  1. @ryandrake08
  2. @ryandrake08

    Lock shoulda to version 2.11.3, because acts_as_follower uses should_…

    ryandrake08 authored
    …change, which has been removed from recent versions of shoulda
  3. @ryandrake08

    Removed the ability for a followable to block oneself, an act that do…

    ryandrake08 authored
    …esn't make sense given that an object cannot follow oneself
This page is out of date. Refresh to see the latest.
View
4 acts_as_follower.gemspec
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.add_development_dependency "sqlite3"
- s.add_development_dependency "shoulda"
- s.add_development_dependency "factory_girl"
+ s.add_development_dependency "shoulda", "~>2.11.3"
+ s.add_development_dependency "factory_girl", "~>2.6.0"
s.add_development_dependency "rails", "~>3.0.10"
end
View
2  lib/acts_as_follower/followable.rb
@@ -89,7 +89,7 @@ def get_follow_for(follower)
private
def block_future_follow(follower)
- follows.create(:followable => self, :follower => follower, :blocked => true)
+ follows.create(:followable => self, :follower => follower, :blocked => true) unless follower == self
end
def block_existing_follow(follower)
View
10 test/acts_as_followable_test.rb
@@ -111,6 +111,16 @@ class ActsAsFollowableTest < ActiveSupport::TestCase
end
end
+ context "blocking yourself" do
+ setup do
+ @jon.block(@jon)
+ end
+
+ should "not add self to the blocked followers" do
+ assert_equal 0, @jon.blocked_followers_count
+ end
+ end
+
context "blocking a follower" do
context "in my following list" do
setup do
Something went wrong with that request. Please try again.