From e18d8a481acffe5447a8f533b125ba5de5e197d2 Mon Sep 17 00:00:00 2001 From: tcocca Date: Tue, 29 Jun 2010 22:13:41 -0400 Subject: [PATCH] Improved acts_as_followable test coverage (cherry picking from commit fedaf57ee5c185b8fcc35b9de10f196097a659c5) --- test/acts_as_followable_test.rb | 70 ++++++++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/test/acts_as_followable_test.rb b/test/acts_as_followable_test.rb index 0dce673..9771d58 100644 --- a/test/acts_as_followable_test.rb +++ b/test/acts_as_followable_test.rb @@ -74,28 +74,54 @@ class ActsAsFollowableTest < Test::Unit::TestCase end context "blocking a follower" do - setup do - @jon.block(@sam) - end - - should "remove him from followers" do - assert_equal 0, @jon.followers_count - end - - should "add him to the blocked followers" do - assert_equal 1, @jon.blocked_followers_count - end - - should "not be able to follow again" do - assert_equal 0, @jon.followers_count - end - - should "not be present when listing followers" do - assert_equal [], @jon.followers - end - - should "be in the list of blocks" do - assert_equal [@sam], @jon.blocks + context "in my following list" do + setup do + @jon.block(@sam) + end + + should "remove him from followers" do + assert_equal 0, @jon.followers_count + end + + should "add him to the blocked followers" do + assert_equal 1, @jon.blocked_followers_count + end + + should "not be able to follow again" do + @jon.follow(@sam) + assert_equal 0, @jon.followers_count + end + + should "not be present when listing followers" do + assert_equal [], @jon.followers + end + + should "be in the list of blocks" do + assert_equal [@sam], @jon.blocks + end + end + + context "not in my following list" do + setup do + @sam.block(@jon) + end + + should "add him to the blocked followers" do + assert_equal 1, @sam.blocked_followers_count + end + + should "not be able to follow again" do + @sam.follow(@jon) + assert_equal 0, @sam.followers_count + end + + should "not be present when listing followers" do + assert_equal [], @sam.followers + end + + should "be in the list of blocks" do + assert_equal [@jon], @sam.blocks + end end end -- libgit2 0.21.0