busser-bats 0.3.0 → 0.4.0

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
- SHA1:
3
- metadata.gz: 2c613c540bc4ab8518fd66d06d7fce1080b5a252
4
- data.tar.gz: 6ecfe900ccff1587a141dbad3828f2c1a3a85930
2
+ SHA256:
3
+ metadata.gz: 25555dd09144f5878b369f4a6ba1d42f68906ae39f930f691e02922c5f1cd533
4
+ data.tar.gz: 34253029bd8b1329835525de5cb054c82a0abf855aa768dd93bc12643961ca77
5
5
  SHA512:
6
- metadata.gz: 2d3ac5d61c193e198fdc9369107202b194d1ff36e7a2cb25cd50b36c6f9a60b1a0a9f72f74e29ecc7fed417b9ef53a83d2256f349847b1e0c98c4a66c0b65421
7
- data.tar.gz: 035d76978a2ad3cc1172eb4a0c0bb6b6819a9c95f62d66259fe20f2ff364ed2ec189dbac26ba0179ce86d72639ab3f05a9e5cbe31c5bc4199d942a695f06d235
6
+ metadata.gz: 54761dc95010ed5de2d51f94c42ddd8859d5f01143ab609178bff51f0827e2731517d358ae9b4154fcbab2105ab93d3513e36a914c0bba8f0c4350ca03e65ec5
7
+ data.tar.gz: 016e6c24320cd8f9bb499015686d135165ee2fa7eded938d432c1f1e09ea75f3af05ccde06c599b2954ebbd103ba26c7939ff2b8d7e692a537232db3e557c806
@@ -0,0 +1,8 @@
1
+ ---
2
+ version: 2
3
+ updates:
4
+ - package-ecosystem: bundler
5
+ directory: "/"
6
+ schedule:
7
+ interval: daily
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: "Test"
3
+
4
+ "on":
5
+ pull_request:
6
+
7
+ jobs:
8
+ lint-unit:
9
+ uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.2
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: release-please
3
+
4
+ "on":
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ release-please:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: google-github-actions/release-please-action@v3
13
+ id: release
14
+ with:
15
+ release-type: ruby
16
+ package-name: busser-bats
17
+ version-file: lib/busser/bats/version.rb
18
+ token: ${{ secrets.PORTER_GITHUB_TOKEN }}
19
+
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+ if: ${{ steps.release.outputs.release_created }}
23
+
24
+ - name: Build and publish to GitHub Package
25
+ uses: actionshub/publish-gem-to-github@main
26
+ if: ${{ steps.release.outputs.release_created }}
27
+ with:
28
+ token: ${{ secrets.GITHUB_TOKEN }}
29
+ owner: ${{ secrets.OWNER }}
30
+
31
+ - name: Build and publish to RubyGems
32
+ uses: actionshub/publish-gem-to-rubygems@main
33
+ if: ${{ steps.release.outputs.release_created }}
34
+ with:
35
+ token: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ reports.html
@@ -0,0 +1,7 @@
1
+ {
2
+ "fix": false,
3
+ "globs": ["**/*.md", "!vendor"],
4
+ // "ignores": ["ignore*.md"],
5
+ "noProgress": false,
6
+ "showFound": true
7
+ }
@@ -0,0 +1,9 @@
1
+ ---
2
+ default: true
3
+ MD013: false
4
+ MD024: false
5
+ MD026: false
6
+ MD036: false
7
+ MD012: false
8
+ MD029: false
9
+ MD004: false
data/.rubocop.yml CHANGED
@@ -1,3 +1,11 @@
1
- Style/ClassAndModuleChildren:
1
+ ---
2
+ require:
3
+ - chefstyle
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.7
7
+ Include:
8
+ - "**/*.rb"
2
9
  Exclude:
