Reputation: 4964
My Rails application has installed the guard-zeus
and rspec-rails
gems.
My Guardfile
has the default watch code generated by guard init zeus
I run guard
. When I save a file, specs in that file run correctly.
However, when I press return in the guard
console, I expect it to run the entire test suite. It attempts to do so, but throws Couldn't find test file 'rspec'
If I start zeus
on its own (without guard), I can zeus start
and then zeus rake
successfully.
I can't figure out what "rspec" file guard
is looking for. This is my Guardfile:
guard 'zeus' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
end
I've tried specifying the cmd: bundle exec rake
in the guard block.
Additional info:
custom_plan.rb
looks like this:
require 'zeus/rails'
class CustomPlan < Zeus::Rails
# def my_custom_command
# # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
# end
end
Zeus.plan = CustomPlan.new
and zeus.json
looks like this:
{
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {"rake": []},
"console": ["c"],
"server": ["s"],
"generate": ["g"],
"destroy": ["d"],
"dbconsole": []
},
"test_environment": {
"test_helper": {"test": ["rspec"]}
}
}
}
}
}
Upvotes: 1
Views: 376
Reputation: 521
Would you mind trying this, please?
guard 'zeus', :rspec => true, :bundler => true do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
end
Please also paste in the contents of zeus.json
and custom_plan.rb
.
If you're missing either of those files, please run zeus init
. This will create zeus.json
and custom_plan.rb
.
Then, edit zeus.json to include only the tasks for which you’ll use Zeus. Mine looks like this:
{
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {"rake": []},
"runner": ["r"],
"console": ["c"],
"server": ["s"],
"generate": ["g"],
"destroy": ["d"],
"dbconsole": []
},
"test_environment": {
"test_helper": {"test": ["rspec"]}
}
}
}
}
}
Upvotes: 1