testrbl 0.7.0 → 0.8.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Gemfile.lock +1 -1
- data/Readme.md +1 -1
- data/lib/testrbl.rb +14 -2
- data/lib/testrbl/version.rb +1 -1
- data/spec/testrbl_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1013ac41c62b29ae793ebc58d7f32967a3031f32
|
4
|
+
data.tar.gz: 35b899c48f919c85c958e26ed8ded9f6f4d11933
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aa118ff074c25054c0e29e96da7f693717b8775b08595c8e6c68b2f1364b99c8f3421dac0c423a465bde628ec86870105fca0cf58153b1967ad7fa172d3560e
|
7
|
+
data.tar.gz: 5447f57db28b74d17fc9aae974592058e6aa5825f0df15b10c99318826dd5336e8bb5f63c78aaad9c5de4d80c40c62172b8cca83dc2573a2815ccaeba3c73664
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -20,7 +20,7 @@ Usage
|
|
20
20
|
testrbl test/unit/xxx_test.rb:123 # test by line number
|
21
21
|
testrbl test/unit # everything _test.rb in a folder (on 1.8 this would be test/unit/*)
|
22
22
|
testrbl xxx_test.rb yyy_test.rb # multiple files
|
23
|
-
testrbl --changed # run changed tests
|
23
|
+
testrbl --changed # run changed tests or files in last commit
|
24
24
|
```
|
25
25
|
|
26
26
|
Tips
|
data/lib/testrbl.rb
CHANGED
@@ -114,11 +114,23 @@ module Testrbl
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def changed_files
|
117
|
-
changed_files =
|
118
|
-
|
117
|
+
changed_files = sh("git status -s").split("\n").map { |l| l.strip.split(/\s+/, 2)[1] }
|
118
|
+
|
119
|
+
if changed_files.empty?
|
120
|
+
# user wants to test last commit and not current diff
|
121
|
+
changed_files = sh("git show --name-only").split("\n\n").last.split("\n")
|
122
|
+
end
|
123
|
+
|
124
|
+
# we only want test files that were added or changed (not deleted)
|
119
125
|
changed_files.select { |f| f =~ /_(test|spec)\.rb$/ && File.exist?(f) }
|
120
126
|
end
|
121
127
|
|
128
|
+
def sh(command)
|
129
|
+
result = `#{command}`
|
130
|
+
raise "Failed: #{command} -> #{result}" unless $?.success?
|
131
|
+
result
|
132
|
+
end
|
133
|
+
|
122
134
|
def ruby
|
123
135
|
if File.file?("Gemfile")
|
124
136
|
["ruby", "-rbundler/setup"] # faster then bundle exec ruby
|
data/lib/testrbl/version.rb
CHANGED
data/spec/testrbl_spec.rb
CHANGED
@@ -520,6 +520,12 @@ describe Testrbl do
|
|
520
520
|
result.should include "DEF"
|
521
521
|
result.should_not include "ABC"
|
522
522
|
end
|
523
|
+
|
524
|
+
it "runs last commit when no files are changed" do
|
525
|
+
result = testrbl("--changed")
|
526
|
+
result.should include "ABC"
|
527
|
+
result.should include "BCD"
|
528
|
+
end
|
523
529
|
end
|
524
530
|
|
525
531
|
describe ".test_pattern_from_file" do
|
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
|
+
version: 0.8.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: 2016-
|
11
|
+
date: 2016-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|