mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
Add test for class_name in EmbedController
This commit is contained in:
@ -108,7 +108,7 @@ describe EmbedController do
|
|||||||
before do
|
before do
|
||||||
Fabricate(:embeddable_host)
|
Fabricate(:embeddable_host)
|
||||||
Fabricate(:embeddable_host, host: 'http://discourse.org')
|
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
|
end
|
||||||
|
|
||||||
context "success" do
|
context "success" do
|
||||||
@ -130,6 +130,12 @@ describe EmbedController do
|
|||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
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
|
it "doesn't work with a made up host" do
|
||||||
controller.request.stubs(:referer).returns("http://codinghorror.com/invalid-url")
|
controller.request.stubs(:referer).returns("http://codinghorror.com/invalid-url")
|
||||||
get :comments, embed_url: embed_url
|
get :comments, embed_url: embed_url
|
||||||
|
Reference in New Issue
Block a user