Commit e18d8a481acffe5447a8f533b125ba5de5e197d2
1 parent
899cf25d
Exists in
master
and in
3 other branches
Improved acts_as_followable test coverage (cherry picking from commit fedaf57ee5…
…c185b8fcc35b9de10f196097a659c5)
Showing
1 changed file
with
48 additions
and
22 deletions
Show diff stats
test/acts_as_followable_test.rb
... | ... | @@ -74,28 +74,54 @@ class ActsAsFollowableTest < Test::Unit::TestCase |
74 | 74 | end |
75 | 75 | |
76 | 76 | context "blocking a follower" do |
77 | - setup do | |
78 | - @jon.block(@sam) | |
79 | - end | |
80 | - | |
81 | - should "remove him from followers" do | |
82 | - assert_equal 0, @jon.followers_count | |
83 | - end | |
84 | - | |
85 | - should "add him to the blocked followers" do | |
86 | - assert_equal 1, @jon.blocked_followers_count | |
87 | - end | |
88 | - | |
89 | - should "not be able to follow again" do | |
90 | - assert_equal 0, @jon.followers_count | |
91 | - end | |
92 | - | |
93 | - should "not be present when listing followers" do | |
94 | - assert_equal [], @jon.followers | |
95 | - end | |
96 | - | |
97 | - should "be in the list of blocks" do | |
98 | - assert_equal [@sam], @jon.blocks | |
77 | + context "in my following list" do | |
78 | + setup do | |
79 | + @jon.block(@sam) | |
80 | + end | |
81 | + | |
82 | + should "remove him from followers" do | |
83 | + assert_equal 0, @jon.followers_count | |
84 | + end | |
85 | + | |
86 | + should "add him to the blocked followers" do | |
87 | + assert_equal 1, @jon.blocked_followers_count | |
88 | + end | |
89 | + | |
90 | + should "not be able to follow again" do | |
91 | + @jon.follow(@sam) | |
92 | + assert_equal 0, @jon.followers_count | |
93 | + end | |
94 | + | |
95 | + should "not be present when listing followers" do | |
96 | + assert_equal [], @jon.followers | |
97 | + end | |
98 | + | |
99 | + should "be in the list of blocks" do | |
100 | + assert_equal [@sam], @jon.blocks | |
101 | + end | |
102 | + end | |
103 | + | |
104 | + context "not in my following list" do | |
105 | + setup do | |
106 | + @sam.block(@jon) | |
107 | + end | |
108 | + | |
109 | + should "add him to the blocked followers" do | |
110 | + assert_equal 1, @sam.blocked_followers_count | |
111 | + end | |
112 | + | |
113 | + should "not be able to follow again" do | |
114 | + @sam.follow(@jon) | |
115 | + assert_equal 0, @sam.followers_count | |
116 | + end | |
117 | + | |
118 | + should "not be present when listing followers" do | |
119 | + assert_equal [], @sam.followers | |
120 | + end | |
121 | + | |
122 | + should "be in the list of blocks" do | |
123 | + assert_equal [@jon], @sam.blocks | |
124 | + end | |
99 | 125 | end |
100 | 126 | end |
101 | 127 | ... | ... |