Skip to content

fix for rspec #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

fix for rspec #367

wants to merge 1 commit into from

Conversation

masarakki
Copy link

in view tests of rspec, we must assign vars by myself.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -83,6 +83,10 @@ class Railtie < ::Rails::Railtie
React::ServerRendering.reset_pool
# Reload renderers in dev when files change
ActionDispatch::Reloader.to_prepare { React::ServerRendering.reset_pool }
if defined? RSpec::Rails
require 'react/rails/test_helper'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it hurt to always require this file? It's not Rspec-specific, right? So we could move it to react/rails.rb along with the other require calls.

Also, if this helper is specific to Rspec, what do you think about calling it RspecHelper instead of TestHelper? I think that expresses its purpose a little bit more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, maybe ViewTestHelper if this also works with Minitest

@rmosolgo
Copy link
Member

rmosolgo commented Oct 9, 2015

Thanks for adding this fix! Could you also add a test for this behavior?

I see that you were using Rspec, but this project uses Minitest. Can you test this behavior by adding an ActionView::TestCase to this project? That would be good because it would make sure that we don't break this in the future!

@masarakki
Copy link
Author

I have no idea to test it without rspec...
Can I add rspec in Appraisal?

@rmosolgo
Copy link
Member

rmosolgo commented Oct 9, 2015

Yes, that would be fine!

@masarakki
Copy link
Author

add rspec tests

@rmosolgo rmosolgo mentioned this pull request Oct 15, 2015
@rmosolgo
Copy link
Member

Hmm, not sure what's wrong with this build.

It turns out this problem is part of a bigger issue. I was able to reproduce the issue using ActionView::TestCase and I've suggested a fix here: #375

Do you want to try that branch? If it works for you, I'll merge it, since I think it also fixes the issue described here: #353 (comment)

in view tests of rspec, we must assign vars by myself.
@masarakki
Copy link
Author

I think it's just a travis's problem...
rebuilding with dummy commit

@rmosolgo
Copy link
Member

Sorry @masarakki , I think this problem was larger than just Rspec tests. It was also broken for:

So, I refactored the helper a bit and used ActionView::TestCase to ensure that the react_component helper could be used these different ways: #375

I prefer that option because it's less code overall and it handles more of those broken cases. Could you check that it works for you, too? I've just released it in version 1.3.3.

@masarakki
Copy link
Author

v1.3.3 works well. great job!!

@masarakki masarakki closed this Oct 21, 2015
@masarakki masarakki deleted the assign-helper-in-rspec branch October 21, 2015 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants