towel 0.1.0
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 +7 -0
- data/.gitignore +11 -0
- data/.gitmodules +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +19 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/extensions/towel-minitest/.gitignore +8 -0
- data/extensions/towel-minitest/Gemfile +6 -0
- data/extensions/towel-minitest/README.md +43 -0
- data/extensions/towel-minitest/Rakefile +10 -0
- data/extensions/towel-minitest/bin/console +14 -0
- data/extensions/towel-minitest/bin/setup +8 -0
- data/extensions/towel-minitest/examples/.towel.toml +37 -0
- data/extensions/towel-minitest/examples/parallel_test.rb +29 -0
- data/extensions/towel-minitest/examples/simple_spec.rb +25 -0
- data/extensions/towel-minitest/examples/simple_test.rb +35 -0
- data/extensions/towel-minitest/lib/minitest/towel_plugin.rb +12 -0
- data/extensions/towel-minitest/lib/towel/minitest/reporter.rb +102 -0
- data/extensions/towel-minitest/lib/towel/minitest/version.rb +5 -0
- data/extensions/towel-minitest/lib/towel/minitest.rb +13 -0
- data/extensions/towel-minitest/test/test_helper.rb +4 -0
- data/extensions/towel-minitest/test/towel/minitest_test.rb +11 -0
- data/extensions/towel-minitest/towel-minitest.gemspec +41 -0
- data/extensions/towel-rspec/.gitignore +9 -0
- data/extensions/towel-rspec/.rspec +1 -0
- data/extensions/towel-rspec/Gemfile +6 -0
- data/extensions/towel-rspec/README.md +43 -0
- data/extensions/towel-rspec/Rakefile +10 -0
- data/extensions/towel-rspec/bin/console +14 -0
- data/extensions/towel-rspec/bin/setup +8 -0
- data/extensions/towel-rspec/examples/.rspec +2 -0
- data/extensions/towel-rspec/examples/simple_spec.rb +22 -0
- data/extensions/towel-rspec/lib/towel/rspec/formatter.rb +63 -0
- data/extensions/towel-rspec/lib/towel/rspec/version.rb +5 -0
- data/extensions/towel-rspec/lib/towel/rspec.rb +13 -0
- data/extensions/towel-rspec/spec/spec_helper.rb +100 -0
- data/extensions/towel-rspec/towel-rspec.gemspec +41 -0
- data/generated/.gitignore +1 -0
- data/generated/towel/v1alpha/collector_pb.rb +61 -0
- data/generated/towel/v1alpha/collector_services_pb.rb +41 -0
- data/generated/towel/v1alpha/towel_pb.rb +88 -0
- data/lib/towel/configuration.rb +82 -0
- data/lib/towel/environment.rb +64 -0
- data/lib/towel/log.rb +100 -0
- data/lib/towel/log_io.rb +71 -0
- data/lib/towel/session.rb +199 -0
- data/lib/towel/version.rb +3 -0
- data/lib/towel.rb +30 -0
- data/towel.gemspec +45 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 68eca600df5e66fcd66ff9eb9a6da854e87c119f00009d84bf1ed89d2877c987
|
4
|
+
data.tar.gz: 716f88d28f357cbe649de0eff946195fca8e0f46331a5094fa6b73c7e68ea0aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6756fd95bb799753858ea7a831007221a535dd40b4cac855367e9f257d3ad089f39621a8a247b3c02806fffe77d684e20c73ae52d451980b57ed303446d281a6
|
7
|
+
data.tar.gz: fb398200fb9b52ec72d19c0c3e25305d471546ed2b3884d30ca24771377a2293df67c778d24285434bb5ff945a76076dc86608e12861195e7a8baa9b8681efce
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at andrew@velvet.software. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Velvet Software LLC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Towel
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/towel`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'towel'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install towel
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/towel. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Towel project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/towel/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :test
|
11
|
+
|
12
|
+
desc "Generates resources for the packaged gem"
|
13
|
+
task :generate => :generate_protos
|
14
|
+
|
15
|
+
task :generate_protos do
|
16
|
+
sh "bundle exec grpc_tools_ruby_protoc -I proto --ruby_out=generated/ proto/towel/v1alpha/towel.proto"
|
17
|
+
sh "bundle exec grpc_tools_ruby_protoc -I proto --ruby_out=generated/ proto/towel/v1alpha/collector.proto"
|
18
|
+
sh "bundle exec grpc_tools_ruby_protoc -I proto --grpc_out=generated/ proto/towel/v1alpha/collector.proto"
|
19
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "towel"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Towel::Minitest
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/towel/minitest`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'towel-minitest'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install towel-minitest
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/towel-minitest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the Towel::Minitest project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/towel-minitest/blob/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "towel/minitest"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# This is an example configuration file for Towel. It shows most of the
|
2
|
+
# different options that can be set, even though a normal config file will only
|
3
|
+
# have a subset of options specified. Towel uses TOML for configuration. It's a
|
4
|
+
# lot like INI, but well-defined. To get a feel for the syntax, look at
|
5
|
+
# https://github.com/toml-lang/toml/blob/v0.5.0/README.md
|
6
|
+
|
7
|
+
|
8
|
+
[auth]
|
9
|
+
# The Towel account that is reporting invocations. This is how your invocations
|
10
|
+
# are linked to you.
|
11
|
+
account = "wile.e.coyote@acme.corp"
|
12
|
+
|
13
|
+
# The API key to communicate with. DO NOT commit this or make this public to
|
14
|
+
# others that you do not want them to be able to report to Towel.
|
15
|
+
api_key = "AezKF3gPPyzD8dvgDYFYF9we5YP4R87UqhTzDxs3CnkY"
|
16
|
+
|
17
|
+
|
18
|
+
[collector]
|
19
|
+
# Where should results be reported to. This should be a hostname and port if
|
20
|
+
# non-standard (443). This allows you to point against different Towel instances
|
21
|
+
# (staging for example).
|
22
|
+
address = "localhost:10081"
|
23
|
+
|
24
|
+
# The organization handle for the organization that holds your Towel projects.
|
25
|
+
organization = "acme"
|
26
|
+
|
27
|
+
# The project handle for the project that invocations should be reported under.
|
28
|
+
project = "dynamite"
|
29
|
+
|
30
|
+
|
31
|
+
# This section is free-form. You can add whatever labels you would like to
|
32
|
+
# appear on all invocations reported using this configuration. This is useful
|
33
|
+
# for per-branch or per-environment annotations. NOTE: Only string values are
|
34
|
+
# allowed here.
|
35
|
+
[labels]
|
36
|
+
branch = "master"
|
37
|
+
environment = "test"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "minitest/autorun"
|
3
|
+
|
4
|
+
class ParallelTest < Minitest::Test
|
5
|
+
parallelize_me!
|
6
|
+
|
7
|
+
def test_foo
|
8
|
+
puts "foo"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_bar
|
12
|
+
puts "bar"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_baz
|
16
|
+
puts "baz"
|
17
|
+
flunk "The 'baz' plugin is not currently installed"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_box
|
21
|
+
puts "box"
|
22
|
+
raise ArgumentError, "This was unexpected"
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_zap
|
26
|
+
puts "zap"
|
27
|
+
skip "Zap is not implemented yet"
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "minitest/autorun"
|
3
|
+
|
4
|
+
Foo = Class.new
|
5
|
+
|
6
|
+
describe Foo do
|
7
|
+
describe "foo" do
|
8
|
+
it "acts normally" do
|
9
|
+
puts "OK"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "stays cool"
|
13
|
+
it "never gives up"
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "bar" do
|
17
|
+
it "is a little unsure of itself" do
|
18
|
+
raise ArgumentError, "Not sure of myself"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "needs affirmation" do
|
22
|
+
_(false).must_equal true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "minitest/autorun"
|
3
|
+
|
4
|
+
class FooTest < Minitest::Test
|
5
|
+
def test_foo
|
6
|
+
puts "foo"
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_bar
|
10
|
+
puts "bar"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_baz
|
14
|
+
puts "baz"
|
15
|
+
flunk "The 'baz' plugin is not currently installed"
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_box
|
19
|
+
puts "box"
|
20
|
+
raise ArgumentError, "This was unexpected"
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_zap
|
24
|
+
puts "zap"
|
25
|
+
skip "Zap is not implemented yet"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
class LongTest < Minitest::Test
|
31
|
+
def test_wait
|
32
|
+
sleep 10.0
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module Towel
|
2
|
+
module Minitest
|
3
|
+
# Reports Minitest results to Towel.
|
4
|
+
class Reporter < ::Minitest::AbstractReporter
|
5
|
+
def initialize(options)
|
6
|
+
@session = Towel::Session.new
|
7
|
+
@stdout = nil
|
8
|
+
@stderr = nil
|
9
|
+
@previous_stdout = nil
|
10
|
+
@previous_stderr = nil
|
11
|
+
@cancelled = false
|
12
|
+
end
|
13
|
+
|
14
|
+
def start
|
15
|
+
url = @session.create_invocation
|
16
|
+
puts "View test results at #{url}"
|
17
|
+
|
18
|
+
# Register a cancellation handler
|
19
|
+
old_handler = Signal.trap("INT") do
|
20
|
+
@cancelled = true
|
21
|
+
if old_handler.respond_to?(:call)
|
22
|
+
old_handler.call
|
23
|
+
else
|
24
|
+
raise Interrupt
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Capture logs
|
29
|
+
@previous_stdout = $stdout
|
30
|
+
$stdout = @stdout = Towel::LogIO.new(@session.create_log("STDOUT"))
|
31
|
+
@previous_stderr = $stderr
|
32
|
+
$stderr = @stderr = Towel::LogIO.new(@session.create_log("STDERR"))
|
33
|
+
end
|
34
|
+
|
35
|
+
def prerecord(klass, name)
|
36
|
+
context = @session.create_result(
|
37
|
+
klass.to_s,
|
38
|
+
name,
|
39
|
+
display_name: result_name(klass, name)
|
40
|
+
)
|
41
|
+
|
42
|
+
@stdout.context = context
|
43
|
+
@stderr.context = context
|
44
|
+
end
|
45
|
+
|
46
|
+
def record(result)
|
47
|
+
if result.passed?
|
48
|
+
state = Towel::V1alpha::ResultState::SUCCESS
|
49
|
+
elsif result.skipped?
|
50
|
+
state = Towel::V1alpha::ResultState::SKIPPED
|
51
|
+
elsif result.error?
|
52
|
+
state = Towel::V1alpha::ResultState::ERROR
|
53
|
+
else
|
54
|
+
state = Towel::V1alpha::ResultState::FAILURE
|
55
|
+
end
|
56
|
+
|
57
|
+
duration = nil
|
58
|
+
if !result.skipped?
|
59
|
+
duration = result.time
|
60
|
+
end
|
61
|
+
|
62
|
+
description = nil
|
63
|
+
if !result.failures.empty?
|
64
|
+
description = result.failures.first.message
|
65
|
+
end
|
66
|
+
|
67
|
+
@session.update_result(
|
68
|
+
result.klass,
|
69
|
+
result.name,
|
70
|
+
state: state,
|
71
|
+
duration: duration,
|
72
|
+
description: description
|
73
|
+
)
|
74
|
+
|
75
|
+
@stdout.context = nil
|
76
|
+
@stderr.context = nil
|
77
|
+
end
|
78
|
+
|
79
|
+
def report
|
80
|
+
$stdout = @previous_stdout
|
81
|
+
$stderr = @previous_stderr
|
82
|
+
|
83
|
+
if @cancelled
|
84
|
+
@session.cancel_invocation
|
85
|
+
else
|
86
|
+
@session.finish_invocation
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
# Clean up names from Minitest::Spec
|
93
|
+
def result_name(klass, name)
|
94
|
+
if klass.ancestors.include?(::Minitest::Spec)
|
95
|
+
name.sub(/^test_\d{4}_/, "")
|
96
|
+
else
|
97
|
+
name
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "towel/minitest/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "towel-minitest"
|
8
|
+
spec.version = Towel::Minitest::VERSION
|
9
|
+
spec.authors = ["Andrew Smith"]
|
10
|
+
spec.email = ["andrew@velvet.software"]
|
11
|
+
|
12
|
+
spec.summary = "Towel integration for collecting results from Minitest"
|
13
|
+
spec.description = <<END
|
14
|
+
Towel collects test results as they run, reporting them to towel.dev for easier
|
15
|
+
inspection, debugging, and sharing.
|
16
|
+
END
|
17
|
+
spec.homepage = "https://towel.dev"
|
18
|
+
spec.license = "MIT"
|
19
|
+
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = "https://bitbucket.org/VelvetSoftware/towel-ruby"
|
23
|
+
spec.metadata["changelog_uri"] = "https://bitbucket.org/VelvetSoftware/towel-ruby/src/master/extensions/towel-minitest/CHANGELOG.md"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_dependency "minitest", "~> 5.0"
|
36
|
+
spec.add_dependency "towel", "~> 0.1"
|
37
|
+
|
38
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
41
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|