Sha256: 2a6888a6acf358c68d690547c6fe975ef1ef7a54040427a44b81b49f18dfd873

Contents?: true

Size: 1.69 KB

Versions: 16

Compression:

Stored size: 1.69 KB

Contents

require 'test_helper'

class MLS::AttributeTest < Minitest::Test

  test "::new(NAME) sets @name to NAME" do
    attribute = MLS::Attribute.new("name")
    assert_equal "name", attribute.name
  end

  test "::new(NAME) sets @options to defaults" do
    attribute = MLS::Attribute.new("name")
    assert_equal MLS::Attribute::DEFAULT_OPTIONS, attribute.options
  end

  test "::new(NAME) sets @instance_variable_name" do
    attribute = MLS::Attribute.new("name")
    assert_equal "@name", attribute.instance_variable_name
  end


  test "::new(NAME) sets @default to nil" do
    attribute = MLS::Attribute.new("name")
    assert_equal nil, attribute.default
  end

  test "::new(NAME, :default => N) sets @default to N" do
    attribute = MLS::Attribute.new("name", :default => 'N')
    assert_equal 'N', attribute.default
  end

  test "::new(NAME) sets @reader_visibility to :public" do
    attribute = MLS::Attribute.new("name")
    assert_equal :public, attribute.reader_visibility
  end

  test "::new(NAME, :reader => :private) sets @reader_visibility to :private" do
    attribute = MLS::Attribute.new("name", :reader => :private)
    assert_equal :private, attribute.reader_visibility
  end

  test "::new(NAME) sets @writer_visibility to :public" do
    attribute = MLS::Attribute.new("name")
    assert_equal :public, attribute.writer_visibility
  end

  test "::new(NAME, :writer => :private) sets @writer_visibility to :private" do
    attribute = MLS::Attribute.new("name", :writer => :private)
    assert_equal :private, attribute.writer_visibility
  end

  test "::demodulized_names caches hash" do
    assert_equal MLS::Attribute.demodulized_names.object_id, MLS::Attribute.demodulized_names.object_id
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mls-1.9.0 test/mls/attribute_test.rb
mls-1.8.0 test/mls/attribute_test.rb
mls-1.7.0 test/mls/attribute_test.rb
mls-1.6.0 test/mls/attribute_test.rb
mls-1.5.1 test/mls/attribute_test.rb
mls-1.5.0 test/mls/attribute_test.rb
mls-1.4.3 test/mls/attribute_test.rb
mls-1.4.0 test/mls/attribute_test.rb
mls-1.3.0 test/mls/attribute_test.rb
mls-1.2.0 test/mls/attribute_test.rb
mls-1.1.4 test/mls/attribute_test.rb
mls-1.1.3 test/mls/attribute_test.rb
mls-1.1.2 test/mls/attribute_test.rb
mls-1.1.1 test/mls/attribute_test.rb
mls-1.1.0 test/mls/attribute_test.rb
mls-1.0.0 test/mls/attribute_test.rb