Add test for class_name in EmbedController

This commit is contained in:
Pat David 2017-05-11 13:08:45 -05:00 committed by Robin Ward
parent b7d16de914
commit 10f2db67ba

View File

@ -108,7 +108,7 @@ describe EmbedController do
before do
Fabricate(:embeddable_host)
Fabricate(:embeddable_host, host: 'http://discourse.org')
Fabricate(:embeddable_host, host: 'https://example.com/1234')
Fabricate(:embeddable_host, host: 'https://example.com/1234', class_name: 'example')
end
context "success" do
@ -130,6 +130,12 @@ describe EmbedController do
expect(response).to be_success
end
it "contains custom class name" do
controller.request.stubs(:referer).returns("https://example.com/some-other-path")
get :comments, embed_url: embed_url
expect(assigns(:embeddable_css_class)).to eq(' class="example"')
end
it "doesn't work with a made up host" do
controller.request.stubs(:referer).returns("http://codinghorror.com/invalid-url")
get :comments, embed_url: embed_url