【发布时间】:2014-10-29 09:02:10
【问题描述】:
我正在尝试使用 MiniTest 为我的 RESTful API 创建功能测试: 需要'test_helper'
class AutomaticTests < ActiveSupport::TestCase
test "test1" do
get '/'
end
end
上面的代码触发了一个错误:
Minitest::UnexpectedError: NoMethodError: undefined method `get' for
我的 test_helper.rb 看起来像这样:
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/rails"
class ActiveSupport::TestCase
fixtures :all
class << self
alias :context :describe
end
end
如何使“get”方法起作用?
【问题讨论】:
标签: ruby-on-rails ruby minitest