cli_tester 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/cli_tester.rb +7 -3
- data/lib/version.rb +1 -1
- data/spec/cli_tester_spec.rb +20 -0
- data/yes_ship_it.conf +2 -0
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed4bb3f8ce71ee61694aaa3a5d92c8abe6012d5e
|
4
|
+
data.tar.gz: 4b336e3cffe2e574d8e74f36a03826535013261e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 763f60af77131ce8c611c4451d3c7d93f99346b21eee89287ad2f52863be27b35f860afb8b298b6902bfa93ecb6cae613912bf7c1d2b3822c7764becb4da2690
|
7
|
+
data.tar.gz: 828c1b71ebdea4874eb9c43558259ab849b6918eecd55082151e66a6dac658ab7bae9261f676c3727023dbd82ee49a3454a441c0c2cea58486538f6e3e069bf2
|
data/CHANGELOG.md
ADDED
data/lib/cli_tester.rb
CHANGED
@@ -84,10 +84,14 @@ RSpec::Matchers.define :exit_with_success do |expected_stdout, expected_stderr|
|
|
84
84
|
else
|
85
85
|
return false if !result.stderr.empty?
|
86
86
|
end
|
87
|
-
if expected_stdout
|
88
|
-
expected_stdout.
|
87
|
+
if expected_stdout
|
88
|
+
if expected_stdout.is_a?(Regexp)
|
89
|
+
expected_stdout.match(result.stdout)
|
90
|
+
else
|
91
|
+
expected_stdout == result.stdout
|
92
|
+
end
|
89
93
|
else
|
90
|
-
|
94
|
+
true
|
91
95
|
end
|
92
96
|
end
|
93
97
|
|
data/lib/version.rb
CHANGED
data/spec/cli_tester_spec.rb
CHANGED
@@ -51,6 +51,26 @@ describe "matchers" do
|
|
51
51
|
expect(run_command(args: ["fail"])).to exit_with_error(1, "failed\n", "right\n")
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
describe "exit_with_success" do
|
56
|
+
it "succeeds when program exits with 0 and given stdout" do
|
57
|
+
expect {
|
58
|
+
expect(run_command(args: ["list"])).to exit_with_success("one\ntwo\n")
|
59
|
+
}.to_not raise_error
|
60
|
+
end
|
61
|
+
|
62
|
+
it "fails when program exits with 0 and stdout does not match" do
|
63
|
+
expect {
|
64
|
+
expect(run_command(args: ["list"])).to exit_with_success("not what we get")
|
65
|
+
}.to raise_error RSpec::Expectations::ExpectationNotMetError
|
66
|
+
end
|
67
|
+
|
68
|
+
it "succeeds when program exists with 0 and no stdout is given for comparison" do
|
69
|
+
expect {
|
70
|
+
expect(run_command(args: ["list"])).to exit_with_success
|
71
|
+
}.to_not raise_error
|
72
|
+
end
|
73
|
+
end
|
54
74
|
end
|
55
75
|
|
56
76
|
describe "options" do
|
data/yes_ship_it.conf
ADDED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli_tester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cornelius Schumacher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cheetah
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: given_filesystem
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: CliTester provides a set of RSpec helpers to test command line interfaces
|
@@ -60,8 +60,9 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .gitignore
|
64
|
-
- .rspec
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- CHANGELOG.md
|
65
66
|
- Gemfile
|
66
67
|
- MIT-LICENSE
|
67
68
|
- README.md
|
@@ -72,6 +73,7 @@ files:
|
|
72
73
|
- lib/version.rb
|
73
74
|
- spec/cli_tester_spec.rb
|
74
75
|
- spec/spec_helper.rb
|
76
|
+
- yes_ship_it.conf
|
75
77
|
homepage: http://github.com/cornelius/cli_tester
|
76
78
|
licenses:
|
77
79
|
- MIT
|
@@ -82,19 +84,18 @@ require_paths:
|
|
82
84
|
- lib
|
83
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
86
|
requirements:
|
85
|
-
- -
|
87
|
+
- - ">="
|
86
88
|
- !ruby/object:Gem::Version
|
87
89
|
version: '0'
|
88
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
91
|
requirements:
|
90
|
-
- -
|
92
|
+
- - ">="
|
91
93
|
- !ruby/object:Gem::Version
|
92
94
|
version: 1.3.6
|
93
95
|
requirements: []
|
94
96
|
rubyforge_project: cli_tester
|
95
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.5.1
|
96
98
|
signing_key:
|
97
99
|
specification_version: 4
|
98
100
|
summary: RSpec helpers for testing command line interfaces
|
99
101
|
test_files: []
|
100
|
-
has_rdoc:
|