busser-bats 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.cane ADDED
File without changes
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.tailor ADDED
@@ -0,0 +1,4 @@
1
+ Tailor.config do |config|
2
+ config.formatters "text"
3
+ config.file_set 'lib/**/*.rb'
4
+ end
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / 2013-04-10
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Fletcher Nichol (<fnichol@nichol.ca>)
2
+
3
+ Copyright (C) 2013, Fletcher Nichol
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -0,0 +1,46 @@
1
+ # <a name="title"></a> Busser::RunnerPlugin::Bats
2
+
3
+ [![Build Status](https://travis-ci.org/fnichol/busser-bats.png?branch=master)](https://travis-ci.org/fnichol/busser-bats)
4
+ [![Code Climate](https://codeclimate.com/github/fnichol/busser-bats.png)](https://codeclimate.com/github/fnichol/busser-bats)
5
+
6
+ A Busser runner plugin for [Bats][bats_site]
7
+
8
+ ## <a name="installation"></a> Installation and Setup
9
+
10
+ Please read the Busser [plugin usage][plugin_usage] page for more details.
11
+
12
+ ## <a name="usage"></a> Usage
13
+
14
+ **TODO:** Write documentation explaining the structure/format of testing files.
15
+
16
+ ## <a name="development"></a> Development
17
+
18
+ * Source hosted at [GitHub][repo]
19
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
20
+
21
+ Pull requests are very welcome! Make sure your patches are well tested.
22
+ Ideally create a topic branch for every separate change you make. For
23
+ example:
24
+
25
+ 1. Fork the repo
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
30
+
31
+ ## <a name="authors"></a> Authors
32
+
33
+ Created and maintained by [Fletcher Nichol][author] (<fnichol@nichol.ca>)
34
+
35
+ ## <a name="license"></a> License
36
+
37
+ Apache 2.0 (see [LICENSE][license])
38
+
39
+
40
+ [author]: https://github.com/fnichol
41
+ [issues]: https://github.com/fnichol/busser-bats/issues
42
+ [license]: https://github.com/fnichol/busser-bats/blob/master/LICENSE
43
+ [repo]: https://github.com/fnichol/busser-bats
44
+ [plugin_usage]: http://docs.kitchen-ci.org/busser/plugin-usage
45
+
46
+ [bats_site]: https://github.com/sstephenson/bats
@@ -0,0 +1,31 @@
1
+ require "bundler/gem_tasks"
2
+ require 'cucumber/rake/task'
3
+ require 'cane/rake_task'
4
+ require 'tailor/rake_task'
5
+
6
+ Cucumber::Rake::Task.new(:features) do |t|
7
+ t.cucumber_opts = ['features', '-x', '--format progress']
8
+ end
9
+
10
+ desc "Run all test suites"
11
+ task :test => [:features]
12
+
13
+ desc "Run cane to check quality metrics"
14
+ Cane::RakeTask.new do |cane|
15
+ cane.canefile = './.cane'
16
+ end
17
+
18
+ Tailor::RakeTask.new
19
+
20
+ desc "Display LOC stats"
21
+ task :stats do
22
+ puts "\n## Production Code Stats"
23
+ sh "countloc -r lib"
24
+ puts "\n## Test Code Stats"
25
+ sh "countloc -r features"
26
+ end
27
+
28
+ desc "Run all quality tasks"
29
+ task :quality => [:cane, :tailor, :stats]
30
+
31
+ task :default => [:test, :quality]
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'busser/bats/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'busser-bats'
8
+ spec.version = Busser::Bats::VERSION
9
+ spec.authors = ['Fletcher Nichol']
10
+ spec.email = ['fnichol@nichol.ca']
11
+ spec.description = %q{A Busser runner plugin for Bats}
12
+ spec.summary = spec.description
13
+ spec.homepage = 'https://github.com/fnichol/busser-bats'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'busser'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'aruba'
26
+
27
+ spec.add_development_dependency 'cane'
28
+ spec.add_development_dependency 'tailor'
29
+ spec.add_development_dependency 'countloc'
30
+ end
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,8 @@
1
+ Feature: Plugin list command
2
+ In order to use this plugin
3
+ As a user of Busser
4
+ I want to see this plugin in the 'busser plugin list' command
5
+
6
+ Scenario: Plugin appears in plugin list command
7
+ When I successfully run `busser plugin list`
8
+ Then the output should match /^bats\b/
@@ -0,0 +1,13 @@
1
+ require 'aruba/cucumber'
2
+ require 'busser/cucumber'
3
+
4
+ Before do
5
+ @aruba_timeout_seconds = 10
6
+ end
7
+
8
+ After do |s|
9
+ # Tell Cucumber to quit after this scenario is done - if it failed.
10
+ # This is useful to inspect the 'tmp/aruba' directory before any other
11
+ # steps are executed and clear it out.
12
+ Cucumber.wants_to_quit = true if s.failed?
13
+ end
@@ -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
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ module Busser
20
+
21
+ module Bats
22
+
23
+ # Version string for the Bats Busser runner plugin
24
+ VERSION = "0.1.0"
25
+ end
26
+ end
@@ -0,0 +1,49 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'pathname'
20
+ require 'tmpdir'
21
+
22
+ require 'busser/runner_plugin'
23
+
24
+ # A Busser runner plugin for Bats.
25
+ #
26
+ # @author Fletcher Nichol <fnichol@nichol.ca>
27
+ #
28
+ class Busser::RunnerPlugin::Bats < Busser::RunnerPlugin::Base
29
+
30
+ postinstall do
31
+ tmp_root = Pathname.new(Dir.mktmpdir("bats"))
32
+ tarball_url = "https://github.com/sstephenson/bats/archive/master.tar.gz"
33
+ tarball_file = tmp_root.join("bats.tar.gz")
34
+ extract_root = tmp_root.join("bats")
35
+ dest_path = vendor_path("bats")
36
+
37
+ empty_directory(extract_root)
38
+ get(tarball_url, tarball_file)
39
+ inside(extract_root) do
40
+ run!(%{gunzip -c "#{tarball_file}" | tar xf - --strip-components=1})
41
+ run!(%{./install.sh #{dest_path}})
42
+ end
43
+ remove_dir(tmp_root)
44
+ end
45
+
46
+ def test
47
+ run!("#{vendor_path('bats').join("bin/bats")} #{suite_path('bats')}")
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: busser-bats
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fletcher Nichol
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: busser
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.3'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: aruba
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: cane
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: tailor
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: countloc
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
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
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: A Busser runner plugin for Bats
127
+ email:
128
+ - fnichol@nichol.ca
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - .cane
134
+ - .gitignore
135
+ - .tailor
136
+ - .travis.yml
137
+ - CHANGELOG.md
138
+ - Gemfile
139
+ - LICENSE
140
+ - README.md
141
+ - Rakefile
142
+ - busser-bats.gemspec
143
+ - features/plugin_install_command.feature
144
+ - features/plugin_list_command.feature
145
+ - features/support/env.rb
146
+ - features/test_command.feature
147
+ - lib/busser/bats/version.rb
148
+ - lib/busser/runner_plugin/bats.rb
149
+ homepage: https://github.com/fnichol/busser-bats
150
+ licenses:
151
+ - Apache 2.0
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ segments:
163
+ - 0
164
+ hash: 419996198291776117
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
168
+ - - ! '>='
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ segments:
172
+ - 0
173
+ hash: 419996198291776117
174
+ requirements: []
175
+ rubyforge_project:
176
+ rubygems_version: 1.8.24
177
+ signing_key:
178
+ specification_version: 3
179
+ summary: A Busser runner plugin for Bats
180
+ test_files:
181
+ - features/plugin_install_command.feature
182
+ - features/plugin_list_command.feature
183
+ - features/support/env.rb
184
+ - features/test_command.feature