Sha256: 8fa0516d1012e351907ea176fc4de4b0e3b61d3b3a913f74d6808354b9c0ff7b
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require File.dirname(__FILE__)+'/test_helper' class LikeTest < Test::Unit::TestCase def setup @u_john = User.create :name => 'John Doe' @u_jane = User.create :name => 'Jane Doe' @m_seven = Movie.create :name => 'Seven' @m_pulp = Movie.create :name => 'Pulp Fiction' @m_tub = Movie.create :name => 'Hot Tub Time Machine' end def test_the_world assert @u_john.is_liker? assert @u_john.is_likeable? assert @m_seven.is_likeable? assert @u_john.like!(@m_seven) assert @u_john.like!(@m_pulp) assert @u_jane.like!(@m_seven) assert_raise ArgumentError do @u_jane.follow!(@m_seven) # movie is not followable end assert_equal true, @u_john.likes?(@m_seven) assert_equal true, @u_john.likes?(@m_pulp) assert_equal true, @u_jane.likes?(@m_seven) assert_equal false, @u_jane.likes?(@m_pulp) assert_equal true, @m_seven.liked_by?(@u_john) assert_equal false, @m_pulp.liked_by?(@u_jane) assert @m_tub.likers.empty? # can't have duplicate a like assert_raise ActiveRecord::RecordInvalid do @u_john.like!(@m_seven) end assert @u_john.unlike!(@m_seven) assert_equal false, @m_seven.liked_by?(@u_john) end def test_user_liking_another_user @u_john.like!(@u_jane) assert_equal true, @u_john.likes?(@u_jane) assert_equal false, @u_jane.likes?(@u_john) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
socialization-0.2.1 | test/like_test.rb |