Sha256: d5002c46750faf88e694f468c94348e280829574c94827f99ec722a7b5c124e5

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

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

class MentionableTest < Test::Unit::TestCase
  context "Mentionable" do
    setup do
      @mentioner = ImAMentioner.new
      @mentionable = ImAMentionable.create
    end

    context "#is_mentionable?" do
      should "return true" do
        assert_true @mentionable.is_mentionable?
      end
    end

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

    context "#mentioned_by?" do
      should "not accept non-mentioners" do
        assert_raise(ArgumentError) { @mentionable.mentioned_by?(:foo) }
      end

      should "call $Mention.mentions?" do
        $Mention.expects(:mentions?).with(@mentioner, @mentionable).once
        @mentionable.mentioned_by?(@mentioner)
      end
    end

    context "#mentioners" do
      should "call $Mention.mentioners" do
        $Mention.expects(:mentioners).with(@mentionable, @mentioner.class, { :foo => :bar })
        @mentionable.mentioners(@mentioner.class, { :foo => :bar })
      end
    end

    context "#mentioners_relation" do
      should "call $Mention.mentioners" do
        $Mention.expects(:mentioners_relation).with(@mentionable, @mentioner.class, { :foo => :bar })
        @mentionable.mentioners_relation(@mentioner.class, { :foo => :bar })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socialization-0.5.0.beta3 test/victims/mentionable_test.rb