Sha256: e5c4729905ecc46654230162ce75369a4f25f7049d1b34a2628c202abbbcd791

Contents?: true

Size: 941 Bytes

Versions: 12

Compression:

Stored size: 941 Bytes

Contents

describe 'using apartment within an engine' do

  before do
    engine_path = Pathname.new(File.expand_path('../../dummy_engine', __FILE__))
    require engine_path.join('test/dummy/config/application')
    @rake = Rake::Application.new
    Rake.application = @rake
    stub_const 'APP_RAKEFILE', engine_path.join('test/dummy/Rakefile')
    load 'rails/tasks/engine.rake'
  end

  it 'sucessfully runs rake db:migrate in the engine root' do
    expect{ Rake::Task['db:migrate'].invoke }.to_not raise_error
  end

  it 'sucessfully runs rake app:db:migrate in the engine root' do
    expect{ Rake::Task['app:db:migrate'].invoke }.to_not raise_error
  end

  context 'when Apartment.db_migrate_tenants is false' do
    it 'should not enhance tasks' do
      Apartment.db_migrate_tenants = false
      expect(Apartment::RakeTaskEnhancer).to_not receive(:enhance_task).with('db:migrate')
      Rake::Task['db:migrate'].invoke
    end
  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ros-apartment-2.3.0 spec/integration/use_within_an_engine_spec.rb
ros-apartment-2.3.0.alpha2 spec/integration/use_within_an_engine_spec.rb
ros-apartment-2.3.0.alpha1 spec/integration/use_within_an_engine_spec.rb
apartment-2.2.1 spec/integration/use_within_an_engine_spec.rb
apartment-2.2.0 spec/integration/use_within_an_engine_spec.rb
apartment-2.1.0 spec/integration/use_within_an_engine_spec.rb
apartment-2.0.0 spec/integration/use_within_an_engine_spec.rb
apartment-1.2.0 spec/integration/use_within_an_engine_spec.rb
apartment-1.1.0 spec/integration/use_within_an_engine_spec.rb
apartment-1.0.2 spec/integration/use_within_an_engine_spec.rb
apartment-1.0.1 spec/integration/use_within_an_engine_spec.rb
apartment-1.0.0 spec/integration/use_within_an_engine_spec.rb