Sha256: fc86470ee68a677a6667027c159f0cf564db39f7435bd534ee6fd61c4629b141

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

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

  subject { SlackMessaging::NotifySlack.new(sentence) }

  it 'should call HTTParty' do
    expect(HTTParty).to receive(:post)
    subject.perform
  end

  it 'should define certain values' do
    expect(subject.text).to eq(sentence)
    expect(subject.channel).to eq(channel)
    expect(subject.username).to eq(username)
    expect(subject.webhook_url).to eq(webhook)
    expect(subject.icon_emoji).to eq(emoji)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slack_messaging-3.2.3 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.2.2 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.2.1 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.2.0 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.1.3 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.1.2 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.1.1 spec/slack_messaging/notify_slack_spec.rb
slack_messaging-3.1.0 spec/slack_messaging/notify_slack_spec.rb