testrbl 0.7.0 → 0.8.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: 0a3183773edc555da61883056bb1a0d46efebde6
4
- data.tar.gz: 543ff012aa3fe642db8dd650157373d891e26bb5
3
+ metadata.gz: 1013ac41c62b29ae793ebc58d7f32967a3031f32
4
+ data.tar.gz: 35b899c48f919c85c958e26ed8ded9f6f4d11933
5
5
  SHA512:
6
- metadata.gz: c10d4700ce12b87fbe92747372253d3761e5546f78920aa3663c54181c5c0f71b0bb188bf88036b429ab466b7a26b6eaeed8e60d7696854b34e3b87ed344af59
7
- data.tar.gz: 0a867649306a16c902571e945a93b9a9537bc155e75938f8572b1b441db0d7d8f10bd0a067cc19824fd743fcccc64cd8ca0aba0a246f84ec63cee1e4cfd886b3
6
+ metadata.gz: 7aa118ff074c25054c0e29e96da7f693717b8775b08595c8e6c68b2f1364b99c8f3421dac0c423a465bde628ec86870105fca0cf58153b1967ad7fa172d3560e
7
+ data.tar.gz: 5447f57db28b74d17fc9aae974592058e6aa5825f0df15b10c99318826dd5336e8bb5f63c78aaad9c5de4d80c40c62172b8cca83dc2573a2815ccaeba3c73664
data/.travis.yml CHANGED
@@ -8,4 +8,5 @@ rvm:
8
8
  - 2.0.0
9
9
  - 2.1.8
10
10
  - 2.2.3
11
-
11
+ branches:
12
+ only: master
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testrbl (0.7.0)
4
+ testrbl (0.8.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 = `git status -s`.split("\n").map { |l| l.strip.split(/\s+/, 2)[1] }
118
- raise "Failed: #{changed_files}" unless $?.success?
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
@@ -1,3 +1,3 @@
1
1
  module Testrbl
2
- VERSION = '0.7.0'
2
+ VERSION = '0.8.0'
3
3
  end
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.7.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-05-17 00:00:00.000000000 Z
11
+ date: 2016-07-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it