testrbl 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,3 +7,4 @@ gem 'activesupport', '2.3.14'
7
7
  gem 'rake'
8
8
  gem 'rspec', '~>2'
9
9
  gem 'shoulda'
10
+ gem 'bump'
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testrbl (0.1.16)
4
+ testrbl (0.1.17)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  activesupport (2.3.14)
10
+ bump (0.3.3)
10
11
  diff-lcs (1.1.3)
11
12
  minitest (3.4.0)
12
13
  rake (0.9.2.2)
@@ -30,6 +31,7 @@ PLATFORMS
30
31
 
31
32
  DEPENDENCIES
32
33
  activesupport (= 2.3.14)
34
+ bump
33
35
  minitest
34
36
  rake
35
37
  rspec (~> 2)
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require 'bundler/gem_tasks'
3
+ require 'bump/tasks'
3
4
 
4
5
  task :default do
5
6
  # tests do not run with test-unit 1.x.x or <=2.3 since it defines testrb and overshadows 1.9s native testrb
@@ -9,20 +10,3 @@ task :default do
9
10
 
10
11
  sh "rspec spec/"
11
12
  end
12
-
13
- # extracted from https://github.com/grosser/project_template
14
- rule /^version:bump:.*/ do |t|
15
- sh "git status | grep 'nothing to commit'" # ensure we are not dirty
16
- index = ['major', 'minor','patch'].index(t.name.split(':').last)
17
- file = 'lib/testrbl/version.rb'
18
-
19
- version_file = File.read(file)
20
- old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
21
- version_parts[index] = version_parts[index].to_i + 1
22
- version_parts[2] = 0 if index < 2 # remove patch for minor
23
- version_parts[1] = 0 if index < 1 # remove minor for major
24
- new_version = version_parts * '.'
25
- File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
26
-
27
- sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
28
- end
@@ -1,3 +1,3 @@
1
1
  module Testrbl
2
- VERSION = '0.1.16'
2
+ VERSION = '0.1.17'
3
3
  end
data/lib/testrbl.rb CHANGED
@@ -2,9 +2,9 @@ require 'testrbl/version'
2
2
 
3
3
  module Testrbl
4
4
  PATTERNS = [
5
- /^(\s+)(should|test|it)\s+['"](.*)['"]\s+do\s*$/,
6
- /^(\s+)(context)\s+['"]?(.*?)['"]?\s+do\s*$/,
7
- /^(\s+)def\s+(test_)([a-z_\d]+)\s*$/
5
+ /^(\s+)(should|test|it)\s+['"](.*)['"]\s+do\s*(?:#.*)?$/,
6
+ /^(\s+)(context)\s+['"]?(.*?)['"]?\s+do\s*(?:#.*)?$/,
7
+ /^(\s+)def\s+(test_)([a-z_\d]+)\s*(?:#.*)?$/
8
8
  ]
9
9
 
10
10
  # copied from minitest
@@ -23,7 +23,7 @@ module Testrbl
23
23
  run "#{ruby} #{i_test}#{file} -n '/#{pattern_from_file(File.readlines(file), line)}/'"
24
24
  elsif file
25
25
  run "#{ruby} #{i_test}#{file}"
26
- elsif argv.all?{|f| File.file?(f) }
26
+ elsif argv.all?{|f| File.file?(f) } # testrb has a lot of weird issues vs test-unit, so try to avoid it
27
27
  run "#{ruby} #{argv.map{|f| "-r #{localize(f)}" }.join(" ")} -e ''"
28
28
  else # pass though
29
29
  # no bundle exec: projects with mini and unit-test do not run well via bundle exec testrb
data/spec/testrbl_spec.rb CHANGED
@@ -135,13 +135,17 @@ describe Testrbl do
135
135
  puts 'BCD'
136
136
  end
137
137
 
138
- test "c -__.BLA:" do
138
+ test "c -__.BLA:" do # line 12
139
139
  puts 'CDE'
140
140
  end
141
141
 
142
- test "c" do
142
+ test "c" do # line 16
143
143
  puts 'DEF'
144
144
  end
145
+
146
+ test "x / y" do # line 20
147
+ puts "XY"
148
+ end
145
149
  end
146
150
  RUBY
147
151
  end
@@ -173,6 +177,12 @@ describe Testrbl do
173
177
  result.should include "CDE\n"
174
178
  result.should_not include "DEF\n"
175
179
  end
180
+
181
+ it "runs with / in name" do
182
+ result = testrbl "a_test.rb:20"
183
+ result.should include "XY\n"
184
+ result.should_not include "DEF\n"
185
+ end
176
186
  end
177
187
  end
178
188
  end
@@ -440,6 +450,10 @@ describe Testrbl do
440
450
  call(" test \"c -__.BLA:\" do\n").should == [" ", "^test(: |_)c.\\-__\\.BLA:$"]
441
451
  end
442
452
 
453
+ it "finds test do calls with comments" do
454
+ call(" test \"x / y\" do # line 20\n").should == [" ", "^test(: |_)x./.y$"]
455
+ end
456
+
443
457
  it "finds interpolated test do calls" do
444
458
  call(" test \"c\#{111}b\" do\n").should == [" ", "^test(: |_)c.*b$"]
445
459
  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.16
4
+ version: 0.1.17
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-10-23 00:00:00.000000000 Z
12
+ date: 2012-10-29 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: 3813406408488973454
47
+ hash: 3686334179144340123
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: 3813406408488973454
56
+ hash: 3686334179144340123
57
57
  requirements: []
58
58
  rubyforge_project:
59
59
  rubygems_version: 1.8.24