Sha256: 5c09788a1ab37289de20a40a1a973cf365f3f8ae2d4c08d31e958a08437fd3bf

Contents?: true

Size: 1.84 KB

Versions: 6

Compression:

Stored size: 1.84 KB

Contents

require 'spec_helper'

feature 'Suspend a new project with default configuration' do
  scenario 'specs pass' do
    run_suspenders

    Dir.chdir(project_path) do
      Bundler.with_clean_env do
        expect(`rake`).to include('0 failures')
      end
    end
  end

  scenario 'staging config is inherited from production' do
    run_suspenders

    staging_file = IO.read("#{project_path}/config/environments/staging.rb")
    config_stub = "Rails.application.configure do"

    expect(staging_file).to match(/^require_relative 'production'/)
    expect(staging_file).to match(/#{config_stub}/), staging_file
  end

  scenario 'generated .ruby-version is pulled from Suspenders .ruby-version' do
    run_suspenders

    ruby_version_file = IO.read("#{project_path}/.ruby-version")

    expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
  end

  scenario 'secrets.yml reads secret from env' do
    run_suspenders

    secrets_file = IO.read("#{project_path}/config/secrets.yml")

    expect(secrets_file).to match(/secret_key_base: <%= ENV\['SECRET_KEY_BASE'\] %>/)
  end

  scenario 'action mailer support file is added' do
    run_suspenders

    expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
  end

  scenario 'newrelic.yml reads NewRelic license from env' do
    run_suspenders

    newrelic_file = IO.read("#{project_path}/config/newrelic.yml")

    expect(newrelic_file).to match(
      /license_key: '<%= ENV\['NEW_RELIC_LICENSE_KEY'\] %>'/
    )
  end

  scenario 'records pageviews through Segment.io if ENV variable set' do
    run_suspenders

    expect(analytics_partial).
      to include("<% if ENV['SEGMENT_IO_KEY'] %>")
    expect(analytics_partial).
      to include("window.analytics.load('<%= ENV['SEGMENT_IO_KEY'] %>');")
  end

  def analytics_partial
    IO.read("#{project_path}/app/views/application/_analytics.html.erb")
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
jetfuel-1.18.3 spec/features/new_project_spec.rb
jetfuel-1.18.2 spec/features/new_project_spec.rb
jetfuel-1.18.1 spec/features/new_project_spec.rb
jetfuel-1.18.0 spec/features/new_project_spec.rb
suspenders-1.14.0 spec/features/new_project_spec.rb
suspenders-1.13.0 spec/features/new_project_spec.rb