2019-05-12 22:37:49 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-24 11:13:53 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'Public Controller', type: :request do
|
2017-08-01 15:53:39 -04:00
|
|
|
|
2017-07-24 11:13:53 -04:00
|
|
|
before do
|
|
|
|
SiteSetting.chat_integration_enabled = true
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'loading a transcript' do
|
2017-08-01 15:53:39 -04:00
|
|
|
|
2017-07-24 11:13:53 -04:00
|
|
|
it 'should be able to load a transcript' do
|
2021-07-13 15:36:16 -04:00
|
|
|
key = DiscourseChatIntegration::Helper.save_transcript("Some content here")
|
2017-07-24 11:13:53 -04:00
|
|
|
|
|
|
|
get "/chat-transcript/#{key}.json"
|
|
|
|
|
2018-06-07 20:57:43 -04:00
|
|
|
expect(response.status).to eq(200)
|
2017-07-24 11:13:53 -04:00
|
|
|
|
|
|
|
expect(response.body).to eq('{"content":"Some content here"}')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should 404 for non-existant transcript' do
|
|
|
|
key = 'abcdefghijk'
|
|
|
|
get "/chat-transcript/#{key}.json"
|
|
|
|
|
2018-06-07 20:57:43 -04:00
|
|
|
expect(response.status).to eq(404)
|
2017-07-24 11:13:53 -04:00
|
|
|
end
|
2017-08-01 15:53:39 -04:00
|
|
|
|
2017-07-24 11:13:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|