Rspec 3.7.0在规范套件中显示Puma日志

时间:2017-10-25 09:21:37

标签: ruby-on-rails rspec rspec-rails

我刚刚将Rspec从3.6.0升级到3.7.0,将rspec-rails从3.6.1升级到3.7.1。我在rails 5.1应用程序中使用这些库。

自此升级以来,这在我的规范套件中发生:

enter image description here

它没有与特定规格相关联,而是在随机位置显示。

在rspec配置中看起来有些变化,但我无法在更改日志中找到它。

1 个答案:

答案 0 :(得分:1)

解决方案来自github问题:https://github.com/rspec/rspec-rails/issues/1897

解决方案是将以下行添加到rails_helper:

function dw_custom_rewrite_rules() {
    add_rewrite_endpoint( 'sortby', EP_ALL_ARCHIVES );

    add_rewrite_rule('^shop/discounted?', 'index.php?post_type=product&sortby=discounts', 'top');

    // With pagination
    add_rewrite_rule('^shop/discounted/page/?([0-9]{1,})/?$', 'index.php?post_type=product&sortby=discounts&paged=$matches[1]', 'top');

}
add_action('init', 'dw_custom_rewrite_rules');