0
我不知道爲什麼這不起作用。我使用「rails g test_unit:model」在Rails 4.2.0應用程序中生成了一個模型測試,而「rake test」什麼都不做。爲什麼我的Rails 4.2.0測試不能運行?
$ rake test
下面是測試的目錄結構/(我也有不知道爲什麼沒有產生test_helper.rb
,我也不知道如何產生的呢。)
$ find test
test
test/models
test/models/domain_test.rb
我測試的內容:
$ more test/models/domain_test.rb
require 'test_helper'
class DomainTest < ActiveSupport::TestCase
test "URL gets transformed into domain" do
domain = Domain.create("http://google.com/")
expected = "google.com"
assert expected, domain.name, "domain name could not be extracted from URL"
end
end
我的Rakefile:
$ more Rakefile
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks