Kill trailing whitespace in ruby files
This commit is contained in:
@@ -8,7 +8,7 @@ class FavoriteTest < ActiveSupport::TestCase
|
||||
MEMCACHE.flush_all
|
||||
Favorite # need to force loading the favorite model
|
||||
end
|
||||
|
||||
|
||||
teardown do
|
||||
CurrentUser.user = nil
|
||||
CurrentUser.ip_addr = nil
|
||||
@@ -18,41 +18,41 @@ class FavoriteTest < ActiveSupport::TestCase
|
||||
should "delete from all tables" do
|
||||
user1 = FactoryGirl.create(:user)
|
||||
p1 = FactoryGirl.create(:post)
|
||||
|
||||
|
||||
user1.add_favorite!(p1)
|
||||
assert_equal(1, Favorite.count)
|
||||
|
||||
|
||||
Favorite.destroy_all(:user_id => user1.id, :post_id => p1.id)
|
||||
assert_equal(0, Favorite.count)
|
||||
end
|
||||
|
||||
|
||||
should "know which table it belongs to" do
|
||||
user1 = FactoryGirl.create(:user)
|
||||
user2 = FactoryGirl.create(:user)
|
||||
user2 = FactoryGirl.create(:user)
|
||||
p1 = FactoryGirl.create(:post)
|
||||
p2 = FactoryGirl.create(:post)
|
||||
|
||||
|
||||
user1.add_favorite!(p1)
|
||||
user1.add_favorite!(p2)
|
||||
user2.add_favorite!(p1)
|
||||
|
||||
|
||||
favorites = user1.favorites.order("id desc")
|
||||
assert_equal(2, favorites.count)
|
||||
assert_equal(p2.id, favorites[0].post_id)
|
||||
assert_equal(p1.id, favorites[1].post_id)
|
||||
|
||||
|
||||
favorites = user2.favorites.order("id desc")
|
||||
assert_equal(1, favorites.count)
|
||||
assert_equal(p1.id, favorites[0].post_id)
|
||||
end
|
||||
|
||||
|
||||
should "not allow duplicates" do
|
||||
user1 = FactoryGirl.create(:user)
|
||||
p1 = FactoryGirl.create(:post)
|
||||
p2 = FactoryGirl.create(:post)
|
||||
user1.add_favorite!(p1)
|
||||
user1.add_favorite!(p1)
|
||||
|
||||
|
||||
assert_equal(1, user1.favorites.count)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user