Sha256: 69d8f85f0c8f6453b53f610c4084c0bbfe433ed6829eb436706fd8ab890a033f

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'support/adapter/helpers'

# This module contains the definition of a test structure that is used by the
# adapter methods tests, that look up in the database directly whether the
# expected objects have been created.
#
# The structure defintiion below serves as a blueprint of what it can be
# defined, ans as a reference of what it is expected to have been created by
# the +ChronoModel::Adapter+ methods.
#
module ChronoTest::Adapter

  module Structure
    extend ActiveSupport::Concern

    included do
      table 'test_table'
      subject { table }

      columns do
        native = [
          ['test', 'character varying'],
          ['foo',  'integer'],
          ['bar',  'double precision'],
          ['baz',  'text']
        ]

        def native.to_proc
          proc {|t|
            t.string  :test, null: false, default: 'default-value'
            t.integer :foo
            t.float   :bar
            t.text    :baz
            t.integer :ary, array: true, null: false, default: []
            t.boolean :bool, null: false, default: false
          }
        end

        native
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chrono_model-1.2.2 spec/support/adapter/structure.rb
chrono_model-1.2.1 spec/support/adapter/structure.rb