testrbl 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbccd1a6f94867baccfe5fd8d126556becf51178
4
- data.tar.gz: 2e7773b55e99111fbf76e5991077aa086236e1e9
3
+ metadata.gz: 41de53795f9dfc9c388d7a679b9e3fa0336502ed
4
+ data.tar.gz: 165b56a70195745fb791bf9a09dc2247478d85c7
5
5
  SHA512:
6
- metadata.gz: aacc4824f127a55004a7147e47921fcc40fe0b0efd36590147b37faa31a22ee9583714d1978d3d8b3896d5c3f9647764f556a820e0fea42256beb73b1ad80a5d
7
- data.tar.gz: f9573ad68354f53411a8b8fffc7fb6acff26cccc814eb35fc6d39bb4da057877fe09ed8504c12e9180f47dec82a7712b7b0d30241b07b44006ae7da556b70936
6
+ metadata.gz: 3c1598370bd30c669105fe7a808501f5f90b1570313eb953600715b4a0dc121bc8e3e3711c06b024eca2632e2b295db839e28c4d63ae159b38863443d02938d7
7
+ data.tar.gz: 8f0e555db895d530e65f8c1b54fb4499736b6399bd58f66e0b132d6baa1c2c48a6d4f29f466205f8789a7ce4c05df944e34ad35033d9084be3b454f1eb5b6e95
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testrbl (0.4.1)
4
+ testrbl (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/Readme.md CHANGED
@@ -4,14 +4,19 @@ Instant execution, 0 wait-time!
4
4
 
5
5
  Install
6
6
  =======
7
- gem install testrbl
7
+ ```Bash
8
+ gem install testrbl
9
+ ```
8
10
 
9
11
  Usage
10
12
  =====
11
- testrbl test/unit/xxx_test.rb:123 # test by line number
12
- testrbl test/unit # everything _test.rb in a folder (on 1.8 this would be test/unit/*)
13
- testrbl xxx_test.rb yyy_test.rb # multiple files
14
- testrbl --changed # run changed tests
13
+
14
+ ```Bash
15
+ testrbl test/unit/xxx_test.rb:123 # test by line number
16
+ testrbl test/unit # everything _test.rb in a folder (on 1.8 this would be test/unit/*)
17
+ testrbl xxx_test.rb yyy_test.rb # multiple files
18
+ testrbl --changed # run changed tests
19
+ ```
15
20
 
16
21
  Tips
17
22
  ====
@@ -19,7 +24,6 @@ Tips
19
24
 
20
25
  TODO
21
26
  ====
22
- - fix tests on ree/1.9.2
23
27
  - alternate minitest syntax: test_0017_should not link already linked URLs
24
28
 
25
29
  Author
@@ -27,4 +31,4 @@ Author
27
31
  [Michael Grosser](http://grosser.it)<br/>
28
32
  michael@grosser.it<br/>
29
33
  License: MIT<br/>
30
- [![Build Status](https://secure.travis-ci.org/grosser/testrbl.png)](http://travis-ci.org/grosser/testrbl)
34
+ [![Build Status](https://travis-ci.org/grosser/testrbl.png)](https://travis-ci.org/grosser/testrbl)
@@ -1,3 +1,3 @@
1
1
  module Testrbl
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  end
data/lib/testrbl.rb CHANGED
@@ -19,7 +19,7 @@ module Testrbl
19
19
  if files.size == 1 and files.first =~ /^(\S+):(\d+)$/
20
20
  file = $1
21
21
  line = $2
22
- run(ruby + load_options + [file, "-n", "/#{pattern_from_file(File.readlines(file), line)}/"] + options)
22
+ run(ruby + load_options + line_pattern_option(file, line) + options)
23
23
  else
24
24
  if files.size == 1 and File.file?(files.first)
25
25
  run(ruby + load_options + files + options)
@@ -33,6 +33,11 @@ module Testrbl
33
33
  end
34
34
  end
35
35
 
36
+ # overwritten by maxitest to just return line
37
+ def self.line_pattern_option(file, line)
38
+ [file, "-n", "/#{pattern_from_file(File.readlines(file), line)}/"]
39
+ end
40
+
36
41
  # usable via external tools like zeus
37
42
  def self.pattern_from_file(lines, line)
38
43
  possible_lines = lines[0..(line.to_i-1)].reverse
@@ -140,18 +145,17 @@ module Testrbl
140
145
  def self.test_pattern_from_match(method, test_name)
141
146
  regex = Regexp.escape(test_name).gsub("\\ "," ").gsub(INTERPOLATION, ".*")
142
147
 
143
- regex = case method
144
- when "should"
145
- optional_test_name = "(?:\(.*\))?"
146
- "#{method} #{regex}\. #{optional_test_name}$"
147
- when "describe"
148
- "#{test_name}(::)?"
149
- when "test"
148
+ regex = if method == "test"
150
149
  # test "xxx -_ yyy"
151
150
  # test-unit: "test: xxx -_ yyy"
152
151
  # activesupport: "test_xxx_-__yyy"
153
152
  "^test(: |_)#{regex.gsub(" ", ".")}$"
154
- when "it"
153
+ elsif method == "describe" || (method == "context" && !via_shoulda?)
154
+ "#{test_name}(::)?"
155
+ elsif method == "should" && via_shoulda?
156
+ optional_test_name = "(?:\(.*\))?"
157
+ "#{method} #{regex}\. #{optional_test_name}$"
158
+ elsif ["it", "should"].include?(method) # minitest aliases for shoulda
155
159
  "#test_\\d+_#{test_name}$"
156
160
  else
157
161
  regex
@@ -159,4 +163,9 @@ module Testrbl
159
163
 
160
164
  regex.gsub("'", ".")
161
165
  end
166
+
167
+ def self.via_shoulda?
168
+ return @via_shoulda if defined?(@via_shoulda)
169
+ @via_shoulda = !File.exist?("Gemfile.lock") || File.read("Gemfile.lock").include?(" shoulda-context ")
170
+ end
162
171
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrbl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-06 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it
@@ -17,7 +17,7 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - .travis.yml
20
+ - ".travis.yml"
21
21
  - Gemfile
22
22
  - Gemfile.lock
23
23
  - Rakefile
@@ -38,17 +38,17 @@ require_paths:
38
38
  - lib
39
39
  required_ruby_version: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '>='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: '0'
44
44
  required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 2.0.14
51
+ rubygems_version: 2.2.2
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: Run ruby Test::Unit/Shoulda tests by line-number / folder / the dozen