Sha256: 878eaa0a2c5cd3e2e505d1036343ce05fdea18bd5ea0b766ce92e83b7fb8c192

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe Jumpup::Heroku::Env do

  before do
    Jumpup::Heroku.configuration = nil
  end

  describe "with app" do

    before do
      Jumpup::Heroku.configure do |config|
        config.app = 'myapp'
      end
    end

    it "have correct env info" do
      expect(Jumpup::Heroku::Env.all).to eq({ app: 'myapp', run_database_tasks: true })
    end
  end

  describe "with staging_app and production_app" do

    before do
      Jumpup::Heroku.configure do |config|
        config.production_app = 'myapp-production'
        config.staging_app = 'myapp-staging'
      end
    end

    it "have correct env info" do
      result = { production_app: 'myapp-production', staging_app: 'myapp-staging', run_database_tasks: true }
      expect(Jumpup::Heroku::Env.all).to eq(result)
    end
  end

  describe "with run_database_tasks" do

    before do
      Jumpup::Heroku.configure do |config|
        config.app = 'myapp'
        config.run_database_tasks = false
      end
    end

    it "have correct env info" do
      result = { app: 'myapp', run_database_tasks: false }
      expect(Jumpup::Heroku::Env.all).to eq(result)
    end
  end

  describe "with a invalid config env" do

    before do
      Jumpup::Heroku.configure do |config|
        config.app = 'myapp'
        config.production_app = 'myapp-production'
        config.staging_app = 'myapp-staging'
        config.run_database_tasks = 'a'
      end
    end

    it 'raise error' do
      expect do
        Jumpup::Heroku::Env.all
      end.to raise_error(Jumpup::Heroku::ConfigurationError, %r{/config/initializers/jumpup-heroku.rb})
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jumpup-heroku-0.0.1 spec/jumpup/heroku/env_spec.rb