Sha256: a36b1febce3cb0efa1f5eb6789e779fffa39b26916233aba8991e2847932e052

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require File.expand_path(File.dirname(__FILE__))+'/../test_helper'

class LikeableTest < Test::Unit::TestCase
  context "Likeable" do
    setup do
      @liker = ImALiker.new
      @likeable = ImALikeable.create
    end

    context "#is_likeable" do
      should "return true" do
        assert_true @likeable.is_likeable?
      end
    end

    context "#liked_by?" do
      should "not accept non-likers" do
        assert_raise(ArgumentError) { @likeable.liked_by?(:foo) }
      end

      should "call $Like.likes?" do
        $Like.expects(:likes?).with(@liker, @likeable).once
        @likeable.liked_by?(@liker)
      end
    end

    context "#likers" do
      should "call $Like.likers" do
        $Like.expects(:likers).with(@likeable, @liker.class, { :foo => :bar })
        @likeable.likers(@liker.class, { :foo => :bar })
      end
    end

    context "#likers_relation" do
      should "call $Like.likers_relation" do
        $Like.expects(:likers_relation).with(@likeable, @liker.class, { :foo => :bar })
        @likeable.likers_relation(@liker.class, { :foo => :bar })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socialization-0.5.0.beta2 test/victims/likeable_test.rb