module RSpec::Sequel::MigrationExampleGroup

Public Class Methods

included(base) click to toggle source
# File lib/rspec/sequel/migration_example_group.rb, line 4
def self.included(base)
  base.extend ClassMethods
  base.class_eval do
    let(:db) { Sequel::connect 'sqlite:/' }
    let(:migration) { load_migration migration_path }
    migration_example_group = self
    basedir = if defined? Rails then Rails.root else Dir.pwd end
    let(:migration_path) { File.expand_path(migration_example_group.description, basedir) }
  end
end

Public Instance Methods

migrate!(direction) click to toggle source
# File lib/rspec/sequel/migration_example_group.rb, line 15
def migrate! direction
  migration.apply db, direction
end

Private Instance Methods

load_migration(path) click to toggle source
# File lib/rspec/sequel/migration_example_group.rb, line 36
def load_migration path
  Sequel.extension :migration
  load path
  Sequel::Migration.descendants.pop
end