グループを定義し、各グループに異なる rspec 構成を含めることができます。
以下のコードを のコンテンツに追加します/Guardfile
。
scope group: :fast
group :fast do
guard 'rspec', cli: '--tag ~slow' do
# code for watching
end
end
group :slow do
guard 'rspec', cli: '--tag slow' do
# code for watching
end
end
Guard を起動すると、デフォルトで fast 仕様になります。
$ guard
21:56:35 - INFO - Guard::RSpec is running
21:56:35 - INFO - Guard is now watching at '/Users/michi/testproject'
[1] {Fast} guard(main)>
Enter キーを押すと、すべての高速スペックが実行されます。
22:02:00 - INFO - Run Fast
22:02:00 - INFO - Running all specs
Run options: exclude {:slow=>true}
を押すと、すべての遅いものだけを実行できますslow
。
[2] {Fast} guard(main)> slow
22:02:50 - INFO - Run Slow
22:02:50 - INFO - Running all specs
Run options: include {:slow=>true}
スコープを遅い仕様に切り替えて、Enter キーを押してすべてを実行することもできます。
[3] {Fast} guard(main)> scope slow
[4] {Slow} guard(main)>
22:03:30 - INFO - Run Slow
22:03:30 - INFO - Running all specs
Run options: include {:slow=>true}
それが役立つことを願っています!