Rails 4.2.2-Windows 7/没有测试结果显示git Bash: bundle exec guard



一切都好,除了,
当我运行

$ bundle exec guard 

我不能看到测试结果,当我运行:

$ bundle exec rake test 


每次编辑文件时都会发生这种情况。

02:28:43 - INFO - Run 'gem install win32console' to use color on Windows
02:28:44 - INFO - Guard::Minitest 2.3.1 is running, with Minitest::Unit 5.7.0!
02:28:44 - INFO - Running: all tests
←]2;[Minitest results] Running: all tests
[1] guard(main)>  Guard is now watching at 'c:/row/dev1/sample_app'
02:29:08 - INFO - Running: test/controllers/static_pages_controller_test.rb
[1] guard(main)> ults] Running: test/controllers/static_pages_controller_test.rb

但是我不能看到测试结果,当我运行

$ bundle exec rake test

输出为

ansi: 'gem install win32console' to use color on Windows
Started
 FAIL["test_should_get_home", StaticPagesControllerTest, 2015-07-12 12:20:51 -0700]
 test_should_get_home#StaticPagesControllerTest (1436728851.31s)
    <Home | Ruby on Rails Tutorial Sample App> expected but was
    <| Ruby on Rails Tutorial Sample App>..
    Expected 0 to be >= 1.
    test/controllers/static_pages_controller_test.rb:7:in `block in <class:StaticPagesControllerTest>    
3/3: [===================================] 100% Time: 00:00:00, Time: 00:00:00
Finished in 0.37550s
3 tests, 6 assertions, 1 failures, 0 errors, 0 skips
02:54:47 - INFO - Run 'gem install win32console' to use color on Windows
←]2;[Minitest results] 3 tests

我无法看到我有一个错误,虽然测试似乎正在运行…还是我错过了什么?

这是我的guard文件

# Defines the matching rules for Guard.
guard :minitest, spring: true, all_on_start: true do
  watch(%r{^test/(.*)/?(.*)_test.rb$})
  watch('test/test_helper.rb') { 'test' }
  watch('config/routes.rb')    { integration_tests }
  watch(%r{^app/models/(.*?).rb$}) do |matches|
    "test/models/#{matches[1]}_test.rb"
  end
  watch(%r{^app/controllers/(.*?)_controller.rb$}) do |matches|
    resource_tests(matches[1])
  end
  watch(%r{^app/views/([^/]*?)/.*.html.erb$}) do |matches|
    ["test/controllers/#{matches[1]}_controller_test.rb"] +
    integration_tests(matches[1])
  end
  watch(%r{^app/helpers/(.*?)_helper.rb$}) do |matches|
    integration_tests(matches[1])
  end
  watch('app/views/layouts/application.html.erb') do
    'test/integration/site_layout_test.rb'
  end
  watch('app/helpers/sessions_helper.rb') do
    integration_tests << 'test/helpers/sessions_helper_test.rb'
  end
  watch('app/controllers/sessions_controller.rb') do
    ['test/controllers/sessions_controller_test.rb',
     'test/integration/users_login_test.rb']
  end
  watch('app/controllers/account_activations_controller.rb') do
    'test/integration/users_signup_test.rb'
  end
  watch(%r{app/views/users/*}) do
    resource_tests('users') +
    ['test/integration/microposts_interface_test.rb']
  end
end
# Returns the integration tests corresponding to the given resource.
def integration_tests(resource = :all)
  if resource == :all
    Dir["test/integration/*"]
  else
    Dir["test/integration/#{resource}_*.rb"]
  end
end
# Returns the controller tests corresponding to the given resource.
def controller_test(resource)
  "test/controllers/#{resource}_controller_test.rb"
end
# Returns all tests for the given resource.
def resource_tests(resource)
  integration_tests(resource) << controller_test(resource)
end
这是我的gemfile
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# Use SCSS for stylesheets
gem 'sass-rails', '5.0.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.5.3'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '4.1.0'
# Use jquery as the JavaScript library
gem 'jquery-rails', '4.0.3'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '2.2.3'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'turbolinks', '2.3.0'
group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
   gem 'byebug', '3.4.0'
   gem 'sqlite3', '1.3.10'
   gem 'web-console', '2.2.1'
   gem 'spring', '1.1.3'
   gem 'tzinfo-data'
end
# adding group for postgresql production
group :production do
    gem 'pg', '0.17.1'
    gem 'rails_12factor', '0.0.2'
end
group :test do
    gem 'minitest-reporters', '1.0.5'
    gem 'mini_backtrace', '0.1.3'
    gem 'guard-minitest', '2.3.1'
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
end

从我的应用程序的根目录,我运行:

bundle exec guard init
然后进入
bundle exec guard

有什么想法吗?我还需要宝石吗?还是我不明白什么?非常感谢!

起初我以为你错过了wdm,但事实并非如此。安装wdm gem后,我的输出从与您的相同变为以下内容:

$ bundle exec guard
20:02:44 - INFO -运行'gem install win32console'在Windows上使用颜色
20:02:46 - INFO - Guard::Minitest 2.3.1正在运行,Minitest::Unit 5.8.3!
[1] guard(main)> guard现在正在监视'c:/Users/GeoffRuby/Desktop/sample_app'

20:02:59 - INFO - Running: test/controllers/static_pages_controller_test.rb
[1]警卫队(主要)>

您可以看到guard命令行中的错误输出消失了。我将与wdm创建者讨论,希望我们能得到一些答案。

最新更新