1ea289e8b7
* feat: Sets up portal public views with rails ERB and tailwind * linter fixes * Remove duplicate style file * Shows articles and categories * Specify layout for articles page * Updates public portal styles * Fixes blog content styles * Portal style updates for article page * Review fixes * Adds breadcrumbs * fix: rspec * fix: public portal spec * Code climate fixes * Adds test cases for missing files * Show only published articles * Updates help center routes * Review fixes * Render markdown content for aticle body * Update app/views/public/api/v1/portals/articles/index.html.erb Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Sojan <sojan@pepalo.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: tejaswini chile <tejaswini@chatwoot.com>
31 lines
1.1 KiB
Ruby
31 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe 'Public Portals API', type: :request do
|
|
let!(:account) { create(:account) }
|
|
let!(:portal) { create(:portal, slug: 'test-portal', account_id: account.id, custom_domain: 'www.example.com') }
|
|
|
|
before do
|
|
create(:portal, slug: 'test-portal-1', account_id: account.id)
|
|
create(:portal, slug: 'test-portal-2', account_id: account.id)
|
|
end
|
|
|
|
describe 'GET /public/api/v1/portals/{portal_slug}' do
|
|
it 'Show portal and categories belonging to the portal' do
|
|
get "/hc/#{portal.slug}/en"
|
|
|
|
expect(response).to have_http_status(:success)
|
|
end
|
|
|
|
it 'Throws unauthorised error for unknown domain' do
|
|
portal.update(custom_domain: 'www.something.com')
|
|
|
|
get "/hc/#{portal.slug}/en"
|
|
|
|
expect(response).to have_http_status(:unauthorized)
|
|
json_response = JSON.parse(response.body)
|
|
|
|
expect(json_response['error']).to eql "Domain: www.example.com is not registered with us. \
|
|
Please send us an email at support@chatwoot.com with the custom domain name and account API key"
|
|
end
|
|
end
|
|
end
|