rspeck 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/lib/finder.rb +8 -10
  2. data/lib/parsor.rb +1 -1
  3. data/lib/runner.rb +3 -1
  4. metadata +1 -1
data/lib/finder.rb CHANGED
@@ -7,19 +7,17 @@ module Spectr
7
7
  raise 'ack[-grep] not found!'
8
8
  end
9
9
 
10
- def find(pattern)
11
- results = `#{detect_finder} \"#{pattern}\" spec/ --ruby`
10
+ def find(pattern, path)
11
+ regex = /(\W|\A)it\W.*#{pattern}/
12
+ results = `#{detect_finder} \"#{regex}\" #{path} --ruby`
12
13
 
13
- results.split(/\n/).inject([]) do |acc, line|
14
- match = line.split(/:/).map(&:strip).map(&:chomp)
15
- /"(.+)"/ =~ match[2]
14
+ results.split(/\n/).map do |line|
15
+ parts = line.split(/:/).map(&:chomp).map(&:strip)
16
16
 
17
- acc.push({
18
- :file => match[0],
19
- :line => match[1],
20
- :spec => $1 })
17
+ { :file => parts[0],
18
+ :line => parts[1],
19
+ :spec => parts[2] }
21
20
  end
22
21
  end
23
22
  end
24
-
25
23
  end
data/lib/parsor.rb CHANGED
@@ -6,7 +6,7 @@ module Spectr
6
6
  ARGUMENTS = ['--help', '-h', GetoptLong::NO_ARGUMENT]
7
7
 
8
8
  def print_help
9
- puts 'spectr "test filter"'
9
+ puts 'rspeck "example matcher" [DIRECTORY...]'
10
10
  end
11
11
 
12
12
  def parse(args)
data/lib/runner.rb CHANGED
@@ -16,7 +16,9 @@ module Spectr
16
16
  exit 1
17
17
  end
18
18
 
19
- matches = find(args.first)
19
+ path = args[1] || 'spec/'
20
+
21
+ matches = find(args.first, path)
20
22
 
21
23
  matches.each do |match|
22
24
  puts "## testing #{match[:file]}:#{match[:line]} ##".yellow
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspeck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: