Created
July 9, 2018 04:52
-
-
Save suya55/9b59885af90f334507c769b710274e6d to your computer and use it in GitHub Desktop.
rspec by name
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
require 'open3' | |
namespace :test do | |
rule '' do |t| | |
# rake test:league | |
if /test:(.*)(:([^.]+))?$/.match(t.name) | |
arguments = t.name.split(':')[1..-1] | |
file_name = arguments.first | |
path = Dir["spec/**/*#{file_name}*_spec.rb"].join(' ') | |
unless path.strip.empty? | |
puts "=========[ #{path} test result ]=======================================================".colorize(:black).colorize(background: :white) | |
Open3.pipeline_r("rspec --tty --colour #{path}") do |o, _ts| | |
o.each_line do |line| | |
puts(line) | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment