testrbl 0.3.2 → 0.3.3

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testrbl (0.3.2)
4
+ testrbl (0.3.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module Testrbl
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
data/lib/testrbl.rb CHANGED
@@ -36,13 +36,13 @@ module Testrbl
36
36
  def self.pattern_from_file(lines, line)
37
37
  possible_lines = lines[0..(line.to_i-1)].reverse
38
38
 
39
- last_spaces = " " * 100
40
- found = possible_lines.map { |line| test_pattern_from_line(line) }.compact
39
+ found = possible_lines.map { |line| test_pattern_from_line(line) || block_start_from_line(line) }.compact
41
40
 
42
41
  # pattern and the groups it is nested under (like describe - describe - it)
42
+ last_spaces = " " * 100
43
43
  patterns = found.select do |spaces, name|
44
44
  last_spaces = spaces if spaces.size < last_spaces.size
45
- end.map(&:last)
45
+ end.map(&:last).compact
46
46
 
47
47
  return filter_duplicate_final(patterns).reverse.join(".*") if found.size > 0
48
48
 
@@ -117,6 +117,12 @@ module Testrbl
117
117
  Kernel.exec *command
118
118
  end
119
119
 
120
+ def self.block_start_from_line(line)
121
+ if line =~ /^(\s*).* do( \|.*\|)?$/
122
+ [$1, nil]
123
+ end
124
+ end
125
+
120
126
  def self.test_pattern_from_line(line)
121
127
  PATTERNS.each do |r|
122
128
  next unless line =~ r
data/spec/testrbl_spec.rb CHANGED
@@ -512,6 +512,14 @@ describe Testrbl do
512
512
  it "does not find nested it calls" do
513
513
  @result = call(" context \"xxx\" do\n it \"yyy\" do\n if true do\n it \"zzz\" do\n", 4)
514
514
  end
515
+
516
+ it "does not find nested non-test blocks" do
517
+ @result = call(" context \"yyy\" do\n end\n blub do\n context \"xxx\" do\n it \"zzz\" do\n", 5)
518
+ end
519
+
520
+ it "does not find nested non-test blocks" do
521
+ @result = call(" context \"yyy\" do\n end\n blub do\n context \"xxx\" do\n it \"zzz\" do\n end\n end\n end\n", 8)
522
+ end
515
523
  end
516
524
 
517
525
  describe ".test_pattern_from_line" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrbl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-30 00:00:00.000000000 Z
12
+ date: 2013-07-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: michael@grosser.it
@@ -44,7 +44,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
44
44
  version: '0'
45
45
  segments:
46
46
  - 0
47
- hash: -3635273838218329948
47
+ hash: -949188406167445610
48
48
  required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: -3635273838218329948
56
+ hash: -949188406167445610
57
57
  requirements: []
58
58
  rubyforge_project:
59
59
  rubygems_version: 1.8.25