Search code examples
ruby-on-railsrubyhamlruby-on-rails-5erb

Using HAML instead of ERB causes tests to fail


This seems very basic, but I'm using Rails 5 and I swapped all of my views to HAML instead of ERB. Now one of my tests is failing saying the following:

ActionController::UnknownFormat: ProductsController#index is missing  a template for this request format and variant.

request.formats: ["text/html"]
request.variant: []
    test/controllers/products_controller_test.rb:9:in `block in <class:ProductsControllerTest>'

Is there anywhere to change the default, or is there another issue I have to address? My routes are fine, and I can access the index page no problem.


Solution

  • You need haml installed, add gem 'haml' to the Gemfile, next bundle install in your console.