Sha256: 51217445070bb3585f544f461ac3dc527582cc18efbc2282c6e78c3ac184fa86

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'
require 'slack_messaging'

describe SlackMessaging::NotifySlack do
  let(:sentence) { Faker::Lorem.sentence }
  let(:channel) { Faker::Lorem.word }
  let(:username) { Faker::Name.name }
  let(:webhook) { Faker::Internet.url }
  let(:emoji) { Faker::Internet.url }

  let(:config_file) do
    {
      'slack': {
        'slack_option': true,
        'username': username,
        'icon_emoji': emoji,
        'channel': channel,
        'webhook_url': webhook
      }
    }
  end

  before :each do
    allow(YAML).to receive(:load_file).and_return(config_file)
    allow(File).to receive(:exist?).and_return(true)
    SlackMessaging::Config.load(Faker::Lorem.word)
  end

  it 'should call HTTParty' do
    expect(HTTParty).to receive(:post)
    message = SlackMessaging::NotifySlack.new(sentence)
    message.perform
  end

    it 'should define certain values' do
    message = SlackMessaging::NotifySlack.new(sentence)
    expect(message.text).to eq(sentence)
    expect(message.channel).to eq(channel)
    expect(message.username).to eq(username)
    expect(message.webhook_url).to eq(webhook)
    expect(message.icon_emoji).to eq(emoji)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
slack_messaging-2.1.1 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-2.1.0 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-2.0.0 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-1.4.0 spec/slack_messaging/notify_slack_spec.rb