forked from chatwoot/chatwoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Internal] Add route for widget testing (chatwoot#199)
- Loading branch information
1 parent
f3fc542
commit 5cc3543
Showing
7 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class WidgetTestsController < ActionController::Base | ||
before_action :set_web_widget | ||
|
||
def index | ||
render | ||
end | ||
|
||
private | ||
|
||
def set_web_widget | ||
@web_widget = Channel::WebWidget.first | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
(function(d,t) { | ||
var BASE_URL = ''; | ||
var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; | ||
g.src= BASE_URL + "/packs/js/sdk.js"; | ||
s.parentNode.insertBefore(g,s); | ||
g.onload=function(){ | ||
window.chatwootSDK.run({ | ||
websiteToken: '<%= @web_widget.website_token %>', | ||
baseUrl: BASE_URL | ||
}) | ||
} | ||
})(document,"script"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'rails_helper' | ||
|
||
describe WidgetTestsController, type: :controller do | ||
let(:channel_widget) { create(:channel_widget) } | ||
|
||
describe '#index' do | ||
it 'renders the page correctly' do | ||
get :index | ||
expect(response.status).to eq 200 | ||
end | ||
end | ||
end |