Sha256: 5e58da3d4b0359ab1bc1c8f123c16dd5b7d832c32113f45e883342fef774366a
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require_relative 'test_helper' class ReflectionTest < Minitest::Test def test_reflection_with_all_attributes reflection = Enumerations::Reflection.new(:status, class_name: 'Status', foreign_key: :status_id) assert_equal :status, reflection.name assert_equal 'Status', reflection.class_name assert_equal :status_id, reflection.foreign_key assert_equal ::Status, reflection.enumerator_class end def test_reflection_without_class_name_and_foreign_key reflection = Enumerations::Reflection.new(:status) assert_equal :status, reflection.name assert_equal 'Status', reflection.class_name assert_equal :status_id, reflection.foreign_key assert_equal ::Status, reflection.enumerator_class end def test_reflection_with_custom_name_and_without_foreign_key reflection = Enumerations::Reflection.new(:my_status, class_name: 'Status') assert_equal :my_status, reflection.name assert_equal 'Status', reflection.class_name assert_equal :my_status_id, reflection.foreign_key assert_equal ::Status, reflection.enumerator_class end def test_reflection_with_class_name_as_constant reflection = Enumerations::Reflection.new(:status, class_name: Status) assert_equal 'Status', reflection.class_name assert_equal ::Status, reflection.enumerator_class end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
enumerations-2.1.0 | test/reflection_test.rb |
enumerations-2.0.0 | test/reflection_test.rb |