# Embedding in more than one host

**URL:** <https://meta.discourse.org/t/embedding-in-more-than-one-host/62002>\
**Category:** Development\
**Created:** [02.Май.2017 22:00:21 UTC](https://meta.discourse.org/t/embedding-in-more-than-one-host/62002 "2017-05-02T22:00:21Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Patrick\_David](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/patrick_david/32/119657_2.png) [@Patrick\_David](https://meta.discourse.org/u/Patrick_David)\
**Post date:** [11.Май.2017 15:49:31 UTC](https://meta.discourse.org/t/embedding-in-more-than-one-host/62002/15 "2017-05-11T15:49:31Z")

</div>

Just an update and a request, if anyone might be able to help.

The patch works and merges fine, but @eviltrout wanted me to add a controller spec that checks for class\_name in the record being viewed, and assigns the `embeddable_css_class` variable for embedding in the template.

I am not having any luck getting it to work despite a great pointer to exactly where I should be looking:

> <https://github.com/discourse/discourse/pull/4857#issuecomment-300542902>
>
> I can give you a strong hint here. If it's not enough posting on meta might be a… good idea!
> 
> Basically, in \*\*spec/controllers/embed\_controller\_spec.rb\*\* you could modify one of the records that are created in the \`"with multiple hosts"\` \`before\` block to include the class name attribute.
> 
> Then in the \`it\` block after the \`get\` has executed, you can add a new line like:
> 
> \`\`\`ruby
> expect(assigns(:embeddable\_css\_class)).to eq('what it should equal')
> \`\`\`

I have modified **spec/controllers/embed\_controller\_spec.rb** down in the context `"with multiple hosts"` so the last call to Fabricator should include a class\_name:

```plaintext
...
Fabricate(:embeddable_host, host: 'https://example.com', class_name: 'example')

```

Following @eviltrout’s guidance, I then added a new test to check, but this is not working. ☹

```plaintext
    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('example')
    end

```

I’m apologize if I’m a little dense, but I could really use a hand here figuring out how to get this last bit working.

---

_[View the full topic](https://meta.discourse.org/t/embedding-in-more-than-one-host/62002)._
