Sha256: e2664dbe545259132217a0f23cabd1067647a106fae1147a9bc98f4ad1bacec3

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

module SlackSupport
  module Users
    def new_user(id, name)
      ::Boty::Slack::User.new(
        "id"    => id,
        "name"  => name
      )
    end

    def self.included(base)
      base.instance_eval do
        let(:user_name) { "julian" }
        let(:user_id) { "U023BECGF" }

        before do
          allow(::Boty::Slack.users).to receive(:info)
            .and_return(new_user(user_id, user_name))
        end
      end
    end
  end

  RSpec::Matchers.define :send_im do |user_id, message|
    supports_block_expectations

    match do |block|
      expect(::Boty::Slack.chat).to receive(:post_im).with(user_id, message)
      block.call
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boty-1.0.1 spec/support/slack_support.rb
boty-1.0.0 spec/support/slack_support.rb
boty-0.2.0 spec/support/slack_support.rb
boty-0.1.2 spec/support/slack_support.rb
boty-0.1.1 spec/support/slack_support.rb