Sha256: f9ae3053dacf41fb9708a6861a443551db95a606481ed5905069503fcf3d6179
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
module ChronoTest::Adapter module Helpers def self.included(base) base.extend DSL base.instance_eval do delegate :adapter, :to => ChronoTest delegate :columns, :table, :pk_type, :to => DSL end end module DSL def with_temporal_table(&block) context ':temporal => true' do before(:all) { adapter.create_table(table, :temporal => true, &DSL.columns) } after(:all) { adapter.drop_table table } instance_eval(&block) end end def with_plain_table(&block) context ':temporal => false' do before(:all) { adapter.create_table(table, :temporal => false, &DSL.columns) } after(:all) { adapter.drop_table table } instance_eval(&block) end end def self.table(table = nil) @table = table if table @table end def self.columns(&block) @columns = block.call if block @columns end def self.pk_type @pk_type ||= if ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1 'bigint' else 'integer' end end delegate :columns, :table, :pk_type, :to => self end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chrono_model-1.2.2 | spec/support/adapter/helpers.rb |
chrono_model-1.2.1 | spec/support/adapter/helpers.rb |