If you're seeing spec failures, e.g.
FooController PUT update when unsuccessful renders edit' FAILED expected "edit", got nil
It's likely due to rspec-rails and how it's isolating the templates in order to test them. The following monkey patch resolves this: (courtesy of the Rails LTS maintainers.) You need to ensure this is included in your controller specs
module Spec
  module Rails
    module Example
      class ControllerExampleGroup
        module TemplateIsolationExtensions
        
          private
          def record_render(opts)
            return unless @_rendered
            @_rendered[:template] ||= opts[:file] if opts[:file]
            @_rendered[:template] ||= opts[:file_in_view_path] if opts[:file_in_view_path]
            @_rendered[:partials][opts[:partial]] += 1 if opts[:partial]
          end
          
        end
      end
    end
  end
end
Posted by Andy Henson to Foxsoft (2016-03-02 10:12)