Sha256: c351a1091ee32515ff071a4250b082569d159dfea94c5bccfb0adf6561e0ccfe

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

describe SlackRubyBot::Client do
  describe '#send_gifs?' do
    context 'without giphy is false', unless: WithGiphy.env? do
      it 'by default' do
        expect(subject.send_gifs?).to be false
      end

      it 'when set to true' do
        subject.send_gifs = true
        expect(subject.send_gifs?).to be false
      end

      it 'when set to true via config' do
        SlackRubyBot::Config.send_gifs = true
        expect(SlackRubyBot::Config.send_gifs?).to be false
      end
    end

    context 'with giphy', if: WithGiphy.env? do
      it 'default is true' do
        expect(subject.send_gifs?).to be true
      end

      it 'defaults to SlackRubyBot::Config.send_gifs? if set' do
        SlackRubyBot::Config.send_gifs = false
        expect(subject.send_gifs?).to be false
      end

      it 'client setting takes precedence' do
        SlackRubyBot::Config.send_gifs = true
        subject.send_gifs = false
        expect(subject.send_gifs?).to be false
        SlackRubyBot::Config.send_gifs = false
        subject.send_gifs = true
        expect(subject.send_gifs?).to be true
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-bot-0.15.0 spec/slack-ruby-bot/client_spec.rb
slack-ruby-bot-0.14.0 spec/slack-ruby-bot/client_spec.rb
slack-ruby-bot-0.13.0 spec/slack-ruby-bot/client_spec.rb