Sha256: 312554a4e394fb486d03d145578e0b49f093d81191c9edcf79b195d832fc2bbc

Contents?: true

Size: 1.37 KB

Versions: 8

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

class CleanTestClassForLikeable
  include Likeable
  def like_key
    "like_key"
  end

  def to_hash(*args); {} end

  def foo
  end

  def id
    @id ||= rand(100)
  end
end

Likeable.setup

describe Likeable::UserMethods do
  before(:each) do
    @user   = User.new
    @target = CleanTestClassForLikeable.new
  end

  describe '#like!' do
    it "calls add_like_from in target" do
      @target.should_receive(:add_like_from).with(@user)
      @user.like! @target
    end
  end

  describe '#unlike!' do
    it "calls remove_like_from in target" do
      @target.should_receive(:remove_like_from).with(@user)
      @user.unlike! @target
    end
  end

  describe '#like?' do
    it "calls liked_by? in target" do
      @target.should_receive(:liked_by?).with(@user)
      @user.like? @target
    end
  end

  describe '#like?' do
    it "calls liked_by? in target" do
      @target.should_receive(:liked_by?).with(@user)
      @user.like? @target
    end
  end

  describe '#friend_ids_that_like' do
     it "calls liked_friend_ids? in target" do
       @target.should_receive(:liked_friend_ids).with(@user)
       @user.friend_ids_that_like @target
     end
   end

   describe '#friends_that_like' do
      it "calls liked_friends? in target" do
        @target.should_receive(:liked_friends).with(@user, nil)
        @user.friends_that_like @target
      end
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
likeable-0.1.2 spec/likeable/user_methods_spec.rb
likeable-0.1.1 spec/likeable/user_methods_spec.rb
likeable-0.1.0 spec/likeable/user_methods_spec.rb
likeable-0.0.5 spec/likeable/user_methods_spec.rb
likeable-0.0.4 spec/likeable/user_methods_spec.rb
likeable-0.0.3 spec/likeable/user_methods_spec.rb
likeable-0.0.2 spec/likeable/user_methods_spec.rb
likeable-0.0.1 spec/likeable/user_methods_spec.rb