Sha256: fb4e9d869c86ba17df01ffcc13ac3b636b49139787d974d6685457d26146382f

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 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
      config = { app: 'myapp', run_database_tasks: true, host: 'heroku.com',
                 deploy_branch: 'master', deploy_to_production_branch: 'master'}
      expect(Jumpup::Heroku::Env.all).to eq(config)
    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
      config = { production_app: 'myapp-production', staging_app: 'myapp-staging',
                 run_database_tasks: true, host: 'heroku.com',
                 deploy_branch: 'master', deploy_to_production_branch: 'production'}
      expect(Jumpup::Heroku::Env.all).to eq(config)
    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, host: 'heroku.com',
                 deploy_branch: 'master', deploy_to_production_branch: 'master' }
      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

2 entries across 2 versions & 1 rubygems

Version Path
jumpup-heroku-0.0.6 spec/jumpup/heroku/env_spec.rb
jumpup-heroku-0.0.5 spec/jumpup/heroku/env_spec.rb