A platform for community discussion. Free, open, simple.
Add test case for topic embed CSS
OsamaSayegh4a9dadb646d8
diff --git a/spec/requests/embed_controller_spec.rb b/spec/requests/embed_controller_spec.rbindex f6cb42e88cf..f7f5c11eee7 100644--- a/spec/requests/embed_controller_spec.rb+++ b/spec/requests/embed_controller_spec.rb@@ -71,19 +71,43 @@ describe EmbedController docontext "with a host" dolet!(:embeddable_host) { Fabricate(:embeddable_host) }+ let(:headers) { { 'REFERER' => embed_url } }++ before do+ SiteSetting.queue_jobs = false+ endit "raises an error with no referer" doget '/embed/comments', params: { embed_url: embed_url }expect(response.body).to match(I18n.t('embed.error'))end- context "success" do- let(:headers) { { 'REFERER' => embed_url } }+ it "includes CSS from embedded_scss field" do+ theme = Theme.create!(name: "Awesome blog", user_id: -1)+ theme.set_default!- before do- SiteSetting.queue_jobs = false- end+ ThemeField.create!(+ theme_id: theme.id,+ name: "embedded_scss",+ target_id: 0,+ type_id: 1,+ value: ".test-osama-15 {\n" + " color: red;\n" + "}\n"+ )++ topic_embed = Fabricate(:topic_embed, embed_url: embed_url)+ post = Fabricate(:post, topic: topic_embed.topic)+ get '/embed/comments', params: { embed_url: embed_url }, headers: headers++ html = Nokogiri::HTML.fragment(response.body)+ css_link = html.at("link[data-target=embedded_theme]").attribute("href").value++ get css_link+ expect(response.status).to eq(200)+ expect(response.body).to include(".test-osama-15")+ end++ context "success" doafter doexpect(response.status).to eq(200)expect(response.headers['X-Frame-Options']).to eq("ALLOWALL")