-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello all,
I’ve just gotten started using BDD with RSpec/Cucumber/Webrat and
Rails and I’ve run into some frustration trying to get my view spec to
pass.
First of all, I am running Ruby 1.9.1p129 with Rails 2.3.2, RSpec and
RSpec-Rails 1.2.6, Cucumber 0.3.11, and Webrat 0.4.4.
Here is the code relevant to my question
config/routes.rb:
map.b_posts 'backend/posts',
:controller => 'backend/
posts’,
:action => ‘backend_index’,
:conditions => { :method
=> :get }
map.connect 'backend/posts',
:controller => 'backend/
posts’,
:action => ‘create’,
:conditions => { :method
=> :post }
views/backend/posts/create.html.erb:
<% form_tag do %>
<% end %>
spec/views/backend/posts/create.html.erb_spec.rb:
describe "backend/posts/create.html.erb" do
it "should render a form to create a post" do
render "backend/posts/create.html.erb"
response.should have_selector("form", :method =>
‘post’, :action => b_posts_path) do |form|
# Nothing here yet.
end
end
end
Here is the relevant part of the output when I run script/spec:
‘backend/posts/create.html.erb should render a form to create a post’
FAILED
expected following output to contain a tag:
It would appear to me that what have_selector is looking for is
exactly what the template generates, yet the example still fails. I am
very much looking forward to seeing my error (because I have a feeling
it is my error). Any help is much appreciated!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAko/+XMACgkQaSfff6Oi7PgTrACfdLx7gDTgYZUT8vc+CVuzuSVg
JoUAnRuSVqaM2Ag4orIQAv3gAZpqrDB7
=G8v7
-----END PGP SIGNATURE-----