Skip to content

Commit

Permalink
added inMailer checks for test
Browse files Browse the repository at this point in the history
  • Loading branch information
eacaps committed Jul 25, 2016
1 parent eb6e700 commit e24fb9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers/react_on_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def rails_context(server_side:)
uri = Addressable::URI.parse(request.original_url)
# uri = Addressable::URI.parse("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")

result = {
result.merge!({
# URL settings
href: request.original_url,
location: "#{uri.path}#{uri.query.present? ? "?#{uri.query}" : ''}",
Expand All @@ -365,7 +365,7 @@ def rails_context(server_side:)
i18nLocale: I18n.locale,
i18nDefaultLocale: I18n.default_locale,
httpAcceptLanguage: request.env["HTTP_ACCEPT_LANGUAGE"]
}
})
end
if ReactOnRails.configuration.rendering_extension
custom_context = ReactOnRails.configuration.rendering_extension.custom_context(self)
Expand Down
6 changes: 6 additions & 0 deletions spec/dummy/spec/requests/server_render_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
expect(mail.body).to match "Mr. Mailing Server Side Rendering"
expect(mail.body).to match "inMailer":true"
end

it "sets inMailer properly" do
get client_side_hello_world_path
html_nodes = Nokogiri::HTML(response.body)
expect(html_nodes.css('div#js-react-on-rails-context').attr('data-rails-context').value).to match('inMailer\":false')
end
end

describe "server rendering railsContext" do
Expand Down

0 comments on commit e24fb9f

Please sign in to comment.