1

我从 Rails 3.2 开始,我有一些关于单元测试的问题。我不了解 minitest 框架和测试单元框架。它们是两个独立的东西还是 minitest 是测试单元的扩展?我应该使用哪个?我正在使用 Rubymine,在尝试运行单元测试时遇到了一些奇怪的错误。最后我添加了 gem 'test-unit' 然后它突然工作了,但我不明白为什么。

这是我的一些 gem 文件:

gem 'test-unit'

group :test do
  if RUBY_PLATFORM =~ /(win32|w32)/
    gem "win32console", '1.3.0'
  end
  gem "minitest"
  gem "minitest-reporters", '>= 0.5.0'
end

这是 test_helper

ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/reporters'
MiniTest::Reporters.use!

class ActiveSupport::TestCase
  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all

  # Add more helper methods to be used by all tests here...
end

有人可以解释这一切是什么吗?

4

0 回答 0