Sha256: 8e94f4103d18a4f3b0aef45ba26b043bb888df28a39d98496fbeadcc5f1cecd0

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

$LOAD_PATH.unshift File.expand_path('../../test', __FILE__)
require 'test_helper'

class LikableTest < Minitest::Test
  def setup
    @user = Factory(:user)
    @friend = Factory(:user)
    @movie = Factory(:movie)
  end

  def test_liked_by_returns_relevant_users
    assert_empty @movie.liked_by
    @user.like(@movie)
    assert_includes @movie.liked_by, @user
    refute_includes @movie.liked_by, @friend
    @friend.like(@movie)
    assert_includes @movie.liked_by, @friend
  end

  def test_liked_by_count_returns_an_accurate_count
    assert_empty @movie.liked_by
    @user.like(@movie)
    assert_equal @movie.liked_by_count, 1
    @friend.like(@movie)
    assert_equal @movie.liked_by_count, 2
  end

  def teardown
    Recommendable.redis.flushdb
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
recommendable-2.2.2 test/recommendable/ratable/likable_test.rb
recommendable-2.2.1 test/recommendable/ratable/likable_test.rb