Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4634

No route matches {:controller=>"..", :view=>nil} error in view spec

$
0
0

I am trying to write view spec I have for a partial. It is located on the path app/views/lecturers/science/_table.html.erb and the spec is laid out like so on spec/views/lecturers/science/_table.html.erb_spec...

RSpec.describe "lecturers/science/_table" do# My spec hereend 

Whenever I try to run the spec though, I get this error...

ActionController::UrlGenerationError:No route matches {:controller=>"lecturers/science", :view=>nil}

I have my route for lecturers set up like so...

    namespace :lecturers do      resources :science, only: :index      resources :humanities, only: :index...    end

My index page is set up like so...

<%= title do %><h3>Science Department Lecturers</h3><% end %><%= section_content do %><div id="contents"><%= render "table" %></div><% end %>

I have hunted around, but I could only find cases in which it appeared on controller specs, and I couldn't find any error messages that reported view => nil back. No obvious routing errors appear when I locate the page on the app, and the partial render is fine. I also have similar partial view specs in the code, which seem to work fine. I have double-checked the route, but it seems to match up so I am really at a loss with what is happening.


Viewing all articles
Browse latest Browse all 4634

Latest Images

Trending Articles



Latest Images