jet_black 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +41 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +4 -1
- data/README.md +7 -3
- data/jet_black.gemspec +2 -1
- data/lib/jet_black/executed_command.rb +8 -0
- data/lib/jet_black/rspec.rb +15 -0
- data/lib/jet_black/rspec/matchers.rb +53 -0
- data/lib/jet_black/session.rb +1 -1
- data/lib/jet_black/version.rb +1 -1
- metadata +29 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa0fa42b8b1218e280038ce18fa583a3a8288d4cd91c5a6445c34d03b8c68c5f
|
4
|
+
data.tar.gz: d5c94f0eb5852106f2959dd4745f27d401f67adcc2d79247e9979dd3760a8935
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ca15f316fac15876965b704f37432ee80ceb4867c13b1a0cc0e4063f79bd50ec3b60a2a462f600afb753c08c260c665a71065ba3e35d8dd470436acb0128e83
|
7
|
+
data.tar.gz: c371bf859447eeac0514167f9f1869132595cf745d6086dcb1482d0feb7622c886ed3f89ffd8cd881c8f5855718be2386bb0c17bd236ad664a9594e8353dbdde
|
@@ -0,0 +1,41 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.5
|
6
|
+
|
7
|
+
working_directory: ~/repo
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- checkout
|
11
|
+
|
12
|
+
- restore_cache:
|
13
|
+
keys:
|
14
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
15
|
+
# fallback to using the latest cache if no exact match is found
|
16
|
+
- v1-dependencies-
|
17
|
+
|
18
|
+
- run:
|
19
|
+
name: install dependencies
|
20
|
+
command: |
|
21
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
22
|
+
|
23
|
+
- save_cache:
|
24
|
+
paths:
|
25
|
+
- ./vendor/bundle
|
26
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
27
|
+
|
28
|
+
- run:
|
29
|
+
name: run tests
|
30
|
+
command: |
|
31
|
+
mkdir /tmp/test-results
|
32
|
+
bundle exec rspec --format progress \
|
33
|
+
--format RspecJunitFormatter \
|
34
|
+
--out /tmp/test-results/rspec.xml
|
35
|
+
|
36
|
+
# collect reports
|
37
|
+
- store_test_results:
|
38
|
+
path: /tmp/test-results
|
39
|
+
- store_artifacts:
|
40
|
+
path: /tmp/test-results
|
41
|
+
destination: test-results
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v0.2.0
|
4
|
+
|
5
|
+
- Adds RSpec matchers `have_stdout`, `have_stderr`, `have_no_stdout`, &
|
6
|
+
`have_no_stderr`.
|
7
|
+
- Adds support for RSpec predicate matchers `be_success` & `be_failure`.
|
8
|
+
- Requiring `jet_black/rspec` sets up inference of spec type and inclusion
|
9
|
+
matchers (place specs in `spec/black_box`).
|
10
|
+
|
11
|
+
## v0.1.0
|
12
|
+
|
13
|
+
- Initial release.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jet_black (0.
|
4
|
+
jet_black (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -26,6 +26,8 @@ GEM
|
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
27
|
rspec-support (~> 3.7.0)
|
28
28
|
rspec-support (3.7.1)
|
29
|
+
rspec_junit_formatter (0.3.0)
|
30
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
29
31
|
|
30
32
|
PLATFORMS
|
31
33
|
ruby
|
@@ -36,6 +38,7 @@ DEPENDENCIES
|
|
36
38
|
pry
|
37
39
|
rake (~> 10.0)
|
38
40
|
rspec (~> 3.0)
|
41
|
+
rspec_junit_formatter
|
39
42
|
|
40
43
|
BUNDLED WITH
|
41
44
|
1.16.1
|
data/README.md
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
# JetBlack
|
2
2
|
|
3
|
-
|
3
|
+
[![CircleCI](https://circleci.com/gh/odlp/jet_black.svg?style=svg)](https://circleci.com/gh/odlp/jet_black)
|
4
|
+
|
5
|
+
A black-box testing utility for command line tools, written in Ruby. Features:
|
4
6
|
|
5
7
|
- Each session runs in a temporary directory
|
6
|
-
- Captures stdout
|
8
|
+
- Captures `stdout`, `stderr` and exit status of a command
|
7
9
|
- Keeps a history of commands executed
|
8
10
|
- Temporarily overriding environment variables for a command
|
9
11
|
- Copying fixture files to the temporary directory
|
10
12
|
- Appending content to files in the temporary directory
|
11
13
|
- Adding a path prefix to include your executable
|
12
|
-
- Option to escape the Bundler environment
|
14
|
+
- Option to escape the Bundler environment (allowing `bundle exec` with
|
15
|
+
different Gemfiles)
|
16
|
+
- RSpec matchers for `stdout` and `stderr`
|
data/jet_black.gemspec
CHANGED
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.16"
|
22
|
+
spec.add_development_dependency "pry"
|
22
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec_junit_formatter"
|
23
25
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
-
spec.add_development_dependency "pry"
|
25
26
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "rspec/core"
|
2
|
+
require_relative "rspec/matchers"
|
3
|
+
|
4
|
+
module JetBlack
|
5
|
+
module RSpec
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.define_derived_metadata(file_path: %r{/spec/black_box/}) do |metadata|
|
11
|
+
metadata[:type] = :black_box
|
12
|
+
end
|
13
|
+
|
14
|
+
config.include JetBlack::RSpec::Matchers, type: :black_box
|
15
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "rspec/expectations"
|
2
|
+
|
3
|
+
module JetBlack
|
4
|
+
module RSpec
|
5
|
+
module Matchers
|
6
|
+
extend ::RSpec::Matchers::DSL
|
7
|
+
|
8
|
+
def have_stdout(expected)
|
9
|
+
HaveStdout.new(expected)
|
10
|
+
end
|
11
|
+
|
12
|
+
def have_stderr(expected)
|
13
|
+
HaveStderr.new(expected)
|
14
|
+
end
|
15
|
+
|
16
|
+
matcher(:have_no_stdout) do
|
17
|
+
match { |result| result.stdout.empty? }
|
18
|
+
|
19
|
+
failure_message do |result|
|
20
|
+
<<~MSG
|
21
|
+
expected command to have no stdout output. Got:
|
22
|
+
---
|
23
|
+
#{result.stdout}
|
24
|
+
MSG
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
matcher(:have_no_stderr) do
|
29
|
+
match { |result| result.stderr.empty? }
|
30
|
+
|
31
|
+
failure_message do |result|
|
32
|
+
<<~MSG
|
33
|
+
expected command to have no stderr output. Got:
|
34
|
+
---
|
35
|
+
#{result.stderr}
|
36
|
+
MSG
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class HaveStdout < ::RSpec::Matchers::BuiltIn::Match
|
41
|
+
def matches?(actual)
|
42
|
+
super(actual.stdout)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class HaveStderr < ::RSpec::Matchers::BuiltIn::Match
|
47
|
+
def matches?(actual)
|
48
|
+
super(actual.stderr)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/jet_black/session.rb
CHANGED
data/lib/jet_black/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jet_black
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oli Peate
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,35 +25,35 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.16'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
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
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '10.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
|
-
version: '
|
54
|
+
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec_junit_formatter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -66,15 +66,31 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
executables: []
|
72
86
|
extensions: []
|
73
87
|
extra_rdoc_files: []
|
74
88
|
files:
|
89
|
+
- ".circleci/config.yml"
|
75
90
|
- ".gitignore"
|
76
91
|
- ".rspec"
|
77
92
|
- ".travis.yml"
|
93
|
+
- CHANGELOG.md
|
78
94
|
- Gemfile
|
79
95
|
- Gemfile.lock
|
80
96
|
- LICENSE.txt
|
@@ -88,6 +104,8 @@ files:
|
|
88
104
|
- lib/jet_black/environment.rb
|
89
105
|
- lib/jet_black/errors.rb
|
90
106
|
- lib/jet_black/executed_command.rb
|
107
|
+
- lib/jet_black/rspec.rb
|
108
|
+
- lib/jet_black/rspec/matchers.rb
|
91
109
|
- lib/jet_black/session.rb
|
92
110
|
- lib/jet_black/version.rb
|
93
111
|
homepage: https://github.com/odlp/jet_black
|