ruby-on-rails-3 - 如何使用 ActiveSupport 中的 Pending 模块

标签 ruby-on-rails-3 testing activesupport

我似乎无法使 ActiveSupport::Testing 中的 Pending 模块工作。

test/unit/pending.rb 包含:

require 'test_helper'
require 'active_support/testing/pending'

class PendingTest < ActiveSupport::TestCase
  include ActiveSupport::Testing::Pending

  pending "a pending case with a closure" do
     assert false
  end
end

但是当我执行 ruby​​ unit/foo.rb 时,我得到:

undefined method `pending' for PendingTest:Class (NoMethodError)

我查看了 ActiveSupport gem 中 pending.rb 中的代码。挂起的方法在一个 除非定义?(规范) block ,但我确认未定义 Spec。

提前致谢...

最佳答案

pending 方法需要在测试中调用,而不是在类中调用:

test "it works" do
  pending "well, it will eventually"
end

关于ruby-on-rails-3 - 如何使用 ActiveSupport 中的 Pending 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5467481/

相关文章:

ruby-on-rails - RSpec 的让!等效于 ActiveSupport::TestCase

ruby-on-rails - 如何在 Rails 中将当前时间添加 10 天

ruby - 在普通 Ruby 类中使​​用方法回调

ruby-on-rails-3 - Haml 中的元素类

ruby - pg_dump : [archiver (db)] query failed: ERROR: permission denied for relation abouts

testing - 什么样的项目有 Nightly 构建?

database - 应用程序是否应该自测其数据库

ruby-on-rails - 两个数组的交集为空

ruby-on-rails - 设计注册 Controller 的未定义方法 `users_url'

ruby - 随机生成测试数据是一种不好的做法吗?