cli_tester 0.0.3 → 0.0.4

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: ed4bb3f8ce71ee61694aaa3a5d92c8abe6012d5e
4
- data.tar.gz: 4b336e3cffe2e574d8e74f36a03826535013261e
3
+ metadata.gz: dcbcdfed58c37e9a043d8003691821a7a71f62c6
4
+ data.tar.gz: f44be5dfb8584e52c1c562aa0e228b881d28f9c1
5
5
  SHA512:
6
- metadata.gz: 763f60af77131ce8c611c4451d3c7d93f99346b21eee89287ad2f52863be27b35f860afb8b298b6902bfa93ecb6cae613912bf7c1d2b3822c7764becb4da2690
7
- data.tar.gz: 828c1b71ebdea4874eb9c43558259ab849b6918eecd55082151e66a6dac658ab7bae9261f676c3727023dbd82ee49a3454a441c0c2cea58486538f6e3e069bf2
6
+ metadata.gz: 0f7b2ce02707de913aed72644af2b82cf18027fa7d08097955e172fe5e921b30649b97fb8b414663b3e150102805dbd8b5ffe7b41cb0a847543591b619cc0e0e
7
+ data.tar.gz: a94d7947063ff90a97713da6e7a6824ae4af0ffc8530d2410cbd4b4af7990e2445339ca63e685daa56b77e12b1faad1c12de739259b931c20ae17b828fa8401e
@@ -1,5 +1,9 @@
1
1
  # Change log of cli_tester
2
2
 
3
+ ## Version 0.0.4
4
+
5
+ * Fix error when no stdout is given to `exit_with_success` and command fails
6
+
3
7
  ## Version 0.0.3
4
8
 
5
9
  * Don't require argument for `exit_with_success`
@@ -122,16 +122,18 @@ RSpec::Matchers.define :exit_with_success do |expected_stdout, expected_stderr|
122
122
  message += " (was '#{Regexp.escape(result.stderr)}')\n"
123
123
  end
124
124
  end
125
- if expected_stdout.is_a?(Regexp)
126
- message += "stdout didn't match #{expected_stdout.inspect}"
127
- message += " (was '#{Regexp.escape(result.stdout)}')"
128
- else
129
- if result.stdout != expected_stdout
130
- message += "expected stdout to be '#{Regexp.escape(expected_stdout)}'"
125
+ if expected_stdout
126
+ if expected_stdout.is_a?(Regexp)
127
+ message += "stdout didn't match #{expected_stdout.inspect}"
131
128
  message += " (was '#{Regexp.escape(result.stdout)}')"
132
- message += "\n\nDiff of stdout:"
133
- differ = RSpec::Support::Differ.new(color: true)
134
- message += differ.diff(result.stdout, expected_stdout)
129
+ else
130
+ if result.stdout != expected_stdout
131
+ message += "expected stdout to be '#{Regexp.escape(expected_stdout)}'"
132
+ message += " (was '#{Regexp.escape(result.stdout)}')"
133
+ message += "\n\nDiff of stdout:"
134
+ differ = RSpec::Support::Differ.new(color: true)
135
+ message += differ.diff(result.stdout, expected_stdout)
136
+ end
135
137
  end
136
138
  end
137
139
  message
@@ -1,3 +1,3 @@
1
1
  module CliTester
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -65,6 +65,12 @@ describe "matchers" do
65
65
  }.to raise_error RSpec::Expectations::ExpectationNotMetError
66
66
  end
67
67
 
68
+ it "fails when program exits with non 0 and no stdout is given for comparison" do
69
+ expect {
70
+ expect(run_command(args: ["fail"])).to exit_with_success
71
+ }.to raise_error RSpec::Expectations::ExpectationNotMetError
72
+ end
73
+
68
74
  it "succeeds when program exists with 0 and no stdout is given for comparison" do
69
75
  expect {
70
76
  expect(run_command(args: ["list"])).to exit_with_success
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cornelius Schumacher