Module: RSpec::Sequel::MigrationExampleGroup

Defined in:
lib/rspec/sequel/migration_example_group.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# 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

Instance Method Details

#migrate!(direction) ⇒ Object



15
16
17
# File 'lib/rspec/sequel/migration_example_group.rb', line 15

def migrate! direction
  migration.apply db, direction
end