Sha256: 45dc0908e9cd89a89e43addf625b2010dc2a7062b4ab180dc137840adad54e4d

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

require 'test_helper'

module Plotline
  class FooContent < Entry; end

  class EntryTest < ActiveSupport::TestCase
    test "content_attr" do
      assert_equal({}, FooContent.content_attributes)

      FooContent.content_attr(:foo_attr, :text)
      FooContent.content_attr(:bar_attr, :integer)

      assert_equal :text, FooContent.content_attributes[:foo_attr]
      assert_equal :integer, FooContent.content_attributes[:bar_attr]

      foo  = FooContent.new
      post = BlogPost.new

      assert foo.respond_to?(:foo_attr)
      assert !post.respond_to?(:foo_attr)

      foo.foo_attr = "Hello"

      assert_equal "Hello", foo.foo_attr
      assert_equal "Hello", foo.payload["foo_attr"]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plotline-0.1.1 test/models/plotline/entry_test.rb
plotline-0.1.0 test/models/plotline/entry_test.rb