浏览:350 2008-06-14 11:55 来自 【组长】mill2002      :
在测试删除作者里:
   def test_destroy
      ...
      assert_redirected_to :action => 'index'
      follow_redirect
      assert_tag :tag => 'div', :attributes => {:id => 'notice'},
          :content => 'Successfully deleted author Joel Spolsky'
   end

接下来,检验这个index页面上是否有一个div标签,其中包含正确的闪存信息.
已在(app/views/layouts/application.rhtml)中包含了(因为这样所有的视图都可以用到):
 <body>
    <% if flash[:notice] %>
    <div id="notice">
      <%= flash[:notice] %>
    </div>
    <% end %>
    <%= "<h1>#{@page_title}</h1>" if @page_title %>
    <%= yield %>
  </body>
但仍出错:
'expected tag,but no tag found matching {:content =>"Successfully deleted author Joel Spolsky", :attributes=>{:id=>"notice"}, :tag="div"}'
为什么呢?


收藏 楼主

注册用户登录后才能回复,登录注册
> 返回“在线RoR开发与部署环境heroku”


其他话题

相关内容

相关链接
1 897