Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change blocks => blocked_followers #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ To unblock is just as simple
book.unblock(user)

To get all blocked records
book.blocks # Returns an array of blocked follower records (only unblocked) (eg. type User or type Book)
book.blocked_followers # Returns an array of blocked follower records (only unblocked) (eg. type User or type Book)

If you only need the number of blocks use the count method provided
If you only need the number of blocked_followers use the count method provided
book.blocked_followers_count

Unblocking deletes all records of that follow, instead of just the :blocked attribute => false the follow is deleted. So, a user would need to try and follow the book again.
Expand Down
2 changes: 1 addition & 1 deletion lib/acts_as_follower/followable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def followers(options={})
followers_scope.to_a.collect{|f| f.follower}
end

def blocks(options={})
def blocked_followers(options={})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be retained and deprecated.

blocked_followers_scope = followers_scoped.blocked
blocked_followers_scope = apply_options_to_scope(blocked_followers_scope, options)
blocked_followers_scope.to_a.collect{|f| f.follower}
Expand Down
18 changes: 9 additions & 9 deletions test/acts_as_followable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ class ActsAsFollowableTest < ActiveSupport::TestCase
end
end

context "blocks" do
context "blocked_followers" do
setup do
@bob = FactoryGirl.create(:bob)
@jon.block(@sam)
@jon.block(@bob)
end

should "accept AR options" do
assert_equal 1, @jon.blocks(limit: 1).count
assert_equal 1, @jon.blocked_followers(limit: 1).count
end
end

Expand All @@ -134,8 +134,8 @@ class ActsAsFollowableTest < ActiveSupport::TestCase
assert_equal [], @jon.followers
end

should "be in the list of blocks" do
assert_equal [@sam], @jon.blocks
should "be in the list of blocked_followers" do
assert_equal [@sam], @jon.blocked_followers
end
end

Expand All @@ -157,8 +157,8 @@ class ActsAsFollowableTest < ActiveSupport::TestCase
assert_equal [], @sam.followers
end

should "be in the list of blocks" do
assert_equal [@jon], @sam.blocks
should "be in the list of blocked_followers" do
assert_equal [@jon], @sam.blocked_followers
end
end
end
Expand All @@ -175,7 +175,7 @@ class ActsAsFollowableTest < ActiveSupport::TestCase

should "remove him from the blocked followers" do
assert_equal 0, @jon.blocked_followers_count
assert_equal [], @jon.blocks
assert_equal [], @jon.blocked_followers
end
end

Expand All @@ -193,8 +193,8 @@ class ActsAsFollowableTest < ActiveSupport::TestCase
assert_equal 0, @jon.blocked_followers_count
end

should "not be in the blocks list" do
assert_equal [], @jon.blocks
should "not be in the blocked_followers list" do
assert_equal [], @jon.blocked_followers
end
end

Expand Down