testrbl 0.1.13 → 0.1.14

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.1.13)
4
+ testrbl (0.1.14)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
+ require 'bundler/setup'
1
2
  require 'bundler/gem_tasks'
2
3
 
3
4
  task :default do
4
- # tests do not run with test-unit 1 since it defines testrb and overshadows 1.9s native testrb
5
- raise "yes | gem uninstall -a test-unit && bundle" if `gem list test-unit | grep 'test-unit '` =~ /[\( ]1\./
5
+ # tests do not run with test-unit 1.x.x since it defines testrb and overshadows 1.9s native testrb
6
+ if `which testrb`.include?("/gems/")
7
+ raise "tests do not run with test-unit 1.x.x installed\nyes | gem uninstall -a test-unit && bundle"
8
+ end
6
9
 
7
10
  sh "rspec spec/"
8
11
  end
@@ -1,3 +1,3 @@
1
1
  module Testrbl
2
- VERSION = '0.1.13'
2
+ VERSION = '0.1.14'
3
3
  end
data/lib/testrbl.rb CHANGED
@@ -80,28 +80,28 @@ module Testrbl
80
80
 
81
81
  def self.pattern_from_line(line)
82
82
  PATTERNS.each do |r|
83
- if line =~ r
84
- whitespace, method, test_name = $1, $2, $3
85
- regex = Regexp.escape(test_name).gsub("'",".").gsub("\\ "," ").gsub(INTERPOLATION, ".*")
86
-
87
- if method == "should"
88
- optional_test_name = "(?:\(.*\))?"
89
- regex = "#{method} #{regex}\. #{optional_test_name}$"
90
- elsif method == "test"
91
- # test "xxx -_ yyy"
92
- # test-unit: "test: xxx -_ yyy"
93
- # activesupport: "test_xxx_-__yyy"
94
- regex = "^test(: |_)#{regex.gsub(" ", ".")}$"
95
- elsif method == "it"
96
- regex = "^test_\\d+_#{test_name}$"
97
- end
98
-
99
- return [
100
- whitespace,
101
- regex
102
- ]
103
- end
83
+ next unless line =~ r
84
+ whitespace, method, test_name = $1, $2, $3
85
+ return [whitespace, pattern_from_match(method, test_name)]
104
86
  end
105
87
  nil
106
88
  end
89
+
90
+ def self.pattern_from_match(method, test_name)
91
+ regex = Regexp.escape(test_name).gsub("\\ "," ").gsub(INTERPOLATION, ".*")
92
+
93
+ if method == "should"
94
+ optional_test_name = "(?:\(.*\))?"
95
+ regex = "#{method} #{regex}\. #{optional_test_name}$"
96
+ elsif method == "test"
97
+ # test "xxx -_ yyy"
98
+ # test-unit: "test: xxx -_ yyy"
99
+ # activesupport: "test_xxx_-__yyy"
100
+ regex = "^test(: |_)#{regex.gsub(" ", ".")}$"
101
+ elsif method == "it"
102
+ regex = "^test_\\d+_#{test_name}$"
103
+ end
104
+
105
+ regex.gsub("'", ".")
106
+ end
107
107
  end
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.1.13
4
+ version: 0.1.14
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: 2012-09-16 00:00:00.000000000 Z
12
+ date: 2012-09-24 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: 1427861218457478477
47
+ hash: -4319690681910845518
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: 1427861218457478477
56
+ hash: -4319690681910845518
57
57
  requirements: []
58
58
  rubyforge_project:
59
59
  rubygems_version: 1.8.24