Sha256: 53fc4e5971bcc7f89c2d031000d409d401c2ccffbfe980314188fd619ffc7294

Contents?: true

Size: 795 Bytes

Versions: 2

Compression:

Stored size: 795 Bytes

Contents

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

#Literally checking that the acts_as_cleo tag takes args and sets them as expected
class TestActsAsMethods < Test::Unit::TestCase

  should "respond to and return as_cleo" do
    book = Book.new(:name => 'Wedge\'s Life', :author => Author.create(:name => "Luke Skywalker"))
    assert_equal %w{name author}, book.cleo_config[:terms]
    assert_equal "name", book.cleo_config[:name]
    assert_equal "Book", book.cleo_config[:type]
  end

  should "exclude terms by default" do
    movie = Movie.create(:name => "A New Hope", :description => "The Best")
    assert_equal %w{name description}, movie.cleo_config[:terms]
    assert_equal "id", movie.cleo_config[:score]
    assert_equal "name", movie.cleo_config[:name]
  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/test_acts_methods.rb
acts_as_cleo-3.0.1 test/unit/acts_as_cleo/test_acts_methods.rb