Commit b96b63ef2704064fdc395fe4d17c4ae92a5ed4e5
1 parent
3c46fc9b
Exists in
master
and in
3 other branches
Gave test file it's appropriate name.
Showing
2 changed files
with
27 additions
and
27 deletions
Show diff stats
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +require File.dirname(__FILE__) + '/test_helper' | ||
2 | + | ||
3 | +class ActsAsFollowableTest < Test::Unit::TestCase | ||
4 | + fixtures :users, :follows | ||
5 | + | ||
6 | + def test_instance_methods_should_be_defined | ||
7 | + assert users(:sam).respond_to?(:followers_count) | ||
8 | + assert users(:sam).respond_to?(:followers) | ||
9 | + assert users(:sam).respond_to?(:followed_by?) | ||
10 | + end | ||
11 | + | ||
12 | + def test_followers_should_return_number_of_followers | ||
13 | + assert_equal 0, users(:sam).followers_count | ||
14 | + assert_equal 1, users(:jon).followers_count | ||
15 | + end | ||
16 | + | ||
17 | + def test_followers_should_return_users | ||
18 | + assert_equal [], users(:sam).followers | ||
19 | + assert_equal [users(:sam)], users(:jon).followers | ||
20 | + end | ||
21 | + | ||
22 | + def test_followed_by_should_return_follower_status | ||
23 | + assert_equal true, users(:jon).followed_by?(users(:sam)) | ||
24 | + assert_equal false, users(:sam).followed_by?(users(:jon)) | ||
25 | + end | ||
26 | + | ||
27 | +end |
test/acts_as_follower_test.rb
@@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
1 | -require File.dirname(__FILE__) + '/test_helper' | ||
2 | - | ||
3 | -class ActsAsFollowerTest < Test::Unit::TestCase | ||
4 | - fixtures :users, :follows | ||
5 | - | ||
6 | - def test_instance_methods_should_be_defined | ||
7 | - assert users(:sam).respond_to?(:followers_count) | ||
8 | - assert users(:sam).respond_to?(:followers) | ||
9 | - assert users(:sam).respond_to?(:followed_by?) | ||
10 | - end | ||
11 | - | ||
12 | - def test_followers_should_return_number_of_followers | ||
13 | - assert_equal 0, users(:sam).followers_count | ||
14 | - assert_equal 1, users(:jon).followers_count | ||
15 | - end | ||
16 | - | ||
17 | - def test_followers_should_return_users | ||
18 | - assert_equal [], users(:sam).followers | ||
19 | - assert_equal [users(:sam)], users(:jon).followers | ||
20 | - end | ||
21 | - | ||
22 | - def test_followed_by_should_return_follower_status | ||
23 | - assert_equal true, users(:jon).followed_by?(users(:sam)) | ||
24 | - assert_equal false, users(:sam).followed_by?(users(:jon)) | ||
25 | - end | ||
26 | - | ||
27 | -end |