Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. require 'rails_helper'
  2. require 'webmock/rspec'
  3.  
  4. RSpec.describe Slack::GetTokenService do
  5. before do
  6. allow(URI::HTTPS).to receive(:build) { uri_https_build }
  7. end
  8.  
  9. let(:slack_response) do
  10. {'ok' => true,
  11. 'access_token' => 'xoxp-8287350488dasd2',
  12. 'scope' => 'identify,channels:read,groups:read,team:read,users:read,files:write:user',
  13. 'user_id' => 'asd323434',
  14. 'team_id' => '9df90sdif90i',
  15. 'enterprise_id' => nil,
  16. 'team_name' => 'TEST_NAME'}.to_json
  17. end
  18.  
  19. describe '#call' do
  20. subject(:method_call) { described_class.new(auth_code).call }
  21.  
  22. let(:uri_https_build) { double(:uri_https_build) }
  23. let(:slack_api_auth_url) { double(:slack_api_auth_url) }
  24. let(:auth_code) { '828735048855.830404022803.ca637d9f7cb5' }
  25.  
  26. it 'expect to have response' do
  27. expect(Net::HTTP).to receive(:get).with(uri_https_build) { slack_response }
  28. method_call
  29. end
  30. end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement