[rspec-users] Error Testing a view in RSpec 2

Rafael Felix felix.rafael at gmail.com
Tue Oct 12 19:38:46 EDT 2010


Well, I'be looking for test my views with rspec, looking the
documentation at http://rspec.info/rails/writing/views.html we see
some examples, in RSpec 2 the response was deprecated and now I'm
using the rendered instead, but this code

describe "tags/search.html.erb" do
  it "should be have an p when no company for the tag was found" do
    assigns[:name] = "Teste"
    render
    rendered.should have_tag('h4', "Visualizando empresas pela Tag
Teste")
  end
end

and I get :


Failures:
  1) tags/search.html.erb should be have an p when no company for the
tag was found
     Failure/Error: rendered.should have_tag('h4', "Visualizando
empresas pela Tag Teste")
     undefined method `has_tag?' for #<String:0x7f45cc59a880>
     # ./spec/views/tags/search.html.erb_spec.rb:9

I don't know what method we use to check my views?

thanks for all
regards


More information about the rspec-users mailing list