busser-rspec 0.7.6 → 0.8.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 +5 -5
- data/.github/workflows/ci.yml +32 -0
- data/.github/workflows/pr-title.yml +28 -0
- data/.github/workflows/publish.yml +67 -0
- data/.gitignore +0 -1
- data/.markdownlint.yaml +6 -0
- data/.release-please-manifest.json +3 -0
- data/.rubocop.yml +6 -0
- data/.yamllint +6 -0
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +104 -0
- data/Gemfile +19 -1
- data/README.md +120 -32
- data/Rakefile +26 -21
- data/busser-rspec.gemspec +20 -22
- data/features/plugin_install_command.feature +3 -1
- data/features/support/env.rb +44 -9
- data/features/test_command.feature +3 -1
- data/lib/busser/rspec/runner.rb +2 -3
- data/lib/busser/rspec/version.rb +2 -2
- data/lib/busser/runner_plugin/rspec.rb +83 -17
- data/release-please-config.json +15 -0
- data/renovate.json +8 -0
- data/spec/busser/runner_plugin/rspec_spec.rb +87 -0
- data/spec/spec_helper.rb +2 -0
- metadata +30 -133
- data/.cane +0 -0
- data/.tailor +0 -4
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 217c8f2f4bb8a712f4d69e22c3567334306c9d0e44cdc418c47630ee84660ffe
|
|
4
|
+
data.tar.gz: cf85c2e7e49b49c74273c9d2f11ee208d3eadead985ff3f9f021a7e35ace6b53
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 677c89b4864b780207555fcfe5b176e172e50c2a77ecdfd8ce8f5723fb0988250c3e9e03bacf3781f3a5486eed4050e8a5a1415288f4f1396eb4bcc239d5bc1c
|
|
7
|
+
data.tar.gz: a1ed580c340581807850947ee6ce8f391483dd809aa98efb86c7960af31318e468244c63f671948e85540fe98fcf70190dfb966fe5080e3d4d453d3153db64d0
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Test"
|
|
3
|
+
|
|
4
|
+
"on":
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
# The default token is granted write access to most of the repository.
|
|
11
|
+
# Nothing here needs more than the checkout.
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
# Supersede in-flight runs for a branch. Pull requests cancel freely, but
|
|
16
|
+
# pushes to main do not: every commit on main should keep a build of its own.
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
19
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
lint-unit:
|
|
23
|
+
# Pinned to a commit rather than @main so an upstream edit cannot reach
|
|
24
|
+
# this repository's CI without a reviewed pull request. The trailing
|
|
25
|
+
# comment names the release the commit belongs to, which is what lets
|
|
26
|
+
# Renovate track the pin by version and keep both in step.
|
|
27
|
+
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@95ef7803cf23aae5ee68593de5b7e0a731c1a929 # v0.4.0
|
|
28
|
+
with:
|
|
29
|
+
# This gem requires Ruby 3.2, and so do busser 0.9 and cucumber 11.
|
|
30
|
+
# Without this the shared workflow would still start a Ruby 3.1 job and
|
|
31
|
+
# bundler would refuse to resolve there.
|
|
32
|
+
ruby_versions: '["3.2", "3.3", "3.4", "4.0"]'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "PR Title"
|
|
3
|
+
|
|
4
|
+
"on":
|
|
5
|
+
pull_request_target:
|
|
6
|
+
types: [opened, edited, reopened, synchronize]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
conventional-title:
|
|
13
|
+
name: "Conventional commit title"
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
pull-requests: read
|
|
17
|
+
steps:
|
|
18
|
+
# Pull requests here are squash merged, so the pull request title becomes
|
|
19
|
+
# the commit subject on main. That makes the title the one place worth
|
|
20
|
+
# checking: release-please reads those subjects to decide the next
|
|
21
|
+
# version and to build the changelog.
|
|
22
|
+
#
|
|
23
|
+
# pull_request_target is used so the check also runs for pull requests
|
|
24
|
+
# from forks. No repository code is checked out in this job, so none of
|
|
25
|
+
# the usual pull_request_target risk applies.
|
|
26
|
+
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
|
|
27
|
+
env:
|
|
28
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Release"
|
|
3
|
+
|
|
4
|
+
"on":
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release-please:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write # tag the release and commit the version bump
|
|
16
|
+
pull-requests: write # open and update the release pull request
|
|
17
|
+
packages: write # push the gem to GitHub Packages
|
|
18
|
+
steps:
|
|
19
|
+
# Opens and maintains a release pull request. Merging that pull request
|
|
20
|
+
# is what actually cuts a release, so every step below is skipped until
|
|
21
|
+
# release_created is set.
|
|
22
|
+
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
|
|
23
|
+
id: release
|
|
24
|
+
with:
|
|
25
|
+
token: ${{ secrets.PORTER_GITHUB_TOKEN }}
|
|
26
|
+
|
|
27
|
+
- name: Checkout code
|
|
28
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
29
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
30
|
+
|
|
31
|
+
# These two steps are handed publishing credentials, so they are pinned
|
|
32
|
+
# to a commit rather than a branch. A floating ref would let whoever
|
|
33
|
+
# controls that branch run code with a token that can push this gem.
|
|
34
|
+
- name: Publish to GitHub Packages
|
|
35
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
36
|
+
uses: actionshub/publish-gem-to-github@86eb0ce1ced1072298bf68776a32a5c9703ad9aa # v1.0.13
|
|
37
|
+
with:
|
|
38
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
39
|
+
owner: ${{ github.repository_owner }}
|
|
40
|
+
|
|
41
|
+
- name: Publish to RubyGems
|
|
42
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
43
|
+
uses: actionshub/publish-gem-to-rubygems@f9126f7a2d36a4fd31a13e78fde5fbdcc4b7b251 # v2.0.6
|
|
44
|
+
with:
|
|
45
|
+
token: ${{ secrets.RUBYGEMS_API_KEY }}
|
|
46
|
+
|
|
47
|
+
# actionshub/publish-gem-to-rubygems logs a rejected push and still exits
|
|
48
|
+
# 0, so a release that never reached RubyGems shows up as a green job.
|
|
49
|
+
# Ask RubyGems directly instead of trusting the step. The v2 endpoint is
|
|
50
|
+
# 404 until the exact version is indexed, so -f turns "not there" into a
|
|
51
|
+
# non-zero exit rather than a substring match on `gem list` output.
|
|
52
|
+
- name: Verify the release reached RubyGems
|
|
53
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
54
|
+
env:
|
|
55
|
+
VERSION: ${{ steps.release.outputs.version }}
|
|
56
|
+
run: |
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
name="$(basename "$(ls ./*.gemspec)" .gemspec)"
|
|
59
|
+
for _ in $(seq 1 12); do
|
|
60
|
+
if curl -fsS -o /dev/null "https://rubygems.org/api/v2/rubygems/${name}/versions/${VERSION}.json"; then
|
|
61
|
+
echo "${name} ${VERSION} is on RubyGems"
|
|
62
|
+
exit 0
|
|
63
|
+
fi
|
|
64
|
+
sleep 15
|
|
65
|
+
done
|
|
66
|
+
echo "::error::${name} ${VERSION} never reached RubyGems. A permissions failure in the push step above does not fail that step -- read its log."
|
|
67
|
+
exit 1
|
data/.gitignore
CHANGED
data/.markdownlint.yaml
ADDED
data/.rubocop.yml
ADDED
data/.yamllint
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
* Additional windows fixes for recent Omnibus Chef
|
|
4
4
|
* Documentation (`README`) updates
|
|
5
5
|
|
|
6
|
+
## [0.8.1](https://github.com/test-kitchen/busser-rspec/compare/v0.8.0...v0.8.1) (2026-08-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* quote paths before handing them to a shell ([#30](https://github.com/test-kitchen/busser-rspec/issues/30)) ([9410c75](https://github.com/test-kitchen/busser-rspec/commit/9410c755924525ab436e27beb017b7f43a8453bc))
|
|
12
|
+
|
|
13
|
+
## [0.8.0](https://github.com/test-kitchen/busser-rspec/compare/v0.7.6...v0.8.0) (2026-08-28)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### ⚠ BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* Ruby 3.1 and busser releases older than 0.9.0 are no longer supported.
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* require Ruby 3.2 and busser 0.9, adopt release-please ([#22](https://github.com/test-kitchen/busser-rspec/issues/22)) ([144aeb9](https://github.com/test-kitchen/busser-rspec/commit/144aeb9174d2d62597c962b3e75579e5b8c02226))
|
|
23
|
+
|
|
6
24
|
## 0.7.5 / 2015-09-17
|
|
7
25
|
|
|
8
26
|
* Fix bundle install on windows
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Contributing to busser-rspec
|
|
2
|
+
|
|
3
|
+
Thanks for taking the time to contribute. This document covers how to get the
|
|
4
|
+
project running locally, how to check your work before opening a pull request,
|
|
5
|
+
and the commit convention releases depend on.
|
|
6
|
+
|
|
7
|
+
## Getting set up
|
|
8
|
+
|
|
9
|
+
This plugin requires **Ruby 3.2 or newer**. Clone the repository and install the
|
|
10
|
+
development dependencies:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/test-kitchen/busser-rspec.git
|
|
14
|
+
cd busser-rspec
|
|
15
|
+
bundle install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Running the tests
|
|
19
|
+
|
|
20
|
+
`rake` runs the whole suite:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bundle exec rake test
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The tests are [cucumber](https://cucumber.io) features in `features/`. They
|
|
27
|
+
drive the real `busser` executable through
|
|
28
|
+
[aruba](https://github.com/cucumber/aruba) rather than calling the plugin's
|
|
29
|
+
classes, so they cover it end to end: install the plugin into a throwaway
|
|
30
|
+
Busser root, write a suite, run it, and check what came out. The step
|
|
31
|
+
definitions they use are published by busser itself, in `lib/busser/cucumber.rb`.
|
|
32
|
+
|
|
33
|
+
### How the feature sandbox works
|
|
34
|
+
|
|
35
|
+
Features that install the plugin sandbox `GEM_HOME` into a temporary directory
|
|
36
|
+
and strip bundler out of the environment, so a run never installs a gem into
|
|
37
|
+
your bundle. Two details matter if you add or change one:
|
|
38
|
+
|
|
39
|
+
* **Do not reintroduce bundler variables.** RubyGems re-requires
|
|
40
|
+
`bundler/setup` whenever `BUNDLER_SETUP` is present, and bundler then resets
|
|
41
|
+
`Gem.dir` to the bundle. Plugins install into `vendor/bundle` instead of the
|
|
42
|
+
sandbox, and the assertions that look in `GEM_HOME` fail. The
|
|
43
|
+
`a non bundler environment` step exists to clear this.
|
|
44
|
+
* **The plugin is installed from the working tree.** With bundler out of the
|
|
45
|
+
way, `busser plugin install` would fetch the last release from RubyGems and
|
|
46
|
+
run *its* postinstall — so the suite would pass on code that is not in your
|
|
47
|
+
branch. The `this plugin is installed from the working tree` step builds the
|
|
48
|
+
gem from the gemspec and installs it into the sandbox first, which is what
|
|
49
|
+
makes the features test your change.
|
|
50
|
+
|
|
51
|
+
## Linting
|
|
52
|
+
|
|
53
|
+
CI runs three linters, all of which you can run locally:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
bundle exec cookstyle --chefstyle # Ruby
|
|
57
|
+
yamllint --strict . # YAML
|
|
58
|
+
markdownlint-cli2 "**/*.md" "!**/CHANGELOG*.md"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Commit messages
|
|
62
|
+
|
|
63
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org).
|
|
64
|
+
Releases are automated, and the commit subject on `main` is what decides the
|
|
65
|
+
next version number and what appears in the changelog.
|
|
66
|
+
|
|
67
|
+
Pull requests are **squash merged, so the pull request title becomes that
|
|
68
|
+
subject**. A CI check enforces the format on the title; the individual commits
|
|
69
|
+
on your branch are not checked.
|
|
70
|
+
|
|
71
|
+
| Prefix | Effect on the next release |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `fix:` | Patch version bump |
|
|
74
|
+
| `feat:` | Minor version bump |
|
|
75
|
+
| `feat!:`, or a `BREAKING CHANGE:` footer | Minor bump, until this gem reaches 1.0 |
|
|
76
|
+
| `chore:`, `docs:`, `ci:`, `test:`, `refactor:` | No release |
|
|
77
|
+
|
|
78
|
+
For example:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
fix: install the plugin into GEM_HOME rather than the bundle
|
|
82
|
+
feat: support a Gemfile alongside the suite
|
|
83
|
+
ci: pin the shared workflow to a release
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Opening a pull request
|
|
87
|
+
|
|
88
|
+
1. Fork the repository and create a branch for your change.
|
|
89
|
+
2. Add or update tests. A bug fix should come with a test that fails without it.
|
|
90
|
+
3. Run `bundle exec rake test` and the linters above.
|
|
91
|
+
4. Open a pull request with a Conventional Commits title.
|
|
92
|
+
|
|
93
|
+
## Releases
|
|
94
|
+
|
|
95
|
+
Releases are handled by
|
|
96
|
+
[release-please](https://github.com/googleapis/release-please). It watches
|
|
97
|
+
commits landing on `main` and keeps a release pull request open with the next
|
|
98
|
+
version number and the accumulated changelog. Merging that pull request tags the
|
|
99
|
+
release and publishes the gem to RubyGems and GitHub Packages.
|
|
100
|
+
|
|
101
|
+
Maintainers do not bump `lib/busser/rspec/version.rb` or edit
|
|
102
|
+
`CHANGELOG.md` by hand; release-please owns both files. This gem is still pre-1.0, so
|
|
103
|
+
`bump-minor-pre-major` is set and a breaking change takes the minor rather than
|
|
104
|
+
graduating it to 1.0.
|
data/Gemfile
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
source
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
|
+
|
|
5
|
+
group :cookstyle do
|
|
6
|
+
gem "cookstyle", ">= 9.0"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
group :test do
|
|
10
|
+
gem "aruba", ">= 2.4"
|
|
11
|
+
gem "base64", ">= 0.3" # cucumber needs it; not a default gem on Ruby 4.0
|
|
12
|
+
gem "cucumber", ">= 11.1"
|
|
13
|
+
gem "minitest", ">= 6.0"
|
|
14
|
+
gem "mocha", ">= 2.7"
|
|
15
|
+
gem "rake", ">= 13.4"
|
|
16
|
+
gem "rspec", ">= 3.13"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
group :development do
|
|
20
|
+
gem "yard", ">= 0.9.37"
|
|
21
|
+
end
|
data/README.md
CHANGED
|
@@ -1,61 +1,149 @@
|
|
|
1
|
-
#
|
|
1
|
+
# busser-rspec
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/busser-rspec)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A [Busser](https://github.com/test-kitchen/busser) runner plugin that runs
|
|
6
|
+
[RSpec](https://rspec.info) examples as integration tests.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Busser installs RSpec on the machine under test during postinstall, then runs
|
|
9
|
+
the suite's `rspec` directory against it. Because the examples run on the
|
|
10
|
+
machine itself rather than over SSH, they can assert on local files, services
|
|
11
|
+
and commands directly.
|
|
12
|
+
|
|
13
|
+
## Status
|
|
14
|
+
|
|
15
|
+
This software project is no longer under active development as it has no active
|
|
16
|
+
maintainers. The software may continue to work for some or all use cases, but
|
|
17
|
+
issues filed in GitHub will most likely not be triaged. If a new maintainer is
|
|
18
|
+
interested in working on this project please come chat with us in #test-kitchen
|
|
19
|
+
on Chef Community Slack.
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
Ruby 3.2 or newer, and busser 0.9.0 or newer. The plugin installs RSpec 3.13 or
|
|
24
|
+
newer on the machine under test.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Busser installs the plugin for you when Test Kitchen runs the suite, so there is
|
|
29
|
+
usually nothing to do. To install it by hand:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
busser plugin install busser-rspec
|
|
33
|
+
```
|
|
8
34
|
|
|
9
35
|
## Usage
|
|
10
36
|
|
|
11
|
-
|
|
37
|
+
Put your specs in the `rspec` directory of a suite:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
test
|
|
41
|
+
`-- integration
|
|
42
|
+
`-- default # suite name
|
|
43
|
+
`-- rspec
|
|
44
|
+
|-- Gemfile # optional
|
|
45
|
+
|-- setup-recipe.rb # optional
|
|
46
|
+
|-- spec_helper.rb
|
|
47
|
+
`-- default_spec.rb
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The suite directory is passed to RSpec as the spec path, and both it and its
|
|
51
|
+
`lib` subdirectory are added to the load path — so `require "spec_helper"` works
|
|
52
|
+
from any spec without a relative path.
|
|
12
53
|
|
|
54
|
+
```ruby
|
|
55
|
+
describe "foobar::default" do
|
|
56
|
+
it "creates foobar.txt" do
|
|
57
|
+
expect(File).to exist("/usr/local/foobar.txt")
|
|
58
|
+
end
|
|
59
|
+
end
|
|
13
60
|
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
61
|
+
|
|
62
|
+
### Extra gems
|
|
63
|
+
|
|
64
|
+
If a `Gemfile` is present in the suite directory, it is `bundle install`ed
|
|
65
|
+
before the run. Remember to include RSpec itself:
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
source "https://rubygems.org"
|
|
69
|
+
|
|
70
|
+
gem "rspec"
|
|
21
71
|
```
|
|
22
72
|
|
|
23
|
-
|
|
73
|
+
The install is attempted with `--local` first and falls back to the network, so
|
|
74
|
+
gems already present on the machine do not cost a download.
|
|
24
75
|
|
|
25
|
-
|
|
76
|
+
### Chef setup
|
|
26
77
|
|
|
27
|
-
|
|
78
|
+
If a `setup-recipe.rb` is present in the suite directory, it is applied with
|
|
79
|
+
`chef-apply` before the specs run. This requires `/opt/chef/bin/chef-apply` on
|
|
80
|
+
the machine; the run fails with a clear error if the file is there and Chef is
|
|
81
|
+
not.
|
|
28
82
|
|
|
29
|
-
|
|
83
|
+
### Changing the formatter
|
|
84
|
+
|
|
85
|
+
`rspec -f` is not available here, since Busser invokes the runner itself. Set
|
|
86
|
+
the formatter from your specs instead:
|
|
30
87
|
|
|
31
88
|
```ruby
|
|
32
89
|
RSpec.configure do |config|
|
|
33
|
-
#
|
|
90
|
+
# the same as `rspec -f documentation`
|
|
34
91
|
config.add_formatter "documentation"
|
|
92
|
+
end
|
|
35
93
|
```
|
|
36
94
|
|
|
37
|
-
##
|
|
95
|
+
## Using it with Test Kitchen
|
|
96
|
+
|
|
97
|
+
This is how most people run it, and it needs no Busser commands of your own.
|
|
98
|
+
Select the verifier in `kitchen.yml`:
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
verifier:
|
|
102
|
+
name: busser
|
|
103
|
+
|
|
104
|
+
suites:
|
|
105
|
+
- name: default
|
|
106
|
+
```
|
|
38
107
|
|
|
39
|
-
|
|
40
|
-
* Report issues/questions/feature requests on [GitHub Issues](issues)
|
|
108
|
+
Then put your tests in a `rspec` directory inside the suite:
|
|
41
109
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
110
|
+
```text
|
|
111
|
+
test/integration/default/rspec/default_spec.rb
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`kitchen verify` installs Busser and this plugin on the instance and runs them.
|
|
115
|
+
The directory name is what selects this plugin -- there is nothing else to
|
|
116
|
+
configure.
|
|
117
|
+
|
|
118
|
+
## When nothing runs
|
|
119
|
+
|
|
120
|
+
If the suite files do not match what this plugin looks for, the run prints one
|
|
121
|
+
line and **exits `0`**:
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
-----> Running rspec test suite
|
|
125
|
+
```
|
|
45
126
|
|
|
46
|
-
|
|
47
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
48
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
49
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
50
|
-
5. Create new Pull Request
|
|
127
|
+
No tests ran, and nothing said so. Work through these in order:
|
|
51
128
|
|
|
52
|
-
|
|
129
|
+
1. **Is the directory named `rspec`?** That name alone selects this plugin.
|
|
130
|
+
`rspecs/`, `tests/` or anything else is not picked up.
|
|
131
|
+
2. **Do the filenames match?** RSpec takes `*_spec.rb` -- `smoke.rb` is
|
|
132
|
+
*not* picked up.
|
|
133
|
+
3. **Is the plugin installed?** `busser plugin list` shows what is available.
|
|
134
|
+
4. **Is `BUSSER_ROOT` what you think?** `busser suite path` prints where suites
|
|
135
|
+
are actually being looked for.
|
|
53
136
|
|
|
54
|
-
|
|
137
|
+
## Contributing
|
|
55
138
|
|
|
56
|
-
|
|
139
|
+
Bug reports and pull requests are welcome. See
|
|
140
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for how to set up the project, run the test
|
|
141
|
+
suite, and format your commits.
|
|
57
142
|
|
|
58
143
|
## License
|
|
59
144
|
|
|
60
|
-
Apache 2.0
|
|
145
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
61
146
|
|
|
147
|
+
Originally created by [Adam Jacob](https://github.com/adamhjk), based on
|
|
148
|
+
[Daisuke Higuchi](https://github.com/cl-lab-k)'s
|
|
149
|
+
[busser-serverspec](https://github.com/test-kitchen/busser-serverspec).
|
data/Rakefile
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
|
-
require
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
t.cucumber_opts = ['features', '-x', '--format progress']
|
|
2
|
+
require "rake/testtask"
|
|
3
|
+
Rake::TestTask.new(:unit) do |t|
|
|
4
|
+
t.libs.push "lib"
|
|
5
|
+
t.test_files = FileList["spec/**/*_spec.rb"]
|
|
6
|
+
t.verbose = true
|
|
8
7
|
end
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
task :test => [:features]
|
|
9
|
+
require "cucumber/rake/task"
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
cane.canefile = './.cane'
|
|
11
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
|
12
|
+
t.cucumber_opts = ["features", "--format progress", "--fail-fast"]
|
|
16
13
|
end
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
# yard lives in the :development group, which CI omits when it runs the tests.
|
|
16
|
+
# Requiring it unconditionally would make `rake test` fail there, so the real
|
|
17
|
+
# task is only defined when yard is installed and a stub explains its absence
|
|
18
|
+
# otherwise. Nothing in CI gates on documentation.
|
|
19
|
+
begin
|
|
20
|
+
require "yard"
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
|
23
|
+
t.files = ["lib/**/*.rb"]
|
|
24
|
+
t.options = ["--output-dir", "doc", "--markup", "markdown"]
|
|
25
|
+
end
|
|
26
|
+
rescue LoadError
|
|
27
|
+
desc "Generate YARD documentation (install the development group first)"
|
|
28
|
+
task :doc do
|
|
29
|
+
abort "yard is not available. Run `bundle install --with development` first."
|
|
30
|
+
end
|
|
26
31
|
end
|
|
27
32
|
|
|
28
|
-
desc "Run all
|
|
29
|
-
task :
|
|
33
|
+
desc "Run all test suites"
|
|
34
|
+
task test: %i{unit features}
|
|
30
35
|
|
|
31
|
-
task :
|
|
36
|
+
task default: [:test]
|
data/busser-rspec.gemspec
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require
|
|
3
|
+
require "busser/rspec/version"
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
6
|
+
spec.name = "busser-rspec"
|
|
8
7
|
spec.version = Busser::Rspec::VERSION
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
11
|
-
spec.description =
|
|
8
|
+
spec.authors = ["Adam Jacob"]
|
|
9
|
+
spec.email = ["adam@opscode.com"]
|
|
10
|
+
spec.description = "A Busser runner plugin for RSpec"
|
|
12
11
|
spec.summary = spec.description
|
|
13
|
-
spec.homepage =
|
|
14
|
-
spec.license =
|
|
12
|
+
spec.homepage = "https://github.com/test-kitchen/busser-rspec"
|
|
13
|
+
spec.license = "Apache-2.0"
|
|
15
14
|
|
|
16
|
-
spec.
|
|
17
|
-
spec.executables = []
|
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
-
spec.require_paths = ['lib']
|
|
15
|
+
spec.required_ruby_version = ">= 3.2"
|
|
20
16
|
|
|
21
|
-
spec.
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
18
|
+
spec.executables = []
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
22
20
|
|
|
23
|
-
spec.
|
|
24
|
-
|
|
21
|
+
spec.metadata = {
|
|
22
|
+
"bug_tracker_uri" => "#{spec.homepage}/issues",
|
|
23
|
+
"changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
|
|
24
|
+
"documentation_uri" => "#{spec.homepage}/blob/main/README.md",
|
|
25
|
+
"homepage_uri" => spec.homepage,
|
|
26
|
+
"source_code_uri" => spec.homepage,
|
|
27
|
+
}
|
|
25
28
|
|
|
26
|
-
spec.
|
|
27
|
-
spec.add_development_dependency 'rake'
|
|
28
|
-
spec.add_development_dependency 'aruba'
|
|
29
|
-
spec.add_development_dependency 'cane'
|
|
30
|
-
spec.add_development_dependency 'tailor'
|
|
31
|
-
spec.add_development_dependency 'countloc'
|
|
29
|
+
spec.add_dependency "busser", ">= 0.9.0"
|
|
32
30
|
end
|
|
@@ -4,8 +4,10 @@ Feature: Plugin install command
|
|
|
4
4
|
I want to run the postinstall for this plugin
|
|
5
5
|
|
|
6
6
|
Background:
|
|
7
|
-
Given a
|
|
7
|
+
Given a non bundler environment
|
|
8
|
+
And a test BUSSER_ROOT directory named "busser-rspec-install"
|
|
8
9
|
And a sandboxed GEM_HOME directory named "busser-rspec-gem-home"
|
|
10
|
+
And this plugin is installed from the working tree
|
|
9
11
|
|
|
10
12
|
Scenario: Running the postinstall generator
|
|
11
13
|
When I run `busser plugin install busser-rspec --force-postinstall`
|
data/features/support/env.rb
CHANGED
|
@@ -1,13 +1,48 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require "fileutils" unless defined?(FileUtils)
|
|
2
|
+
require "rubygems/package"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
require "aruba/cucumber"
|
|
5
|
+
require "busser/cucumber"
|
|
6
|
+
|
|
7
|
+
# aruba 2 dropped @aruba_timeout_seconds; setting it in a Before hook is a
|
|
8
|
+
# no-op, which quietly left these commands on aruba's 15 second default.
|
|
9
|
+
# Installing a plugin and its gems into a cold sandbox does not always fit.
|
|
10
|
+
Aruba.configure do |config|
|
|
11
|
+
config.exit_timeout = 120
|
|
6
12
|
end
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
# The sandboxed features shell out to `busser plugin install <this plugin>`, and
|
|
15
|
+
# two things have to hold for that to exercise this checkout:
|
|
16
|
+
#
|
|
17
|
+
# * The child has to be free of bundler. RubyGems re-requires bundler/setup
|
|
18
|
+
# whenever BUNDLER_SETUP is set, and bundler then resets Gem.dir to the
|
|
19
|
+
# bundle, so busser installs into vendor/bundle rather than the sandboxed
|
|
20
|
+
# GEM_HOME the features assert against. busser's "a non bundler environment"
|
|
21
|
+
# step clears that, and has to run before the sandbox is set up.
|
|
22
|
+
# * The plugin has to already be in that sandbox. Otherwise busser fetches the
|
|
23
|
+
# last release from RubyGems and runs *its* postinstall, which means CI
|
|
24
|
+
# silently tests the published gem instead of the code under review.
|
|
25
|
+
#
|
|
26
|
+
# So build the gem from the working tree and install it into the sandbox first.
|
|
27
|
+
Given(/^this plugin is installed from the working tree$/) do
|
|
28
|
+
root = File.expand_path("../..", __dir__)
|
|
29
|
+
package = nil
|
|
30
|
+
|
|
31
|
+
begin
|
|
32
|
+
Dir.chdir(root) do
|
|
33
|
+
spec = Gem::Specification.load(Dir["*.gemspec"].first)
|
|
34
|
+
package = Gem::Package.build(spec)
|
|
35
|
+
|
|
36
|
+
# --ignore-dependencies keeps this from reaching the network: busser and
|
|
37
|
+
# the rest are already resolvable through the GEM_PATH the sandbox step
|
|
38
|
+
# leaves in place.
|
|
39
|
+
installed = system(
|
|
40
|
+
Gem.ruby, "-S", "gem", "install", "--local", "--no-document",
|
|
41
|
+
"--ignore-dependencies", package, out: File::NULL
|
|
42
|
+
)
|
|
43
|
+
raise "could not install #{package} into #{ENV["GEM_HOME"]}" unless installed
|
|
44
|
+
end
|
|
45
|
+
ensure
|
|
46
|
+
FileUtils.rm_f(File.join(root, package)) if package
|
|
47
|
+
end
|
|
13
48
|
end
|
|
@@ -4,8 +4,10 @@ Feature: Test command
|
|
|
4
4
|
I want my tests to run when the rspec runner plugin is installed
|
|
5
5
|
|
|
6
6
|
Background:
|
|
7
|
-
Given a
|
|
7
|
+
Given a non bundler environment
|
|
8
|
+
And a test BUSSER_ROOT directory named "busser-rspec-test"
|
|
8
9
|
And a sandboxed GEM_HOME directory named "busser-rspec-gem-home"
|
|
10
|
+
And this plugin is installed from the working tree
|
|
9
11
|
When I successfully run `busser plugin install busser-rspec --force-postinstall`
|
|
10
12
|
Given a suite directory named "rspec"
|
|
11
13
|
|
data/lib/busser/rspec/runner.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
# -*- encoding: utf-8 -*-
|
|
3
2
|
#
|
|
4
3
|
# Author:: HIGUCHI Daisuke (<d-higuchi@creationline.com>)
|
|
5
4
|
#
|
|
@@ -17,7 +16,7 @@
|
|
|
17
16
|
# See the License for the specific language governing permissions and
|
|
18
17
|
# limitations under the License.
|
|
19
18
|
|
|
20
|
-
require
|
|
21
|
-
require
|
|
19
|
+
require "bundler/setup"
|
|
20
|
+
require "rspec/core"
|
|
22
21
|
|
|
23
22
|
exit RSpec::Core::Runner.run(ARGV)
|
data/lib/busser/rspec/version.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
1
|
#
|
|
3
2
|
# Author:: HIGUCHI Daisuke (<d-higuchi@creationline.com>)
|
|
4
3
|
#
|
|
@@ -18,9 +17,10 @@
|
|
|
18
17
|
|
|
19
18
|
module Busser
|
|
20
19
|
|
|
20
|
+
# Namespace for the RSpec Busser runner plugin.
|
|
21
21
|
module Rspec
|
|
22
22
|
|
|
23
23
|
# Version string for the Rspec Busser runner plugin
|
|
24
|
-
VERSION = "0.
|
|
24
|
+
VERSION = "0.8.1".freeze
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
1
|
#
|
|
3
2
|
# Author:: HIGUCHI Daisuke (<d-higuchi@creationline.com>)
|
|
4
3
|
#
|
|
@@ -16,48 +15,115 @@
|
|
|
16
15
|
# See the License for the specific language governing permissions and
|
|
17
16
|
# limitations under the License.
|
|
18
17
|
|
|
19
|
-
require
|
|
20
|
-
require
|
|
18
|
+
require "busser/runner_plugin"
|
|
19
|
+
require "rubygems" unless defined?(Gem)
|
|
20
|
+
require "rbconfig" unless defined?(RbConfig)
|
|
21
|
+
require "shellwords" unless defined?(Shellwords)
|
|
21
22
|
|
|
22
23
|
# A Busser runner plugin for Rspec.
|
|
23
24
|
#
|
|
24
25
|
# @author Adam Jacob <adam@opscode.com>
|
|
25
26
|
#
|
|
26
27
|
class Busser::RunnerPlugin::Rspec < Busser::RunnerPlugin::Base
|
|
28
|
+
|
|
29
|
+
# Builds the command that runs the suite.
|
|
30
|
+
#
|
|
31
|
+
# The suite directory goes on the load path twice -- itself and its lib
|
|
32
|
+
# subdirectory -- so `require "spec_helper"` works from any spec without a
|
|
33
|
+
# relative path.
|
|
34
|
+
#
|
|
35
|
+
# Every path is quoted. BUSSER_ROOT is user supplied, and an unquoted path
|
|
36
|
+
# containing a space would be split by the shell into arguments RSpec would
|
|
37
|
+
# then treat as extra spec paths.
|
|
38
|
+
#
|
|
39
|
+
# @param runner [String] path to the runner script
|
|
40
|
+
# @param suite [String, Pathname] the suite directory holding the specs
|
|
41
|
+
# @return [String] the command to run
|
|
42
|
+
def self.runner_command(runner, suite)
|
|
43
|
+
suite = suite.to_s
|
|
44
|
+
[
|
|
45
|
+
Shellwords.escape(runner),
|
|
46
|
+
"-I", Shellwords.escape(suite),
|
|
47
|
+
"-I", Shellwords.escape(File.join(suite, "lib")),
|
|
48
|
+
Shellwords.escape(suite)
|
|
49
|
+
].join(" ")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Installs RSpec and bundler onto the machine under test. Runs once, when
|
|
53
|
+
# Busser installs this plugin.
|
|
54
|
+
# Builds the chef-apply command for a suite's setup recipe.
|
|
55
|
+
#
|
|
56
|
+
# @param setup_file [String, Pathname] path to the setup recipe
|
|
57
|
+
# @return [String] the command to run
|
|
58
|
+
def self.chef_apply_command(setup_file)
|
|
59
|
+
"/opt/chef/bin/chef-apply #{Shellwords.escape(setup_file.to_s)}"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Builds the bundle install command for a suite's own Gemfile.
|
|
63
|
+
#
|
|
64
|
+
# bundler is invoked through the Ruby running Busser rather than whatever
|
|
65
|
+
# `bundle` is on PATH, since on a machine with several Rubies those differ and
|
|
66
|
+
# the suite's gems would land where the runner cannot see them.
|
|
67
|
+
#
|
|
68
|
+
# The --local attempt is a speed optimisation: it finishes immediately when
|
|
69
|
+
# the gems are already present and fails when it would need the network, so
|
|
70
|
+
# the second attempt is the fallback.
|
|
71
|
+
#
|
|
72
|
+
# @param gemfile [String, Pathname] path to the suite's Gemfile
|
|
73
|
+
# @return [String] the command to run
|
|
74
|
+
def self.bundle_install_command(gemfile)
|
|
75
|
+
bundle = [
|
|
76
|
+
Shellwords.escape(File.join(RbConfig::CONFIG["bindir"], "ruby")),
|
|
77
|
+
Shellwords.escape(File.join(Gem.bindir, "bundle")),
|
|
78
|
+
"install", "--gemfile", Shellwords.escape(gemfile.to_s)
|
|
79
|
+
].join(" ")
|
|
80
|
+
|
|
81
|
+
"#{bundle} --local || #{bundle}"
|
|
82
|
+
end
|
|
83
|
+
|
|
27
84
|
postinstall do
|
|
28
|
-
install_gem("rspec")
|
|
85
|
+
install_gem("rspec", ">= 3.13")
|
|
29
86
|
install_gem("bundler")
|
|
30
87
|
end
|
|
31
88
|
|
|
89
|
+
# Runs the suite's specs.
|
|
90
|
+
#
|
|
91
|
+
# If the suite ships a Gemfile its gems are installed first, and if it ships a
|
|
92
|
+
# setup-recipe.rb that recipe is applied with chef-apply to put the machine
|
|
93
|
+
# into a known state.
|
|
94
|
+
#
|
|
95
|
+
# @raise [RuntimeError] if a setup recipe is present but chef-apply is not
|
|
96
|
+
# installed, since running the specs against an unprepared machine would
|
|
97
|
+
# produce misleading failures
|
|
98
|
+
# @return [void]
|
|
32
99
|
def test
|
|
33
|
-
rspec_path = suite_path(
|
|
100
|
+
rspec_path = suite_path("rspec").to_s
|
|
34
101
|
|
|
35
102
|
setup_file = File.join(rspec_path, "setup-recipe.rb")
|
|
36
103
|
|
|
37
104
|
Dir.chdir(rspec_path) do
|
|
38
105
|
|
|
39
106
|
# Referred from busser-serverspec
|
|
40
|
-
gemfile_path = File.join(rspec_path,
|
|
41
|
-
if File.
|
|
107
|
+
gemfile_path = File.join(rspec_path, "Gemfile")
|
|
108
|
+
if File.exist?(gemfile_path)
|
|
42
109
|
# Bundle install local completes quickly if the gems are already found locally
|
|
43
110
|
# it fails if it needs to talk to the internet. The || below is the fallback
|
|
44
111
|
# to the internet-enabled version. It's a speed optimization.
|
|
45
|
-
banner(
|
|
46
|
-
ENV[
|
|
47
|
-
|
|
48
|
-
"#{File.join(Gem.bindir, 'bundle')} install --gemfile #{gemfile_path}"
|
|
49
|
-
run("#{bundle_exec} --local || #{bundle_exec}")
|
|
112
|
+
banner("Bundle Installing..")
|
|
113
|
+
ENV["PATH"] = [ENV["PATH"], Gem.bindir, RbConfig::CONFIG["bindir"]].join(File::PATH_SEPARATOR)
|
|
114
|
+
run(self.class.bundle_install_command(gemfile_path))
|
|
50
115
|
end
|
|
51
116
|
|
|
52
|
-
if File.
|
|
53
|
-
|
|
54
|
-
raise "You have a chef setup file at #{setup_file}, but /opt/chef/bin/chef-apply does not
|
|
117
|
+
if File.exist?(setup_file)
|
|
118
|
+
unless File.exist?("/opt/chef/bin/chef-apply")
|
|
119
|
+
raise "You have a chef setup file at #{setup_file}, but /opt/chef/bin/chef-apply does not exist"
|
|
55
120
|
end
|
|
56
|
-
|
|
121
|
+
|
|
122
|
+
run(self.class.chef_apply_command(setup_file))
|
|
57
123
|
end
|
|
58
124
|
|
|
59
125
|
runner = File.expand_path(File.join(File.dirname(__FILE__), "..", "rspec", "runner.rb"))
|
|
60
|
-
run_ruby_script!(
|
|
126
|
+
run_ruby_script!(self.class.runner_command(runner, rspec_path))
|
|
61
127
|
end
|
|
62
128
|
end
|
|
63
129
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
|
+
"bootstrap-sha": "ec6c35fd8840d47bd7c30c9a7a425bee46f5282b",
|
|
4
|
+
"packages": {
|
|
5
|
+
".": {
|
|
6
|
+
"package-name": "busser-rspec",
|
|
7
|
+
"changelog-path": "CHANGELOG.md",
|
|
8
|
+
"release-type": "ruby",
|
|
9
|
+
"include-component-in-tag": false,
|
|
10
|
+
"version-file": "lib/busser/rspec/version.rb",
|
|
11
|
+
"bump-minor-pre-major": true,
|
|
12
|
+
"bump-patch-for-minor-pre-major": true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
data/renovate.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require_relative "../../spec_helper"
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
require "shellwords"
|
|
5
|
+
require "busser/runner_plugin/rspec"
|
|
6
|
+
|
|
7
|
+
describe Busser::RunnerPlugin::Rspec do
|
|
8
|
+
describe ".runner_command" do
|
|
9
|
+
let(:cmd) do
|
|
10
|
+
Busser::RunnerPlugin::Rspec.runner_command("/gems/busser-rspec/lib/busser/rspec/runner.rb",
|
|
11
|
+
"/opt/busser/suites/rspec")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "runs the runner script against the suite" do
|
|
15
|
+
_(Shellwords.split(cmd)).must_equal [
|
|
16
|
+
"/gems/busser-rspec/lib/busser/rspec/runner.rb",
|
|
17
|
+
"-I", "/opt/busser/suites/rspec",
|
|
18
|
+
"-I", "/opt/busser/suites/rspec/lib",
|
|
19
|
+
"/opt/busser/suites/rspec"
|
|
20
|
+
]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Documented behaviour: spec_helper.rb is required without a relative path,
|
|
24
|
+
# which only works while the suite is on the load path.
|
|
25
|
+
it "puts the suite and its lib directory on the load path" do
|
|
26
|
+
_(Shellwords.split(cmd).each_cons(2).select { |flag, _| flag == "-I" }.map(&:last))
|
|
27
|
+
.must_equal ["/opt/busser/suites/rspec", "/opt/busser/suites/rspec/lib"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "quotes a suite path containing spaces" do
|
|
31
|
+
cmd = Busser::RunnerPlugin::Rspec.runner_command("/a/runner.rb", "/tmp/my tests/rspec")
|
|
32
|
+
|
|
33
|
+
_(Shellwords.split(cmd)).must_equal [
|
|
34
|
+
"/a/runner.rb",
|
|
35
|
+
"-I", "/tmp/my tests/rspec",
|
|
36
|
+
"-I", "/tmp/my tests/rspec/lib",
|
|
37
|
+
"/tmp/my tests/rspec"
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "accepts a Pathname suite" do
|
|
42
|
+
cmd = Busser::RunnerPlugin::Rspec.runner_command("/a/runner.rb", Pathname.new("/b/rspec"))
|
|
43
|
+
_(Shellwords.split(cmd).last).must_equal "/b/rspec"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe ".chef_apply_command" do
|
|
48
|
+
it "applies the setup recipe with chef-apply" do
|
|
49
|
+
cmd = Busser::RunnerPlugin::Rspec.chef_apply_command("/suite/setup-recipe.rb")
|
|
50
|
+
|
|
51
|
+
_(Shellwords.split(cmd))
|
|
52
|
+
.must_equal ["/opt/chef/bin/chef-apply", "/suite/setup-recipe.rb"]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "quotes a path containing spaces" do
|
|
56
|
+
cmd = Busser::RunnerPlugin::Rspec.chef_apply_command("/tmp/my tests/setup-recipe.rb")
|
|
57
|
+
|
|
58
|
+
_(Shellwords.split(cmd).last).must_equal "/tmp/my tests/setup-recipe.rb"
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe ".bundle_install_command" do
|
|
63
|
+
let(:cmd) { Busser::RunnerPlugin::Rspec.bundle_install_command("/suite/Gemfile") }
|
|
64
|
+
|
|
65
|
+
it "invokes bundler through the running Ruby rather than PATH" do
|
|
66
|
+
first, second = Shellwords.split(cmd).first(2)
|
|
67
|
+
|
|
68
|
+
_(first).must_equal File.join(RbConfig::CONFIG["bindir"], "ruby")
|
|
69
|
+
_(second).must_equal File.join(Gem.bindir, "bundle")
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "names the suite's Gemfile explicitly" do
|
|
73
|
+
_(Shellwords.split(cmd)).must_include "/suite/Gemfile"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "falls back from the local attempt to a networked one" do
|
|
77
|
+
_(cmd).must_include "--local || "
|
|
78
|
+
_(cmd.scan("--gemfile").length).must_equal 2
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "quotes a Gemfile path containing spaces" do
|
|
82
|
+
cmd = Busser::RunnerPlugin::Rspec.bundle_install_command("/tmp/my tests/Gemfile")
|
|
83
|
+
|
|
84
|
+
_(Shellwords.split(cmd.split(" || ").first)).must_include "/tmp/my tests/Gemfile"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: busser-rspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Jacob
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-08-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: busser
|
|
@@ -16,126 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.9.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
|
-
version:
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rspec
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: chef
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: bundler
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '1.3'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '1.3'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rake
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: aruba
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: cane
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - ">="
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0'
|
|
104
|
-
type: :development
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - ">="
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: tailor
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - ">="
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
118
|
-
type: :development
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - ">="
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
125
|
-
- !ruby/object:Gem::Dependency
|
|
126
|
-
name: countloc
|
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
|
128
|
-
requirements:
|
|
129
|
-
- - ">="
|
|
130
|
-
- !ruby/object:Gem::Version
|
|
131
|
-
version: '0'
|
|
132
|
-
type: :development
|
|
133
|
-
prerelease: false
|
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
-
requirements:
|
|
136
|
-
- - ">="
|
|
137
|
-
- !ruby/object:Gem::Version
|
|
138
|
-
version: '0'
|
|
26
|
+
version: 0.9.0
|
|
139
27
|
description: A Busser runner plugin for RSpec
|
|
140
28
|
email:
|
|
141
29
|
- adam@opscode.com
|
|
@@ -143,11 +31,16 @@ executables: []
|
|
|
143
31
|
extensions: []
|
|
144
32
|
extra_rdoc_files: []
|
|
145
33
|
files:
|
|
146
|
-
- ".
|
|
34
|
+
- ".github/workflows/ci.yml"
|
|
35
|
+
- ".github/workflows/pr-title.yml"
|
|
36
|
+
- ".github/workflows/publish.yml"
|
|
147
37
|
- ".gitignore"
|
|
148
|
-
- ".
|
|
149
|
-
- ".
|
|
38
|
+
- ".markdownlint.yaml"
|
|
39
|
+
- ".release-please-manifest.json"
|
|
40
|
+
- ".rubocop.yml"
|
|
41
|
+
- ".yamllint"
|
|
150
42
|
- CHANGELOG.md
|
|
43
|
+
- CONTRIBUTING.md
|
|
151
44
|
- Gemfile
|
|
152
45
|
- LICENSE
|
|
153
46
|
- README.md
|
|
@@ -160,11 +53,20 @@ files:
|
|
|
160
53
|
- lib/busser/rspec/runner.rb
|
|
161
54
|
- lib/busser/rspec/version.rb
|
|
162
55
|
- lib/busser/runner_plugin/rspec.rb
|
|
163
|
-
|
|
56
|
+
- release-please-config.json
|
|
57
|
+
- renovate.json
|
|
58
|
+
- spec/busser/runner_plugin/rspec_spec.rb
|
|
59
|
+
- spec/spec_helper.rb
|
|
60
|
+
homepage: https://github.com/test-kitchen/busser-rspec
|
|
164
61
|
licenses:
|
|
165
|
-
- Apache
|
|
166
|
-
metadata:
|
|
167
|
-
|
|
62
|
+
- Apache-2.0
|
|
63
|
+
metadata:
|
|
64
|
+
bug_tracker_uri: https://github.com/test-kitchen/busser-rspec/issues
|
|
65
|
+
changelog_uri: https://github.com/test-kitchen/busser-rspec/blob/main/CHANGELOG.md
|
|
66
|
+
documentation_uri: https://github.com/test-kitchen/busser-rspec/blob/main/README.md
|
|
67
|
+
homepage_uri: https://github.com/test-kitchen/busser-rspec
|
|
68
|
+
source_code_uri: https://github.com/test-kitchen/busser-rspec
|
|
69
|
+
post_install_message:
|
|
168
70
|
rdoc_options: []
|
|
169
71
|
require_paths:
|
|
170
72
|
- lib
|
|
@@ -172,20 +74,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
172
74
|
requirements:
|
|
173
75
|
- - ">="
|
|
174
76
|
- !ruby/object:Gem::Version
|
|
175
|
-
version: '
|
|
77
|
+
version: '3.2'
|
|
176
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
79
|
requirements:
|
|
178
80
|
- - ">="
|
|
179
81
|
- !ruby/object:Gem::Version
|
|
180
82
|
version: '0'
|
|
181
83
|
requirements: []
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
signing_key:
|
|
84
|
+
rubygems_version: 3.5.9
|
|
85
|
+
signing_key:
|
|
185
86
|
specification_version: 4
|
|
186
87
|
summary: A Busser runner plugin for RSpec
|
|
187
|
-
test_files:
|
|
188
|
-
- features/plugin_install_command.feature
|
|
189
|
-
- features/plugin_list_command.feature
|
|
190
|
-
- features/support/env.rb
|
|
191
|
-
- features/test_command.feature
|
|
88
|
+
test_files: []
|
data/.cane
DELETED
|
File without changes
|
data/.tailor
DELETED