Sha256: 4794617632ca4faa7f0d5b362acc2b2d41594f5221e489059a174041059ae872
Contents?: true
Size: 1.36 KB
Versions: 13
Compression:
Stored size: 1.36 KB
Contents
require 'spec_helper' RSpec.describe Slack::Web::Api::Mixins::Users do let(:klass) do Class.new do include Slack::Web::Api::Mixins::Users end end subject do klass.new end before do allow(subject).to receive(:users_list).and_return(Slack::Messages::Message.new( 'members' => [{ 'id' => 'UDEADBEEF', 'name' => 'aws', 'profile' => {} }] )) end context '#users_id' do it 'leaves users specified by ID alone' do expect(subject.users_id(user: 'U123456')).to eq('ok' => true, 'user' => { 'id' => 'U123456' }) end it 'translates a user that starts with a #' do expect(subject.users_id(user: '@aws')).to eq('ok' => true, 'user' => { 'id' => 'UDEADBEEF' }) end it 'fails with an exception' do expect { subject.users_id(user: '@foo') }.to raise_error Slack::Web::Api::Error, 'user_not_found' end end context '#users_search' do it 'finds a user' do expect(subject.users_search(user: 'aws')).to eq('ok' => true, 'members' => [{ 'id' => 'UDEADBEEF', 'name' => 'aws', 'profile' => {} }]) end end if defined?(Picky) end
Version data entries
13 entries across 13 versions & 1 rubygems