Sha256: 8b1bd7729f3e396f1849332191a46c985e792ce9dd59aa7681b6dacdf8be50e8

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

require "spec_helper"

RSpec.describe "Heroku" do
  before do
    drop_dummy_database
    remove_project_directory
  end

  it "suspends a project for Heroku" do
    run_suspenders("--heroku=true")

    expect(FakeHeroku).to have_gem_included(project_path, "rails_stdout_logging")
    expect(FakeHeroku).to have_created_app_for("staging", "--region eu")
    expect(FakeHeroku).to have_created_app_for("production", "--region eu")
    expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
    expect(FakeHeroku).to have_configured_vars("production", "SECRET_KEY_BASE")

    bin_setup_path = "#{project_path}/bin/setup"
    bin_setup = IO.read(bin_setup_path)
    app_name = SuspendersTestHelpers::APP_NAME.dasherize

    expect(bin_setup).to include("heroku join --app #{app_name}-production")
    expect(bin_setup).to include("heroku join --app #{app_name}-staging")
    expect(File.stat(bin_setup_path)).to be_executable

    bin_deploy_path = "#{project_path}/bin/deploy"
    bin_deploy = IO.read(bin_deploy_path)

    expect(bin_deploy).to include("heroku run rake db:migrate")
    expect(File.stat(bin_deploy_path)).to be_executable

    readme = IO.read("#{project_path}/README.md")

    expect(readme).to include("./bin/deploy staging")
    expect(readme).to include("./bin/deploy production")

    circle_yml_path = "#{project_path}/circle.yml"
    circle_yml = IO.read(circle_yml_path)

    expect(circle_yml).to include <<-YML.strip_heredoc
    deployment:
      staging:
        branch: master
        commands:
          - git remote add staging git@heroku.com:#{app_name}-staging.git
          - bin/deploy staging
    YML
  end

  it "suspends a project with extra Heroku flags" do
    run_suspenders(%{--heroku=true --heroku-flags="--region eu"})

    expect(FakeHeroku).to have_created_app_for("staging", "--region eu")
    expect(FakeHeroku).to have_created_app_for("production", "--region eu")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
welaika-suspenders-2.20.0 spec/features/heroku_spec.rb
welaika-suspenders-2.19.0 spec/features/heroku_spec.rb