【问题标题】:Integration test fails as the rendering content does not match由于渲染内容不匹配,集成测试失败
【发布时间】:2015-03-15 20:50:57
【问题描述】:

当我登录我的 ruby​​ 应用程序时,第一页 url 是http://localhost:3000/tree_display/list。因此,当我运行测试以断言相同时,我收到了这个错误。

[user1 project]$  rake test
DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:66)
DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:67)
Started

 FAIL["test_login_and_access_bookmarks/managing_bookmarks", BookmarksTest, 0.678676891]
 test_login_and_access_bookmarks/managing_bookmarks#BookmarksTest (0.68s)
        expecting <"tree_display/list"> but rendering with <["content_pages/view", "shared/_header", "shared/_navigation", "auth/_login", "shared/_flash_messages", "shared/_footer_message", "layouts/application"]>
        test/integration/bookmarks_test.rb:15:in `block in <class:BookmarksTest>'

  1/1: [=========================================================================================================] 100% Time: 00:00:00, Time: 00:00:00

Finished in 0.68149s
1 tests, 2 assertions, 1 failures, 0 errors, 0 skips
[user1 project]$  

它正在使用&lt;["content_pages/view", "shared/_header", "shared/_navigation", "auth/_login", "shared/_flash_messages", "shared/_footer_message", "layouts/application"]&gt; 进行渲染。当我输入用户名和密码时,这些应该在第一页,然后我转到http://localhost:3000/tree_display/list

我注意到会话变量包含这个:@host="www.example.com", 这里有什么问题?为什么不渲染 tree_display/list?感谢任何帮助。

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-4 testing integration-testing


    【解决方案1】:

    可能在您的测试中登录失败,或者当您在测试的前一页上断言时登录需要时间。尝试在断言和登录步骤中添加延迟。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多