Hi all,
I got some problems with my integration test. I have a form were a new
user can sign up. If the form is blank and submitted the normal error
occur. The error div has an id “error_explanation”. In my integration
test i try to match it but the test is always red. Here some Code:
encoding : utf-8
require ‘spec_helper’
describe “Users” do
describe “signup” do
describe “failure” do
it "should not make a new user" do
lambda do
visit registrieren_path
fill_in "Benutzername", :with => ""
fill_in "Email", :with => ""
fill_in "Passwort", :with => ""
fill_in "Passwort besttigen", :with => ""
click_button
response.should render_template('users/new')
response.should have_selector("div", :id =>
“error_explanation”)
end.should_not change(User, :count)
end
end
end
end
Here is the error:
expected following output to contain a
…
and the whole html output.
I checked my output and the strange thing is that i even can’t find the
form in the output. It looks like the test is checking the index page
instead of the one tried to reach with the visit registrieren_path.
I’m using Rspec Rails v.2.7.0 with Webrat 0.7.3
Hope someone got a hint for me
Best regards
Greg