I’m getting this error thats moaning about expected tag, but no tag
found matching {:content=>“User James Apps was successfully created.”,
:attributes=>{:id=>“notice”}, :tag=>“div”} in the file application.rb.
I tried using a regular expression - /#{user.first_name}/ , but that
wouldn’t work either
user_controller_test.rb
- Failure:
test_create(Admin::UserControllerTest)
[/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:102:in
assert_tag' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:99:in
clean_backtrace’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:99:in
assert_tag' test/functional/admin/user_controller_test.rb:49:in
test_create’
test/functional/admin/user_controller_test.rb:40:in
assert_difference' test/functional/admin/user_controller_test.rb:40:in
test_create’]:
expected tag, but no tag found matching {:content=>“User James Apps was
successfully created.”, :attributes=>{:id=>“notice”}, :tag=>“div”} in:
“\n<html
xmlns="http://www.w3.org/1999/xhtml\”>\n\n<meta
http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/>\nView Users\n<link
href="/stylesheets/dissertation.css?1174589813" media="screen"
rel="Stylesheet" type="text/css" />\n\n\n\n<div
id="header">\n\t<div id="metaNav">\n\t <ul id="nav1">\n\t
View Users
\n\nView Users
\nFrom here you can view the users in the system.
\n\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n \n \n \n\n \n \n \n\n \n \n \n\n \n \n \n\nName | Edit | Delete |
---|---|---|
James Apps | Edit | \n |
Mark Faulkner | Edit | \n |
Andy Jardine | Edit | \n |
James Apps | Edit | \n |
News
\t\n\t\t\tTest, Test, Test, Test
\n\tProjects
\n\t\t- \n\t\t
- \n\t\t
- \n\t\t
- \n\t\t
user_controller.rb
- def create
-
# Created a user object rom the request parameters sent from
the form on the new page.
3. @user = User.new(params[:user])
4. if @user.save
5. # If user is valid then save and create a flash message then
redirect to a page that lists the users
6. flash[:notice] = “User #{@user.name} was successfully
created.”
7. redirect_to :action => ‘index’
8. else
9. # If user couldn’t be saved (due to failing the validations)
then the new page is rendered again.
10. @page_title = ‘Create new user’
11. render :action => ‘new’
12. end
13. end
application.rb
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
2.
3.
4.
5. <%= @page_title || ‘Dissertation’ -%>
6. <%= stylesheet_link_tag “dissertation” %>
7.
8.
9.
10.
11.
18. <%= “
#{@page_title}
” if @page_title -%>19.
26.
27.
28.
29. <% if flash[:notice] -%>
30.
31. <% flash[:notice] -%>
32.
33. <% end -%>
34. <%= yield -%>
35.
36.
37.
38.
39.
40.
News
41.
Test, Test, Test, Test
42.
43.
44.
45.
Projects
46.
-
48. -
49. -
50.
47.
51.
52.
53.
54.
55.
56.
57.
58.
59.