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