Sha256: b9f00bf2a164d51e01fdf9fd214b9e9e95266e0ae1ab99cd3f3354d860950b0e

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'helper'

class AxleAttributes::Definition::CustomizationTest < ActiveSupport::TestCase
  test 'customization' do
    attribute_customization = create :attribute_customization, name: 'foo', namespace: 'Business'
    foo = AxleAttributes::Definition.new Business, :foo

    assert_equal attribute_customization, foo.customization
  end

  test 'display_name' do
    foo = AxleAttributes::Definition.new Business, :foo
    assert_equal 'Foo', foo.display_name

    foo_bar = AxleAttributes::Definition.new Business, 'foo.bar'
    assert_equal 'Foo Bar', foo_bar.display_name
  end

  test 'readers' do
    attribute_customization = create :attribute_customization, name: 'foo', namespace: 'Business', description: 'A cool attribute', editable: false, notes: 'We need to remove this', deprecated_on: Date.new(2004, 12, 24)
    foo = AxleAttributes::Definition.new Business, :foo
    bar = AxleAttributes::Definition.new Business, :bar

    assert_equal 'A cool attribute', foo.description
    assert_equal false, foo.editable_customization
    assert_equal 'We need to remove this', foo.notes
    assert_equal Date.new(2004, 12, 24), foo.deprecated_on
    assert foo.deprecated?

    assert_nil bar.description
    assert_equal true, bar.editable_customization
    assert_nil bar.notes
    assert_nil bar.deprecated_on
    refute bar.deprecated?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axle_attributes-1.13.2 test/lib/definition/customization_test.rb