Sha256: bef011bb2e401b5646ddfc5a0812224f080e7d5d568fc02da3beb23a97a052c9

Contents?: true

Size: 951 Bytes

Versions: 2

Compression:

Stored size: 951 Bytes

Contents

require 'test_helper'

module Automigration
  class FieldsTest < ActiveSupport::TestCase
    def test_kind_of_field
      assert_equal :boolean, Fields::Boolean.kind
    end

    def test_automigrable_model
      assert Simple.fields_keeper.auto_migrable?
      assert !NotAutomigrable.fields_keeper.auto_migrable?
    end

    def test_migrations_attrs
      assert_equal [], AutoMigration1.fields_keeper.migration_attrs

      assert_equal ['some_attr1', 'some_attr2' , 'some_attr3'], 
        AutoMigration2.fields_keeper.migration_attrs
    end

    def test_boolean_column_false_by_default
      assert_equal false, AutoMigration1.new.boolean_field
    end

    def test_from_meta
      assert_equal Fields::Boolean, Fields::Sys::Base.from_meta(:as => :boolean, :name => 'some').class
    end

    def test_attributes_accessible
      obj = AutoMigration1.create(:integer_field => 123)
      assert_equal 123, obj.integer_field
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
automigration-0.2.2 test/fields_test.rb
automigration-0.2.1 test/fields_test.rb