Skip to content
Browse files

Use assert_true and assert_false assertions everywhere

  • Loading branch information...
1 parent 4fccc87 commit 8c13303ebdecb5359be782ff9c5ada3cf9cb566c @cmer committed
Showing with 33 additions and 45 deletions.
  1. +11 −23 test/follow_test.rb
  2. +12 −12 test/like_test.rb
  3. +10 −10 test/mention_test.rb
View
34 test/follow_test.rb
@@ -7,19 +7,19 @@ class FollowTest < Test::Unit::TestCase
end
should "be follower" do
- assert_equal true, @follower1.is_follower?
+ assert_true @follower1.is_follower?
end
should "be able to follow a Followable" do
assert @follower1.follow!(@followable1)
- assert_equal true, @follower1.follows?(@followable1)
- assert_equal false, @follower2.follows?(@followable1)
+ assert_true @follower1.follows?(@followable1)
+ assert_false @follower2.follows?(@followable1)
end
should "be able to unfollow a Followable" do
Follow.create :follower => @follower1, :followable => @followable1
assert @follower1.unfollow!(@followable1)
- assert_equal false, @follower1.follows?(@followable1)
+ assert_false @follower1.follows?(@followable1)
end
should "not be able to follow the same thing twice" do
@@ -62,13 +62,13 @@ class FollowTest < Test::Unit::TestCase
end
should "be followable" do
- assert_equal true, @followable1.is_followable?
+ assert_true @followable1.is_followable?
end
should "be able to determine who follows it" do
Follow.create :follower => @follower1, :followable => @followable1
- assert_equal true, @followable1.followed_by?(@follower1)
- assert_equal false, @followable1.followed_by?(@follower2)
+ assert_true @followable1.followed_by?(@follower1)
+ assert_false @followable1.followed_by?(@follower2)
end
should "expose a list of its followers" do
@@ -96,7 +96,7 @@ class FollowTest < Test::Unit::TestCase
should "delete its Follow records" do
@follower1.destroy
- assert_equal false, @followable1.followed_by?(@follower1)
+ assert_false @followable1.followed_by?(@follower1)
end
end
@@ -108,7 +108,7 @@ class FollowTest < Test::Unit::TestCase
should "delete its Follow records" do
@followable1.destroy
- assert_equal false, @follower1.follows?(@followable1)
+ assert_false @follower1.follows?(@followable1)
end
end
@@ -118,23 +118,11 @@ class FollowTest < Test::Unit::TestCase
end
should "not be follower" do
- assert_equal false, @foo.is_follower?
+ assert_false @foo.is_follower?
end
should "not be followable" do
- assert_equal false, @foo.is_followable?
- end
- end
-
- context "Single Table Inheritance" do
- setup do
- @follower = ImAFollower.create
- @followable_child = ImAFollowableChild.create
- end
-
- should "be able to follow a model inheriting from Followable" do
- assert @follower.follow!(@followable_child)
- assert_equal true, @follower.follows?(@followable_child)
+ assert_false @foo.is_followable?
end
end
View
24 test/like_test.rb
@@ -7,19 +7,19 @@ class LikeTest < Test::Unit::TestCase
end
should "be liker" do
- assert_equal true, @liker1.is_liker?
+ assert_true @liker1.is_liker?
end
should "be able to like a Likeable" do
assert @liker1.like!(@likeable1)
- assert_equal true, @liker1.likes?(@likeable1)
- assert_equal false, @liker2.likes?(@likeable1)
+ assert_true @liker1.likes?(@likeable1)
+ assert_false @liker2.likes?(@likeable1)
end
should "be able to unlike a Likeable" do
Like.create :liker => @liker1, :likeable => @likeable1
assert @liker1.unlike!(@likeable1)
- assert_equal false, @liker1.likes?(@likeable1)
+ assert_false @liker1.likes?(@likeable1)
end
should "not be able to like the same thing twice" do
@@ -62,13 +62,13 @@ class LikeTest < Test::Unit::TestCase
end
should "be likeable" do
- assert_equal true, @likeable1.is_likeable?
+ assert_true @likeable1.is_likeable?
end
should "be able to determine who likes it" do
Like.create :liker => @liker1, :likeable => @likeable1
- assert_equal true, @likeable1.liked_by?(@liker1)
- assert_equal false, @likeable1.liked_by?(@liker2)
+ assert_true @likeable1.liked_by?(@liker1)
+ assert_false @likeable1.liked_by?(@liker2)
end
should "expose a list of its likers" do
@@ -96,7 +96,7 @@ class LikeTest < Test::Unit::TestCase
should "delete its Like records" do
@liker1.destroy
- assert_equal false, @likeable1.liked_by?(@liker1)
+ assert_false @likeable1.liked_by?(@liker1)
end
end
@@ -108,7 +108,7 @@ class LikeTest < Test::Unit::TestCase
should "delete its Like records" do
@likeable1.destroy
- assert_equal false, @liker1.likes?(@likeable1)
+ assert_false @liker1.likes?(@likeable1)
end
end
@@ -118,11 +118,11 @@ class LikeTest < Test::Unit::TestCase
end
should "not be liker" do
- assert_equal false, @foo.is_liker?
+ assert_false @foo.is_liker?
end
should "not be likeable" do
- assert_equal false, @foo.is_likeable?
+ assert_false @foo.is_likeable?
end
end
@@ -134,7 +134,7 @@ class LikeTest < Test::Unit::TestCase
should "be able to like a model inheriting from a Likeable" do
assert @liker.like!(@likeable_child)
- assert_equal true, @liker.likes?(@likeable_child)
+ assert_true @liker.likes?(@likeable_child)
end
end
View
20 test/mention_test.rb
@@ -7,19 +7,19 @@ class MentionTest < Test::Unit::TestCase
end
should "be mentioner" do
- assert_equal true, @mentioner1.is_mentioner?
+ assert_true @mentioner1.is_mentioner?
end
should "be able to mention a Mentionable" do
assert @mentioner1.mention!(@mentionable1)
- assert_equal true, @mentioner1.mentions?(@mentionable1)
- assert_equal false, @mentioner2.mentions?(@mentionable1)
+ assert_true @mentioner1.mentions?(@mentionable1)
+ assert_false @mentioner2.mentions?(@mentionable1)
end
should "be able to unmention a Mentionable" do
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
assert @mentioner1.unmention!(@mentionable1)
- assert_equal false, @mentioner1.mentions?(@mentionable1)
+ assert_false @mentioner1.mentions?(@mentionable1)
end
should "not be able to mention the same thing twice" do
@@ -66,13 +66,13 @@ class MentionTest < Test::Unit::TestCase
end
should "be mentionable" do
- assert_equal true, @mentionable1.is_mentionable?
+ assert_true @mentionable1.is_mentionable?
end
should "be able to determine who mentions it" do
Mention.create :mentioner => @mentioner1, :mentionable => @mentionable1
- assert_equal true, @mentionable1.mentioned_by?(@mentioner1)
- assert_equal false, @mentionable1.mentioned_by?(@mentioner2)
+ assert_true @mentionable1.mentioned_by?(@mentioner1)
+ assert_false @mentionable1.mentioned_by?(@mentioner2)
end
should "expose a list of its mentioners" do
@@ -100,7 +100,7 @@ class MentionTest < Test::Unit::TestCase
should "delete its Mention records" do
@mentioner1.destroy
- assert_equal false, @mentionable1.mentioned_by?(@mentioner1)
+ assert_false @mentionable1.mentioned_by?(@mentioner1)
end
end
@@ -112,7 +112,7 @@ class MentionTest < Test::Unit::TestCase
should "delete its Mention records" do
@mentionable1.destroy
- assert_equal false, @mentioner1.mentions?(@mentionable1)
+ assert_false @mentioner1.mentions?(@mentionable1)
end
end
@@ -124,7 +124,7 @@ class MentionTest < Test::Unit::TestCase
should "be able to mention a model inheriting from mentionable" do
assert @mentioner.mention!(@mentionable_child)
- assert_equal true, @mentioner.mentions?(@mentionable_child)
+ assert_true @mentioner.mentions?(@mentionable_child)
end
end

0 comments on commit 8c13303

Please sign in to comment.
Something went wrong with that request. Please try again.