mercredi 6 mai 2015

Rspec missing template error - html+phone.slim (variants) - how to?

I have a view with the following format:

show_map.html+phone.slim

I am testing my controller, expecting my test to render that template , does anyone know the proper syntax for rendering a view with variant ?

This is what I am trying:

describe "show_map action" do 
  it "renders show map view" do 
  get :show_map, {:id=>@job.id,:format=>:html,:variants=>:phone}
  expect(response).to render_template('show_map')
end

also tried

  get :show_map, {:id=>@job.id,:format=>:html.phone}

Either way, I get a missing template error:

 JobsController show_map action renders show map view
     Failure/Error: get :show_map, {:id=>@job.id,:format=>:html,:variants=>:phone}
     ActionView::MissingTemplate:
       Missing template jobs/show_map, application/show_map with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :slim]}

Anyone know how to do this?

Aucun commentaire:

Enregistrer un commentaire