grspec 0.3.0 → 0.3.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/grspec.rb +28 -7
  3. data/lib/spec_runner.rb +2 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16610e47bcb0c299bbff11a44ff15b8467014fc9f29047b661db9f9234fdfb5f
4
- data.tar.gz: a0eb0ce7a49c84384d916dd259c2af74b1e7afd2d7b82f89a846f3e9bca47fce
3
+ metadata.gz: f47d356e18beb6a785756853a7f720c1e1c8dd6442d9573889a079ce7245d702
4
+ data.tar.gz: 97b2603e4b93cfad46284371a74215b92ee01a58a3bbe335055fa505bf335041
5
5
  SHA512:
6
- metadata.gz: 19f518d2092c2a7282183aef5e8d6698944c3b0ec1540b7704b271543a7f2daca8d38f547165d1f37cb7a54dd188117e8cf504bf3788133a996a1bbe3e9b7c8f
7
- data.tar.gz: 47cf4410ebdebb27d3211640d160790c7ee12cb601f87c55c415d8ca87a537810bfa92f7106241379c20fd48bca44fd4e19ad22d87a04d65e10b3362b1a5bb75
6
+ metadata.gz: eb51852caf5cd6106cda3d165d4cf0943c08c97734a818cc7fa95a62fc2e3acb6629b070abb3507a1bcbd32636ce5e9d6db7883b97e7ea03ee35253ff5fc8e0b
7
+ data.tar.gz: dcc1f759e7ee9b2a9a888a374c7cc3a920bcb33d1555d80058c21656471deceab8cbb008bd991be52739989366a09126a694b116ff8cd014ff99f9e7b7cab70e
@@ -26,16 +26,25 @@ class Grspec
26
26
  mismatching_files.map(&:first)
27
27
  ) if mismatching_files.any?
28
28
 
29
- if matching_specs.any?
29
+ if spec_matchings.any?
30
30
  display_listing(
31
31
  'Matching specs:',
32
- matching_specs.map { |matching_spec| matching_spec.join(' -> ') }
32
+ spec_matchings.map { |matching_spec| matching_spec.join(' -> ') }
33
33
  )
34
34
 
35
- if dry_run?
36
- puts matching_specs.map(&:second).uniq
37
- else
38
- SpecRunner.run(matching_specs.map(&:second).uniq)
35
+ if non_existent_specs.any?
36
+ display_listing(
37
+ 'Removed specs:',
38
+ non_existent_specs
39
+ )
40
+ end
41
+
42
+ if specs_to_run.any?
43
+ if dry_run?
44
+ puts specs_to_run
45
+ else
46
+ SpecRunner.run(specs_to_run)
47
+ end
39
48
  end
40
49
  else
41
50
  display("No matching specs found")
@@ -63,8 +72,20 @@ class Grspec
63
72
  @mismatching_files ||= file_spec_pairs.select { |_, spec| spec.nil? }
64
73
  end
65
74
 
75
+ def spec_matchings
76
+ @spec_matchings ||= file_spec_pairs - mismatching_files
77
+ end
78
+
66
79
  def matching_specs
67
- @matching_specs ||= file_spec_pairs - mismatching_files
80
+ @matching_specs ||= spec_matchings.map(&:second).uniq
81
+ end
82
+
83
+ def non_existent_specs
84
+ @non_existent_specs ||= matching_specs.reject { |spec_file| File.file?(spec_file) }
85
+ end
86
+
87
+ def specs_to_run
88
+ @specs_to_run ||= matching_specs - non_existent_specs
68
89
  end
69
90
 
70
91
  def display_output?
@@ -1,11 +1,7 @@
1
1
  class SpecRunner
2
2
  RSPEC_COMMAND = 'rspec'.freeze
3
3
 
4
- def self.run(matching_specs)
5
- specs_to_run, removed_files = matching_specs.partition { |spec_file| File.file?(spec_file) }
6
-
7
- system "#{RSPEC_COMMAND} #{specs_to_run.join(' ')}" if specs_to_run.any?
8
-
9
- [specs_to_run, removed_files]
4
+ def self.run(specs)
5
+ system "#{RSPEC_COMMAND} #{specs.join(' ')}" if specs.any?
10
6
  end
11
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordane Lew
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: GRSpec is a tiny gem that can quickly and easily run specs for files
14
14
  that git has detected changes for, allowing for quick and easy regression checking