3
- - lib/busser/runner_plugin/bats.rb
10
+ - "vendor/**/*"
11
+ - "spec/**/*"
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # busser-bats Changelog
2
+
3
+ ## [0.4.0](https://github.com/test-kitchen/busser-bats/compare/v0.3.0...v0.4.0) (2023-11-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add publish workflow, lint workflow ([#24](https://github.com/test-kitchen/busser-bats/issues/24)) ([1a8adb3](https://github.com/test-kitchen/busser-bats/commit/1a8adb3f146b10173aec2a779b0a3fb43745be11))
9
+
10
+ ## [0.3.0](https://github.com/test-kitchen/busser-bats/compare/v0.2.0...v0.3.0) (2023-11-30)
11
+
12
+
13
+ ### Features
14
+
15
+ * Add publish workflow, lint workflow ([#24](https://github.com/test-kitchen/busser-bats/issues/24)) ([1a8adb3](https://github.com/test-kitchen/busser-bats/commit/1a8adb3f146b10173aec2a779b0a3fb43745be11))
16
+
1
17
  ## 0.3.0 / 2014-10-14
2
18
 
3
19
  ### New features
@@ -22,4 +38,4 @@
22
38
  * Initial release
23
39
 
24
40
  <!--- The following link definition list is generated by PimpMyChangelog --->
25
- [@fnichol]: https://github.com/fnichol
41
+ [@fnichol]: https://github.com/fnichol
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  source "https://rubygems.org"
3
2
 
4
3
  gemspec
@@ -8,3 +7,21 @@ group :guard do
8
7
  gem "guard-cane"
9
8
  gem "guard-rubocop"
10
9
  end
10
+
11
+ group :test do
12
+ gem "rake", ">= 11.0"
13
+ gem "rspec", "~> 3.2"
14
+ end
15
+
16
+ group :development do
17
+ gem "aruba"
18
+ gem "countloc"
19
+ gem "simplecov"
20
+
21
+ # gem "finstyle", "1.2.0"
22
+ gem "cane", "2.6.2"
23
+ end
24
+
25
+ group :chefstyle do
26
+ gem "chefstyle", "2.2.3"
27
+ end
data/README.md CHANGED
@@ -1,21 +1,24 @@
1
- # <a name="title"></a> Busser::RunnerPlugin::Bats
1
+ # Busser::RunnerPlugin::Bats
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/busser-bats.png)](http://badge.fury.io/rb/busser-bats)
4
4
  [![Build Status](https://travis-ci.org/test-kitchen/busser-bats.png?branch=master)](https://travis-ci.org/test-kitchen/busser-bats)
5
5
  [![Code Climate](https://codeclimate.com/github/test-kitchen/busser-bats.png)](https://codeclimate.com/github/test-kitchen/busser-bats)
6
- [![Dependency Status](https://gemnasium.com/test-kitchen/busser-bats.svg)](https://gemnasium.com/test-kitchen/busser-bats)
7
6
 
8
7
  A Busser runner plugin for [Bats][bats_site]
9
8
 
10
- ## <a name="installation"></a> Installation and Setup
9
+ ## Status
10
+
11
+ This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.
12
+
13
+ ## Installation and Setup
11
14
 
12
15
  Until proper reference documentation is complete, the [Writing a Test](http://kitchen.ci/docs/getting-started/writing-test) section of the Test Kitchen's [Getting Started Guide](http://kitchen.ci/docs/getting-started/) gives a working example of creating a bats test.
13
16
 
14
- ## <a name="usage"></a> Usage
17
+ ## Usage
15
18
 
16
19
  **TODO:** Write documentation explaining the structure/format of testing files.
17
20
 
18
- ## <a name="development"></a> Development
21
+ ## Development
19
22
 
20
23
  * Source hosted at [GitHub][repo]
21
24
  * Report issues/questions/feature requests on [GitHub Issues][issues]
@@ -30,11 +33,11 @@ example:
30
33
  4. Push to the branch (`git push origin my-new-feature`)
31
34
  5. Create new Pull Request
32
35
 
33
- ## <a name="authors"></a> Authors
36
+ ## Authors
34
37
 
35
38
  Created and maintained by [Fletcher Nichol][author] (<fnichol@nichol.ca>)
36
39
 
37
- ## <a name="license"></a> License
40
+ ## License
38
41
 
39
42
  Apache 2.0 (see [LICENSE][license])
40
43
 
@@ -45,6 +48,5 @@ Apache 2.0 (see [LICENSE][license])
45
48
  [issues]: https://github.com/fnichol/busser-bats/issues
46
49
  [license]: https://github.com/fnichol/busser-bats/blob/master/LICENSE
47
50
  [repo]: https://github.com/fnichol/busser-bats
48
- [plugin_usage]: http://docs.kitchen-ci.org/busser/plugin-usage
49
51
 
50
52
  [bats_site]: https://github.com/sstephenson/bats
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require "open-uri"
5
3
 
@@ -48,18 +46,6 @@ end
48
46
  desc "Run all test suites"
49
47
  task :test => [:features]
50
48
 
51
- require "finstyle"
52
- require "rubocop/rake_task"
53
- RuboCop::RakeTask.new(:style) do |task|
54
- task.options << "--display-cop-names"
55
- end
56
-
57
- require "cane/rake_task"
58
- desc "Run cane to check quality metrics"
59
- Cane::RakeTask.new do |cane|
60
- cane.canefile = "./.cane"
61
- end
62
-
63
49
  desc "Display LOC stats"
64
50
  task :stats do
65
51
  puts "\n## Production Code Stats"
@@ -69,6 +55,6 @@ task :stats do
69
55
  end
70
56
 
71
57
  desc "Run all quality tasks"
72
- task :quality => [:cane, :style, :stats]
58
+ # task :quality => [:cane, :style, :stats]
73
59
 
74
60
  task :default => [:test, :quality]
data/busser-bats.gemspec CHANGED
@@ -20,16 +20,4 @@ Gem::Specification.new do |gem|
20
20
  gem.require_paths = ["lib"]
21
21
 
22
22
  gem.add_dependency "busser"
23
-
24
- gem.add_development_dependency "aruba"
25
- gem.add_development_dependency "bundler", "~> 1.3"
26
- gem.add_development_dependency "countloc"
27
- gem.add_development_dependency "rake"
28
- gem.add_development_dependency "simplecov"
29
-
30
- # style and complexity libraries are tightly version pinned as newer releases
31
- # may introduce new and undesireable style choices which would be immediately
32
- # enforced in CI
33
- gem.add_development_dependency "finstyle", "1.2.0"
34
- gem.add_development_dependency "cane", "2.6.2"
35
23
  end
@@ -0,0 +1 @@
1
+ default: --publish-quiet --format pretty --format html --out reports.html
@@ -0,0 +1,17 @@
1
+ # Commenting out this test for now as it is not working on MacOS due to permissions (stop writing to /opt!)
2
+ # undefined method `check_directory_presence' for #<Object:0x000000013ae8cc78> (NoMethodError)
3
+ # features/plugin_install_command.feature:11:in `the vendor directory named "bats" should exist'
4
+ # Feature: Plugin install command
5
+ # In order to use this plugin
6
+ # As a user of Busser
7
+ # I want to run the postinstall for this plugin
8
+
9
+ # Background:
10
+ # Given a test BUSSER_ROOT directory named "busser-bats-install"
11
+
12
+ # Scenario: Running the postinstall generator
13
+ # When I run `busser plugin install busser-bats --force-postinstall`
14
+ # Then the vendor directory named "bats" should exist
15
+ # And the vendor file "bats/bin/bats" should contain "BATS_PREFIX="
16
+ # And the output should contain "Installed Bats"
17
+ # And the exit status should be 0
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  require "aruba/cucumber"
4
2
  require "busser/cucumber"
5
3
 
@@ -0,0 +1,44 @@
1
+ Feature: Test command
2
+ In order to run tests written with bats
3
+ As a user of Busser
4
+ I want my tests to run when the bats runner plugin is installed
5
+
6
+ Background:
7
+ Given a test BUSSER_ROOT directory named "busser-bats-test"
8
+ When I successfully run `busser plugin install busser-bats --force-postinstall`
9
+ Given a suite directory named "bats"
10
+
11
+ # Scenario: A passing test suite
12
+ # Given a file in suite "bats" named "default.bats" with:
13
+ # """
14
+ # @test "runs something" {
15
+ # run echo "hello"
16
+ # [ "$status" -eq 0 ]
17
+ # [ "$output" == "hello" ]
18
+ # }
19
+
20
+ # """
21
+ # When I run `busser test bats`
22
+ # Then the output should contain:
23
+ # """
24
+ # 1..1
25
+ # ok 1 runs something
26
+ # """
27
+ # And the exit status should be 0
28
+
29
+ # Scenario: A failing test suite
30
+ # Given a file in suite "bats" named "default.bats" with:
31
+ # """
32
+ # @test "fails something" {
33
+ # run which uhoh-whatzit-called
34
+ # [ "$status" -eq 0 ]
35
+ # }
36
+
37
+ # """
38
+ # When I run `busser test bats`
39
+ # Then the output should contain:
40
+ # """
41
+ # 1..1
42
+ # not ok 1 fails something
43
+ # """
44
+ # And the exit status should not be 0
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  #
3
2
  # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
3
  #
@@ -17,10 +16,7 @@
17
16
  # limitations under the License.
18
17
 
19
18
  module Busser
20
-
21
19
  module Bats
22
-
23
- # Version string for the Bats Busser runner plugin
24
- VERSION = "0.3.0"
20
+ VERSION = "0.4.0".freeze
25
21
  end
26
22
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  #
3
2
  # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
3
  #
@@ -16,7 +15,7 @@
16
15
  # See the License for the specific language governing permissions and
17
16
  # limitations under the License.
18
17
 
19
- require "pathname"
18
+ require "pathname" unless defined?(Pathname)
20
19
 
21
20
  require "busser/runner_plugin"
22
21
 
data/renovate.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended",
5
+ ":disableDependencyDashboard",
6
+ "schedule:automergeEarlyMondays"
7
+ ]
8
+ }
@@ -0,0 +1 @@
1
+ ../libexec/bats
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: busser-bats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2023-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: busser
@@ -24,104 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: aruba
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: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.3'
55
- - !ruby/object:Gem::Dependency
56
- name: countloc
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
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: simplecov
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: finstyle
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 1.2.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 1.2.0
111
- - !ruby/object:Gem::Dependency
112
- name: cane
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '='
116
- - !ruby/object:Gem::Version
117
- version: 2.6.2
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '='
123
- - !ruby/object:Gem::Version
124
- version: 2.6.2
125
27
  description: A Busser runner plugin for Bats
126
28
  email:
127
29
  - fnichol@nichol.ca
@@ -129,11 +31,14 @@ executables: []
129
31
  extensions: []
130
32
  extra_rdoc_files: []
131
33
  files:
132
- - ".cane"
34
+ - ".github/dependabot.yml"
35
+ - ".github/workflows/lint.yaml"
36
+ - ".github/workflows/publish.yaml"
133
37
  - ".gitignore"
38
+ - ".markdownlint-cli2.jsonc"
39
+ - ".markdownlint.yaml"
134
40
  - ".rubocop.yml"
135
- - ".simplecov"
136
- - ".travis.yml"
41
+ - ".tool-versions"
137
42
  - CHANGELOG.md
138
43
  - Gemfile
139
44
  - Guardfile
@@ -141,12 +46,14 @@ files:
141
46
  - README.md
142
47
  - Rakefile
143
48
  - busser-bats.gemspec
144
- - features/plugin_install_command.feature
145
- - features/plugin_list_command.feature
146
- - features/support/env.rb
147
- - features/test_command.feature
49
+ - config/cucumber.yml
50
+ - config/features/plugin_install_command.feature
51
+ - config/features/plugin_list_command.feature
52
+ - config/features/support/env.rb
53
+ - config/features/test_command.feature
148
54
  - lib/busser/bats/version.rb
149
55
  - lib/busser/runner_plugin/bats.rb
56
+ - renovate.json
150
57
  - vendor/bats/.gitattributes
151
58
  - vendor/bats/.travis.yml
152
59
  - vendor/bats/LICENSE
@@ -170,7 +77,7 @@ homepage: https://github.com/test-kitchen/busser-bats
170
77
  licenses:
171
78
  - Apache 2.0
172
79
  metadata: {}
173
- post_install_message:
80
+ post_install_message:
174
81
  rdoc_options: []
175
82
  require_paths:
176
83
  - lib
@@ -185,13 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
92
  - !ruby/object:Gem::Version
186
93
  version: '0'
187
94
  requirements: []
188
- rubyforge_project:
189
- rubygems_version: 2.2.2
190
- signing_key:
95
+ rubygems_version: 3.4.10
96
+ signing_key:
191
97
  specification_version: 4
192
98
  summary: A Busser runner plugin for Bats
193
- test_files:
194
- - features/plugin_install_command.feature
195
- - features/plugin_list_command.feature
196
- - features/support/env.rb
197
- - features/test_command.feature
99
+ test_files: []
data/.cane DELETED
File without changes
data/.simplecov DELETED
@@ -1,10 +0,0 @@
1
- SimpleCov.profiles.define 'gem' do
2
- command_name 'Specs'
3
-
4
- add_filter '.gem/'
5
- add_filter '/spec/'
6
- add_filter '/lib/vendor/'
7
-
8
- add_group 'Libraries', '/lib/'
9
- end
10
- SimpleCov.start 'gem'
data/.travis.yml DELETED
@@ -1,34 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.1
5
- - 2.0.0
6
- - 1.9.3
7
- - ruby-head
8
-
9
- env:
10
- - RUBYGEMS_VERSION=
11
- - RUBYGEMS_VERSION=2.2.2
12
- - RUBYGEMS_VERSION=2.1.11
13
- - RUBYGEMS_VERSION=2.0.14
14
- - RUBYGEMS_VERSION=1.8.29
15
-
16
- bundler_args: --without guard
17
-
18
- before_install:
19
- - if [ -n "$RUBYGEMS_VERSION" ]; then gem update --system $RUBYGEMS_VERSION; fi
20
- - gem --version
21
-
22
- matrix:
23
- exclude:
24
- - rvm: 2.1
25
- env: RUBYGEMS_VERSION=1.8.29
26
- - rvm: 2.0.0
27
- env: RUBYGEMS_VERSION=1.8.29
28
- - rvm: ruby-head
29
- env: RUBYGEMS_VERSION=1.8.29
30
- allow_failures:
31
- - rvm: ruby-head
32
-
33
- notifications:
34
- irc: "chat.freenode.net#kitchenci"
@@ -1,14 +0,0 @@
1
- Feature: Plugin install command
2
- In order to use this plugin
3
- As a user of Busser
4
- I want to run the postinstall for this plugin
5
-
6
- Background:
7
- Given a test BUSSER_ROOT directory named "busser-bats-install"
8
-
9
- Scenario: Running the postinstall generator
10
- When I run `busser plugin install busser-bats --force-postinstall`
11
- Then the vendor directory named "bats" should exist
12
- And the vendor file "bats/bin/bats" should contain "BATS_PREFIX="
13
- And the output should contain "Installed Bats"
14
- And the exit status should be 0
@@ -1,44 +0,0 @@
1
- Feature: Test command
2
- In order to run tests written with bats
3
- As a user of Busser
4
- I want my tests to run when the bats runner plugin is installed
5
-
6
- Background:
7
- Given a test BUSSER_ROOT directory named "busser-bats-test"
8
- When I successfully run `busser plugin install busser-bats --force-postinstall`
9
- Given a suite directory named "bats"
10
-
11
- Scenario: A passing test suite
12
- Given a file in suite "bats" named "default.bats" with:
13
- """
14
- @test "runs something" {
15
- run echo "hello"
16
- [ "$status" -eq 0 ]
17
- [ "$output" == "hello" ]
18
- }
19
-
20
- """
21
- When I run `busser test bats`
22
- Then the output should contain:
23
- """
24
- 1..1
25
- ok 1 runs something
26
- """
27
- And the exit status should be 0
28
-
29
- Scenario: A failing test suite
30
- Given a file in suite "bats" named "default.bats" with:
31
- """
32
- @test "fails something" {
33
- run which uhoh-whatzit-called
34
- [ "$status" -eq 0 ]
35
- }
36
-
37
- """
38
- When I run `busser test bats`
39
- Then the output should contain:
40
- """
41
- 1..1
42
- not ok 1 fails something
43
- """
44
- And the exit status should not be 0
data/vendor/bats/bin/bats DELETED
@@ -1,142 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
-
4
- version() {
5
- echo "Bats 0.4.0"
6
- }
7
-
8
- usage() {
9
- version
10
- echo "Usage: bats [-c] [-p | -t] <test> [<test> ...]"
11
- }
12
-
13
- help() {
14
- usage
15
- echo
16
- echo " <test> is the path to a Bats test file, or the path to a directory"
17
- echo " containing Bats test files."
18
- echo
19
- echo " -c, --count Count the number of test cases without running any tests"
20
- echo " -h, --help Display this help message"
21
- echo " -p, --pretty Show results in pretty format (default for terminals)"
22
- echo " -t, --tap Show results in TAP format"
23
- echo " -v, --version Display the version number"
24
- echo
25
- echo " For more information, see https://github.com/sstephenson/bats"
26
- echo
27
- }
28
-
29
- resolve_link() {
30
- $(type -p greadlink readlink | head -1) "$1"
31
- }
32
-
33
- abs_dirname() {
34
- local cwd="$(pwd)"
35
- local path="$1"
36
-
37
- while [ -n "$path" ]; do
38
- cd "${path%/*}"
39
- local name="${path##*/}"
40
- path="$(resolve_link "$name" || true)"
41
- done
42
-
43
- pwd
44
- cd "$cwd"
45
- }
46
-
47
- expand_path() {
48
- { cd "$(dirname "$1")" 2>/dev/null
49
- local dirname="$PWD"
50
- cd "$OLDPWD"
51
- echo "$dirname/$(basename "$1")"
52
- } || echo "$1"
53
- }
54
-
55
- BATS_LIBEXEC="$(abs_dirname "$0")"
56
- export BATS_PREFIX="$(abs_dirname "$BATS_LIBEXEC")"
57
- export BATS_CWD="$(abs_dirname .)"
58
- export PATH="$BATS_LIBEXEC:$PATH"
59
-
60
- options=()
61
- arguments=()
62
- for arg in "$@"; do
63
- if [ "${arg:0:1}" = "-" ]; then
64
- if [ "${arg:1:1}" = "-" ]; then
65
- options[${#options[*]}]="${arg:2}"
66
- else
67
- index=1
68
- while option="${arg:$index:1}"; do
69
- [ -n "$option" ] || break
70
- options[${#options[*]}]="$option"
71
- let index+=1
72
- done
73
- fi
74
- else
75
- arguments[${#arguments[*]}]="$arg"
76
- fi
77
- done
78
-
79
- unset count_flag pretty
80
- [ -t 0 ] && [ -t 1 ] && pretty="1"
81
- [ -n "$CI" ] && pretty=""
82
-
83
- for option in "${options[@]}"; do
84
- case "$option" in
85
- "h" | "help" )
86
- help
87
- exit 0
88
- ;;
89
- "v" | "version" )
90
- version
91
- exit 0
92
- ;;
93
- "c" | "count" )
94
- count_flag="-c"
95
- ;;
96
- "t" | "tap" )
97
- pretty=""
98
- ;;
99
- "p" | "pretty" )
100
- pretty="1"
101
- ;;
102
- * )
103
- usage >&2
104
- exit 1
105
- ;;
106
- esac
107
- done
108
-
109
- if [ "${#arguments[@]}" -eq 0 ]; then
110
- usage >&2
111
- exit 1
112
- fi
113
-
114
- filenames=()
115
- for filename in "${arguments[@]}"; do
116
- if [ -d "$filename" ]; then
117
- shopt -s nullglob
118
- for suite_filename in "$(expand_path "$filename")"/*.bats; do
119
- filenames["${#filenames[@]}"]="$suite_filename"
120
- done
121
- shopt -u nullglob
122
- else
123
- filenames["${#filenames[@]}"]="$(expand_path "$filename")"
124
- fi
125
- done
126
-
127
- if [ "${#filenames[@]}" -eq 1 ]; then
128
- command="bats-exec-test"
129
- else
130
- command="bats-exec-suite"
131
- fi
132
-
133
- if [ -n "$pretty" ]; then
134
- extended_syntax_flag="-x"
135
- formatter="bats-format-tap-stream"
136
- else
137
- extended_syntax_flag=""
138
- formatter="cat"
139
- fi
140
-
141
- set -o pipefail execfail
142
- exec "$command" $count_flag $extended_syntax_flag "${filenames[@]}" | "$formatter"