Sha256: 65ea9862d7b0e5bb330831a427da1ad1f93ec27e591465df798d95cf3a0b21ae
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Slack::Web::Api::Mixins::Groups do subject(:groups) do klass.new end let(:klass) do Class.new do include Slack::Web::Api::Mixins::Groups end end before do allow(groups).to receive(:groups_list).and_yield( Slack::Messages::Message.new( 'groups' => [{ 'id' => 'CDEADBEEF', 'name' => 'general' }] ) ) end context '#groups_id' do it 'leaves groups specified by ID alone' do expect(groups.groups_id(channel: 'C123456')).to( eq('ok' => true, 'group' => { 'id' => 'C123456' }) ) end it 'translates a channel that starts with a #' do expect(groups.groups_id(channel: '#general')).to( eq('ok' => true, 'group' => { 'id' => 'CDEADBEEF' }) ) end it 'fails with an exception' do expect { groups.groups_id(channel: '#invalid') }.to( raise_error(Slack::Web::Api::Errors::SlackError, 'channel_not_found') ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems