spec/integration/gateway_spec.rb in rom-sql-1.0.1 vs spec/integration/gateway_spec.rb in rom-sql-1.0.2
- old
+ new
@@ -1,21 +1,19 @@
-RSpec.describe ROM::SQL::Gateway, :postgres, skip_tables: true do
+RSpec.describe ROM::SQL::Gateway, :postgres do
include_context 'database setup'
describe 'migration' do
+ before do
+ inferrable_relations.concat %i(rabbits carrots)
+ end
+
context 'creating migrations inline' do
subject(:gateway) { container.gateways[:default] }
let(:conf) { ROM::Configuration.new(:sql, conn) }
let(:container) { ROM.container(conf) }
- after do
- [:rabbits, :carrots].each do |name|
- gateway.connection.drop_table?(name)
- end
- end
-
it 'allows creating and running migrations' do
migration = gateway.migration do
up do
create_table(:rabbits) do
primary_key :id
@@ -37,10 +35,14 @@
expect(gateway.connection.tables).to_not include(:rabbits)
end
end
context 'running migrations from a file system' do
+ before do
+ inferrable_relations.concat %i(schema_migrations)
+ end
+
let(:migration_dir) do
Pathname(__FILE__).dirname.join('../fixtures/migrations').realpath
end
let(:migrator) { ROM::SQL::Migration::Migrator.new(conn, path: migration_dir) }
@@ -62,11 +64,13 @@
end
end
describe 'transactions' do
before do
- conn.drop_table?(:names)
+ inferrable_relations.concat %i(names)
+ end
+ before do
conn.create_table(:names) do
String :name
end
end