3.6
3.6.1 minitest reporters
見やすくなるらしい
REDになってないとありがたみがないなあ
3.6.2 Guard
初期化する
> bundle exec guard init 00:16:27 - INFO - Writing new Guardfile to /Users/tambara/study/rails_study/sample_app/Guardfile 00:16:27 - INFO - minitest guard added to Guardfile, feel free to edit it
Guardfileを修正する。3.45のソースに置き換える。
ついでに、テストをわざと失敗するようにしておく。
実行する。
> bundle exec guard 00:57:23 - INFO - Guard::Minitest 2.4.4 is running, with Minitest::Unit 5.10.3! 00:57:23 - INFO - Guard is now watching at '/Users/tambara/study/rails_study/sample_app' /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/guard-2.13.0/lib/guard/jobs/pry_wrapper.rb:279: warning: method Pry#input_array is deprecated. Use Pry#input_ring instead [1] guard(main)> 00:57:25 - INFO - Run all 00:57:25 - INFO - Running: all tests /Users/tambara/study/rails_study/sample_app/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/tambara/study/rails_study/sample_app/config/application.rb to limit the frameworks that will be loaded. Started with run options --seed 652 FAIL["test_should_get_contact", StaticPagesControllerTest, 0.5823930000187829] test_should_get_contact#StaticPagesControllerTest (0.58s) <Cantact | Ruby on Rails Tutorial Sample App> expected but was <Contact | Ruby on Rails Tutorial Sample App>.. Expected 0 to be >= 1. test/controllers/static_pages_controller_test.rb:35:in `block in <class:StaticPagesControllerTest>' 5/5: [=============================================================================================================================] 100% Time: 00:00:00, Time: 00:00:00 Finished in 0.61163s 5 tests, 10 assertions, 1 failures, 0 errors, 0 skips /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/guard-2.13.0/lib/guard/jobs/pry_wrapper.rb:279: warning: method Pry#input_array is deprecated. Use Pry#input_ring instead
実行させた。失敗してる。
ここでファイルを正しくして保存すると、勝手にテストが走る。
00:57:44 - INFO - Running: test/controllers/static_pages_controller_test.rb /Users/tambara/study/rails_study/sample_app/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/tambara/study/rails_study/sample_app/config/application.rb to limit the frameworks that will be loaded. Started with run options --seed 38941 5/5: [=============================================================================================================================] 100% Time: 00:00:00, Time: 00:00:00 Finished in 0.54086s 5 tests, 10 assertions, 0 failures, 0 errors, 0 skips /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/guard-2.13.0/lib/guard/jobs/pry_wrapper.rb:279: warning: method Pry#input_array is deprecated. Use Pry#input_ring instead [1] guard(main)>
おおー、便利だ・・・。