Skip to content

Commit

Permalink
added broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
eacaps committed Jul 21, 2016
1 parent 610906e commit 05d3144
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/helpers/react_on_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ def initialize_redux_stores
# second parameter passed to both component and store generator functions.
def rails_context(server_side:)
@rails_context ||= begin
result = {}
unless request.nil?
# result = {}
# unless request.nil?
# Using Addressable instead of standard URI to better deal with
# non-ASCII characters (see https://github.com/shakacode/react_on_rails/pull/405)
uri = Addressable::URI.parse(request.original_url)
Expand All @@ -365,11 +365,11 @@ def rails_context(server_side:)
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)
result.merge!(custom_context) if custom_context
end
# end
# if ReactOnRails.configuration.rendering_extension
# custom_context = ReactOnRails.configuration.rendering_extension.custom_context(self)
# result.merge!(custom_context) if custom_context
# end
result
end

Expand Down
9 changes: 9 additions & 0 deletions spec/dummy/app/mailers/dummy_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DummyMailer < ActionMailer::Base
add_template_helper(ReactOnRailsHelper)
default from: 'nobody@nope.com'
# layout 'mailer'

def hello_email
mail(to: 'otherperson@nope.com', subject: "you've got mail")
end
end
3 changes: 3 additions & 0 deletions spec/dummy/app/views/dummy_mailer/hello_email.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Someone emailed this to you:

<%= react_component("HelloWorld", props: {}, prerender: true) %>
7 changes: 7 additions & 0 deletions spec/dummy/spec/requests/server_render_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@
end
end

describe "server render mailer" do
it 'sends email okay' do
mail = DummyMailer.hello_email
expect(mail.subject).to match 'mail'
end
end

describe "server rendering railsContext" do
let(:http_accept_language) { "en-US,en;q=0.8" }

Expand Down

0 comments on commit 05d3144

Please sign in to comment.