Skip to content

RSpec render_component helper #586

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
1 of 4 tasks
antoniusostermann opened this issue Aug 10, 2016 · 3 comments
Closed
1 of 4 tasks

RSpec render_component helper #586

antoniusostermann opened this issue Aug 10, 2016 · 3 comments

Comments

@antoniusostermann
Copy link

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

How do you integrate react-rails into rspec controller tests? In my controller specs, I'd love to have a helper, which would enable sth like:

get :new 
expect(response).to render_component('MyComponent')
@Drowze
Copy link

Drowze commented Jun 17, 2017

I support this request.
In fact, I tried to achieve a similar result but had trouble mocking controller's render method. I do not currently know how to effectively a controller using react-rails custom renderer.

@BookOfGreg
Copy link
Member

Hi,
Been a while since any activity on this thread but trying to get through what I can now.
I'd certainly welcome anyone to submit a PR that adds an Rspec and Minitest helper that could be manually required in, it would be good to have testing helpers that come with the gem, perhaps go so far as to have a test template generated with the components?

@BookOfGreg
Copy link
Member

assert_react_component was added in #957

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants