Last active
August 29, 2015 14:23
-
-
Save mfpiccolo/0546c66092e964234f56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard "minitest", all_on_start: false, start_on_start: false do | |
# with Minitest::Spec | |
watch(%r|^test/(.*)_test\.rb$|) | |
watch(%r|^app/(.*)/(.*)\.rb$|) { |m| "test/#{m[1]}/#{m[2]}_test.rb" } | |
watch(%r|^lib/(.*)([^/]+)\.rb$|) { |m| "test/#{m[1]}#{m[2]}_test.rb" } | |
watch(%r|^test/test_helper\.rb$|) { "test" } | |
watch(%r|^test/support/|) { "test" } | |
end | |
# Add SOLO to the `it` description of any spec you want to run. | |
# example use: | |
# | |
# describe SomeClass do | |
# it "does some stuff SOLO" do | |
# assert(true) | |
# end | |
# it "this one doesn't run" do | |
# assert(false) | |
# end | |
# end | |
Guard::Minitest::Runner.module_eval do | |
def ruby_command(paths) | |
if paths.length == 1 | |
path = paths.first | |
file = File.open(path, "rb") | |
contents = file.read | |
end | |
if contents.is_a?(String) && contents.scan(/SOLO/).length > 0 | |
cmd_parts = "ruby -Itest #{path} --name /SOLO/" | |
else | |
cmd_parts = ['ruby'] | |
cmd_parts.concat(generate_includes) | |
cmd_parts << '-r rubygems' if rubygems? | |
cmd_parts << '-r bundler/setup' if bundler? | |
cmd_parts << '-r minitest/autorun' if autorun? | |
cmd_parts.concat(paths.map { |path| "-r ./#{path}" }) | |
cmd_parts << '-e ""' | |
cmd_parts << '--' | |
cmd_parts += cli_options | |
cmd_parts | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment