Sha256: 1e86f4130c822e58a9328dbd1a2844c9f3cc9040e10a5d677b206a78d099d742

Contents?: true

Size: 867 Bytes

Versions: 5

Compression:

Stored size: 867 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Slack::Events::Config do
  before do
    ENV['SLACK_SIGNING_SECRET'] = 'secret'
    described_class.reset
  end

  after do
    ENV.delete 'SLACK_SIGNING_SECRET'
  end

  it 'defaults signing secret to ENV[SLACK_SIGNING_SECRET]' do
    expect(Slack::Events.config.signing_secret).to eq 'secret'
  end

  it 'defaults signature expiration to 5 minutes' do
    expect(Slack::Events.config.signature_expires_in).to eq 5 * 60
  end

  context 'configured' do
    before do
      Slack::Events.configure do |config|
        config.signing_secret = 'custom'
        config.signature_expires_in = 45
      end
    end

    it 'uses the configured values' do
      expect(Slack::Events.config.signing_secret).to eq 'custom'
      expect(Slack::Events.config.signature_expires_in).to eq 45
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slack-ruby-client-2.4.0 spec/slack/events/config_spec.rb
slack-ruby-client-2.3.0 spec/slack/events/config_spec.rb
slack-ruby-client-2.2.0 spec/slack/events/config_spec.rb
slack-ruby-client-2.1.0 spec/slack/events/config_spec.rb
slack-ruby-client-2.0.0 spec/slack/events/config_spec.rb