Chore: Routine Bugfixes and enhancements (#979)

- Fix slack scopes
- Docs for authentication
Fixes: #704 , #973
This commit is contained in:
Sojan Jose
2020-06-25 23:35:16 +05:30
committed by GitHub
parent 0aab717bb3
commit 4f83d5451e
32 changed files with 254 additions and 147 deletions
@@ -14,15 +14,16 @@ RSpec.describe 'Integration Apps API', type: :request do
context 'when it is an authenticated user' do
let(:agent) { create(:user, account: account, role: :agent) }
it 'returns all the apps' do
it 'returns all active apps' do
first_app = Integrations::App.all.find(&:active?)
get api_v1_account_integrations_apps_url(account),
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
app = JSON.parse(response.body)['payload'].first
expect(app['id']).to eql('webhook')
expect(app['name']).to eql('Webhooks')
apps = JSON.parse(response.body)['payload'].first
expect(apps['id']).to eql(first_app.id)
expect(apps['name']).to eql(first_app.name)
end
end
end
@@ -1,6 +1,6 @@
require 'rails_helper'
describe Integrations::Slack::OutgoingMessageBuilder do
describe Integrations::Slack::SendOnSlackService do
let(:account) { create(:account) }
let!(:inbox) { create(:inbox, account: account) }
let!(:contact) { create(:contact) }
@@ -11,7 +11,7 @@ describe Integrations::Slack::OutgoingMessageBuilder do
describe '#perform' do
it 'sent message to slack' do
builder = described_class.new(hook, message)
builder = described_class.new(message: message, hook: hook)
stub_request(:post, 'https://slack.com/api/chat.postMessage')
.to_return(status: 200, body: '', headers: {})
slack_client = double
@@ -1,6 +1,6 @@
require 'rails_helper'
describe Facebook::SendReplyService do
describe Facebook::SendOnFacebookService do
subject(:send_reply_service) { described_class.new(message: message) }
before do
@@ -1,6 +1,6 @@
require 'rails_helper'
describe Twilio::OutgoingMessageService do
describe Twilio::SendOnTwilioService do
subject(:outgoing_message_service) { described_class.new(message: message) }
let(:twilio_client) { instance_double(::Twilio::REST::Client) }
@@ -1,6 +1,6 @@
require 'rails_helper'
describe Twitter::SendReplyService do
describe Twitter::SendOnTwitterService do
subject(:send_reply_service) { described_class.new(message: message) }
let(:twitter_client) { instance_double(::Twitty::Facade) }
-2
View File
@@ -14,6 +14,4 @@ RSpec.configure do |config|
end
config.shared_context_metadata_behavior = :apply_to_host_groups
# config.include Rails.application.routes.url_helpers
end