testrbl 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ gemspec
3
3
 
4
4
  gem 'test-unit'
5
5
  gem 'minitest'
6
+ gem 'activesupport', '2.3.14'
6
7
  gem 'rake'
7
8
  gem 'rspec', '~>2'
8
9
  gem 'shoulda'
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testrbl (0.1.7)
4
+ testrbl (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
+ activesupport (2.3.14)
9
10
  diff-lcs (1.1.3)
10
11
  minitest (3.0.1)
11
12
  rake (0.9.2)
@@ -28,6 +29,7 @@ PLATFORMS
28
29
  ruby
29
30
 
30
31
  DEPENDENCIES
32
+ activesupport (= 2.3.14)
31
33
  minitest
32
34
  rake
33
35
  rspec (~> 2)
@@ -63,7 +63,10 @@ module Testrbl
63
63
  if method == "should"
64
64
  regex = "#{method} #{regex}\. $"
65
65
  elsif method == "test"
66
- regex = "^#{method}: #{regex}$"
66
+ # test "xxx -_ yyy"
67
+ # test-unit: "test: xxx -_ yyy"
68
+ # activesupport: "test_xxx_-__yyy"
69
+ regex = "^test(: |_)#{regex.gsub(" ", ".")}$"
67
70
  elsif method == "it"
68
71
  regex = "\\d+_#{test_name.gsub(MINITEST_NAME_RE, '_').downcase}$"
69
72
  end
@@ -1,3 +1,3 @@
1
1
  module Testrbl
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -25,11 +25,15 @@ describe Testrbl do
25
25
  File.open(file, 'w'){|f| f.write content }
26
26
  end
27
27
 
28
+ def read(file)
29
+ File.read(file)
30
+ end
31
+
28
32
  it "has a VERSION" do
29
33
  Testrbl::VERSION.should =~ /^[\.\da-z]+$/
30
34
  end
31
35
 
32
- context "with a simple setup" do
36
+ context "def test_" do
33
37
  before do
34
38
  write "a_test.rb", <<-RUBY
35
39
  require 'test/unit'
@@ -82,9 +86,8 @@ describe Testrbl do
82
86
  context "test with string" do
83
87
  before do
84
88
  write "a_test.rb", <<-RUBY
85
- require 'test/unit'
86
-
87
- class Xxx < Test::Unit::TestCase
89
+ REQUIRE
90
+ class Xxx < ANCESTOR
88
91
  test "a" do
89
92
  puts 'ABC'
90
93
  end
@@ -93,7 +96,7 @@ describe Testrbl do
93
96
  puts 'BCD'
94
97
  end
95
98
 
96
- test "c d" do
99
+ test "c -__.BLA:" do
97
100
  puts 'CDE'
98
101
  end
99
102
 
@@ -104,17 +107,34 @@ describe Testrbl do
104
107
  RUBY
105
108
  end
106
109
 
107
- it "runs test" do
108
- result = testrbl "a_test.rb:8"
109
- result.should_not include "ABC\n"
110
- result.should include "BCD\n"
111
- result.should_not include "CDE\n"
112
- end
110
+ [
111
+ ["Test::Unit::TestCase", "require 'test/unit'\n"],
112
+ ["ActiveSupport::TestCase", "require 'test/unit'\nrequire 'active_support/test_case'"],
113
+ ].each do |ancestor, require|
114
+ context "with #{ancestor}" do
115
+ before do
116
+ write("a_test.rb", read("a_test.rb").sub("REQUIRE", require).sub("ANCESTOR", ancestor))
117
+ end
113
118
 
114
- it "runs test explicitly" do
115
- result = testrbl "a_test.rb:16"
116
- result.should_not include "CDE\n"
117
- result.should include "DEF\n"
119
+ it "runs test" do
120
+ result = testrbl "a_test.rb:8"
121
+ result.should_not include "ABC\n"
122
+ result.should include "BCD\n"
123
+ result.should_not include "CDE\n"
124
+ end
125
+
126
+ it "runs test explicitly" do
127
+ result = testrbl "a_test.rb:16"
128
+ result.should_not include "CDE\n"
129
+ result.should include "DEF\n"
130
+ end
131
+
132
+ it "runs complex test names" do
133
+ result = testrbl "a_test.rb:12"
134
+ result.should include "CDE\n"
135
+ result.should_not include "DEF\n"
136
+ end
137
+ end
118
138
  end
119
139
  end
120
140
 
@@ -325,11 +345,15 @@ describe Testrbl do
325
345
  end
326
346
 
327
347
  it "finds calls with single quotes" do
328
- call(" test 'xx xx' do\n").should == [" ", "^test: xx xx$"]
348
+ call(" test 'xx xx' do\n").should == [" ", "^test(: |_)xx.xx$"]
329
349
  end
330
350
 
331
351
  it "finds test do calls" do
332
- call(" test \"xx xx\" do\n").should == [" ", "^test: xx xx$"]
352
+ call(" test \"xx xx\" do\n").should == [" ", "^test(: |_)xx.xx$"]
353
+ end
354
+
355
+ it "finds complex test do calls" do
356
+ call(" test \"c -__.BLA:\" do\n").should == [" ", "^test(: |_)c.\\-__\\.BLA:$"]
333
357
  end
334
358
 
335
359
  it "finds should do calls" 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.1.7
4
+ version: 0.1.8
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-06-09 00:00:00.000000000 Z
12
+ date: 2012-06-13 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: 2015423300145067002
47
+ hash: 3374210178778047686
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: 2015423300145067002
56
+ hash: 3374210178778047686
57
57
  requirements: []
58
58
  rubyforge_project:
59
59
  rubygems_version: 1.8.24