spec/unit/migration_tasks_spec.rb in rom-sql-1.2.2 vs spec/unit/migration_tasks_spec.rb in rom-sql-1.3.0

- old
+ new

@@ -10,11 +10,13 @@ include_context 'database setup' let(:migrator) { container.gateways[:default].migrator } before do - allow(ROM::SQL::RakeSupport).to receive(:env) { conf } + ROM::SQL::Gateway.instance = nil + ROM::SQL::RakeSupport.env = nil + conf end context 'db:reset' do it 'calls proper commands' do expect(migrator).to receive(:run).with(target: 0) @@ -43,9 +45,18 @@ expect { Rake::Task["db:migrate"].execute }.to output("<= db:migrate executed\n").to_stdout end + end + + it 'raises an error on missing both env and Gateway.instance' do + ROM::SQL::RakeSupport.env = nil + ROM::SQL::Gateway.instance = nil + + expect { + Rake::Task["db:migrate"].execute + }.to raise_error(ROM::SQL::RakeSupport::MissingEnv) end end context 'db:clean' do it 'calls proper commands' do