我正在运行我为控制器创建/搭建的所有测试。我也有test_helper.rb。我安装了以下宝石进行测试:
settings.py
这是我的test_helper.rb文件
104 group :test do
105 gem 'capybara'
106 gem 'vcr', '~> 2.9'
107 gem 'webmock', '~> 2.1'
108 gem 'minitest'
109 gem 'shoulda-matchers'
110 gem 'resque_spec'
111 gem 'stripe-ruby-mock', '~> 2.2.4', require: 'stripe_mock'
112 gem 'rspec_junit_formatter' # for circleci.com
113 gem 'minitest-reporters', '1.0.5'
114 gem 'mini_backtrace', '0.1.3'
115 gem 'guard', '2.14.0'
116 gem 'guard-minitest', '2.3.1'
117 end
我的大多数控制器本身都有:
1 require 'simplecov'
2 SimpleCov.start do #'rails'
3 add_filter '/spec/'
4 add_filter '/config/'
5 add_filter '/lib/'
6 add_filter '/vendor/'
7
8 add_group 'Controllers', 'app/controllers'
9 add_group 'Models', 'app/models'
10 add_group 'Helpers', 'app/helpers'
11 add_group 'Mailers', 'app/mailers'
12 end
13
14 ENV['RAILS_ENV'] ||= 'test'
15 require File.expand_path('../../config/environment', __FILE__)
16 require 'rails/test_help'
17
18 class ActiveSupport::TestCase
19 # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
20 fixtures :all
21
22 # Returns true if a test user is logged in.
23 private
24
25 # Returns true inside an integration test.
26 def integration_test?
27 defined?(post_via_redirect)
28 end
29
30 end
在我的测试/控制器中:
1 module Dashboard
2 class ZoneTypesController < Dashboard::MainDashboardController
当我运行&#34;捆绑exec rake test&#34;时,没有任何显示,没有错误,没有报告通过了多少测试等等。我不知道该怎么做。我还看了关于这个问题的其他堆栈溢出问题,但没有一个能帮助我。
答案 0 :(得分:1)
运行
bundle exec rake test RAILS_ENV=test