Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rails_helper'
- require 'webmock/rspec'
- RSpec.describe Slack::GetTokenService do
- before do
- allow(URI::HTTPS).to receive(:build) { uri_https_build }
- end
- let(:slack_response) do
- {'ok' => true,
- 'access_token' => 'xoxp-8287350488dasd2',
- 'scope' => 'identify,channels:read,groups:read,team:read,users:read,files:write:user',
- 'user_id' => 'asd323434',
- 'team_id' => '9df90sdif90i',
- 'enterprise_id' => nil,
- 'team_name' => 'TEST_NAME'}.to_json
- end
- describe '#call' do
- subject(:method_call) { described_class.new(auth_code).call }
- let(:uri_https_build) { double(:uri_https_build) }
- let(:slack_api_auth_url) { double(:slack_api_auth_url) }
- let(:auth_code) { '828735048855.830404022803.ca637d9f7cb5' }
- it 'expect to have response' do
- expect(Net::HTTP).to receive(:get).with(uri_https_build) { slack_response }
- method_call
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement