1

I am in the process of upgrading a rails app that mostly serves JSON. The last working version I was able to upgrade to is 4.1. Once I upgraded to 4.2, request specs that produce strange errors in the test log:

Could not log "render_template.action_view" event. NoMethodError: undefined method `render_views?' for #<Class:0x007fe544a2b170>

Somewhere I read that this is due to rails trying to render a view that isn't present. Before the jump to rails 4, we set headers['CONTENT_TYPE'] = 'application/json' and everything was fine. I read that this isn't working anymore with rails 4. I already tried adding format: :json, as suggested here: Set Rspec default GET request format to JSON, which didn't help.

Any help on how to get the specs running again would be greatly appreciated.

Community
  • 1
  • 1
Daniel Becker
  • 771
  • 1
  • 7
  • 25

1 Answers1

7

As it turns out, this error occurs if an include is missing in the rspec config block. Adding

RSpec.configure.include RSpec::Rails::ViewRendering

fixes that issue.

Daniel Becker
  • 771
  • 1
  • 7
  • 25