rspec_starter 1.0.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94076d4db8d8a8e83410f07f9134d2e94d3bff4d
4
- data.tar.gz: 300135da1ef3d8c491e75f2a092690d1941caaf7
3
+ metadata.gz: 4c9da79a01f7f899551da8967be196b0ae0de2e4
4
+ data.tar.gz: 5ac202d616c486bbcc3a41fea93f8527181eed8a
5
5
  SHA512:
6
- metadata.gz: 6c35c1d6769f02ddf3e435017b854bafeb70ab7e12fb737902a4e8052412bc9c710a261f916eecc56002cef2b5a0a932bf897fe3f9ff94e0d2abf15f7039201f
7
- data.tar.gz: 7525262e24ad869c37ea1a327bfa345939b5d1a6b35c68d206ff54ac5d6c454c7b60f39adba9bdc2e6689a1a8436a89f8f6adbb8257c426380800affc441e077
6
+ metadata.gz: f0f5da7b49b6b93d1e7089c494a991332728687829089891d02b4b4986a93b966e4767851889d4f3e4b6a65c531dd33970afdf6c3cb8e199c592b975b2257e1c
7
+ data.tar.gz: 8a6d3e14c89e453c7b496a49b8a498c1b3bb206c820b2930c0af591738f4d9f69fd343fac3a4cc0c70e99743fa3271825fd58fff0d3bd0c3371ff3fcf9c9ccd2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 0.1.0 (Apr 06, 2017)
3
+ ## 1.0.1 (May 10, 2017)
4
+
5
+ 1. (Fix) Improve the logic for deciding when the database preparation step has successfully completed, and format the error output better. (Issue #1)
6
+
7
+ ## 1.0.0 (Apr 06, 2017)
4
8
 
5
9
  1. Initial Release
@@ -24,18 +24,33 @@ module RspecStarter
24
24
  rebuild_cmd = "rake db:drop db:create db:migrate RAILS_ENV=test"
25
25
  print "[#{@runner.step_num}] Preparing the test database with '#{rebuild_cmd.rs_yellow}' ... "
26
26
  _stdin, _stdout, stderr = Open3.popen3(rebuild_cmd)
27
- error_msg_array = stderr.readlines
27
+ output_array = prepare_output_array(stderr.readlines)
28
28
 
29
- if error_msg_array.empty?
29
+ if successful?(output_array)
30
30
  puts "Success".rs_green
31
+ puts output_array
31
32
  @success_or_skipped = true
32
33
  else
33
- puts "\n\n"
34
- puts error_msg_array
34
+ puts "Fail".rs_red + "\n\n"
35
+ puts output_array
35
36
  puts "\n\nThere was an error rebuilding the test database. See the output above for details.".rs_red
36
37
  puts "or manually run '#{rebuild_cmd}' for more information.".rs_red
37
38
  @success_or_skipped = false
38
39
  end
39
40
  end
41
+
42
+ private
43
+
44
+ # Simply checking the exitstatus isn't good enough. When rake aborts due to a bug, it will still
45
+ # return a zero exit status. We need to see if 'rake aborted!' has been written to the output.
46
+ def successful?(output_array)
47
+ return false if $?.exitstatus.nonzero?
48
+ not output_array.any? { |result| result.include? "rake aborted!"}
49
+ end
50
+
51
+ def prepare_output_array(array)
52
+ (0..array.size-1).each { |i| array[i] = " #{array[i].strip}".rs_red }
53
+ array
54
+ end
40
55
  end
41
56
  end
@@ -1,3 +1,3 @@
1
1
  module RspecStarter
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_starter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberts
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-06 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler