Sha256: 3b75de4c659ad0227581887625bb6e469825d6e77a4622af7ffccf3fc681a0b9

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

require "spec_helper"

RSpec.describe "suspenders:production:email", type: :generator do
  it "generates the configuration for a production email deployment" do
    with_app { generate("suspenders:production:email") }

    expect("config/smtp.rb").to match_contents(%r{SMTP_SETTINGS\s*=})

    expect("config/environments/production.rb").to \
      match_contents(%r{require.+'config', 'smtp'})
    expect("config/environments/production.rb").to \
      match_contents(%r{action_mailer.delivery_method\s*=\s*:smtp})
    expect("config/environments/production.rb").to \
      match_contents(%r{action_mailer.smtp_settings\s*=\s*SMTP_SETTINGS})

    expect("app.json").to contain_json(
      env: {
        SMTP_ADDRESS: { required: true },
        SMTP_DOMAIN: { required: true },
        SMTP_PASSWORD: { required: true },
        SMTP_USERNAME: { required: true },
      },
    )
  end

  it "destroys the configuration for a production email deployment" do
    with_app { destroy("suspenders:production:email") }

    expect("config/smtp.rb").not_to exist_as_a_file

    expect("config/environments/production.rb").not_to \
      match_contents(%r{require.+config/smtp})
    expect("config/environments/production.rb").not_to \
      match_contents(%r{action_mailer.delivery_method\s*=\s*:smtp})
    expect("config/environments/production.rb").not_to \
      match_contents(%r{action_mailer.smtp_settings\s*=\s*SMTP_SETTINGS})

    expect("app.json").not_to contain_json(
      env: {
        SMTP_ADDRESS: { required: true },
        SMTP_DOMAIN: { required: true },
        SMTP_PASSWORD: { required: true },
        SMTP_USERNAME: { required: true },
      },
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
welaika-suspenders-3.0 spec/features/production/email_spec.rb
welaika-suspenders-2.36 spec/features/production/email_spec.rb
welaika-suspenders-2.35 spec/features/production/email_spec.rb
welaika-suspenders-2.34 spec/features/production/email_spec.rb