Sha256: cbed0ce8692f744d1a8bc45a07a787c8c5cecc68a5fc1aaf8616ec2226acb4d4

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require "#{File.dirname(File.expand_path(__FILE__))}/../../helper"

class TestActiveRecordCallbacHooks < Test::Unit::TestCase
  def setup
    @book = Book.create(:name => "Otherland book 1")
    @author = Author.create(:name => "Tad Williams")
    @con = Category.new(:book => @book, :author => @author)
  end

  should "have acts_as_cleo_connection hooks and respond to them as expected" do
    con = Category.new(:book => @book, :author => @author)

    assert_not_nil con.book
    assert_not_nil con.author
    assert_equal con.author, @author
    assert_equal con.book, @book

    assert con.respond_to?(:cleo_target)
    assert con.respond_to?(:cleo_origin)
    assert con.respond_to?(:cleo_type)

    assert con.respond_to?(:to_cleo_connection)
    assert con.respond_to?(:as_connection)

    assert con.respond_to?(:create_cleo_connection)
    assert con.respond_to?(:update_cleo_connection)
    assert con.respond_to?(:remove_cleo_connection)

    assert_equal con.cleo_origin, "book"
    assert_equal con.cleo_target, "author"
    assert_equal con.cleo_type, "call_for_type_method"
    assert_equal con.send("call_for_type_method"), "InThisCaseCategory"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_cleo-3.0.2 test/unit/acts_as_cleo_connection/test_acts_methods.rb
acts_as_cleo-3.0.1 test/unit/acts_as_cleo_connection/test_acts_methods.rb