Skip to content

Commit 88bab92

Browse files
committed
event-protocol: Add Ruby formatter for publishing events
1 parent d8971ab commit 88bab92

File tree

21 files changed

+375
-0
lines changed

21 files changed

+375
-0
lines changed

event-protocol/ruby/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.bundle/
2+
/.yardoc
3+
/Gemfile.lock
4+
/_yardoc/
5+
/coverage/
6+
/doc/
7+
/pkg/
8+
/spec/reports/
9+
/tmp/
10+
/Gemfile.local

event-protocol/ruby/.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--format documentation
2+
--color

event-protocol/ruby/.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sudo: false
2+
language: ruby
3+
rvm:
4+
- 2.1.5
5+
before_install: gem install bundler -v 1.13.1

event-protocol/ruby/Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
gemspec
3+
4+
gem "cucumber", path: "../../../cucumber-ruby"

event-protocol/ruby/LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Cucumber Limited and contributors
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.

event-protocol/ruby/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Cucumber EventStream Formatter
2+
3+
This is a plugin for Cucumber-Ruby that emits the Cucumber [event protocol](https://github.com/cucumber/cucumber/blob/master/event-protocol).
4+
5+
## Installation
6+
7+
This gem is not designed to be installed stand-alone. It is a component used within the `cucumber` gem.
8+
9+
## Development
10+
11+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests.
12+
13+
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).
14+
15+
## Contributing
16+
17+
Bug reports and pull requests are welcome on GitHub at https://github.com/cucumber/cucumber
18+
19+
## Code of Conduct
20+
21+
Everyone interacting in this codebase and issue tracker is expected to follow the Cucumber [code of conduct](https://github.com/cucumber/cucumber/blob/master/CODE_OF_CONDUCT.md).
22+
23+
## License
24+
25+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

event-protocol/ruby/Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "bundler/gem_tasks"
2+
require "rspec/core/rake_task"
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
6+
task :default => :spec

event-protocol/ruby/bin/setup

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install
7+
8+
# Do any other automated setup that you need to do here
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# coding: utf-8
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'cucumber/formatter/event_stream/version'
5+
6+
Gem::Specification.new do |spec|
7+
spec.name = "cucumber-formatter-event_stream"
8+
spec.version = Cucumber::Formatter::EventStream::VERSION
9+
spec.authors = ["Matt Wynne"]
10+
spec.email = ["matt@cucumber.io"]
11+
12+
spec.summary = %q{NDJSON event stream output of Cucumber events}
13+
spec.description = %q{Streams events that describe your test run, as they happen, live, in real-time.}
14+
spec.homepage = "https://cucumber.io"
15+
spec.license = "MIT"
16+
17+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
18+
f.match(%r{^(test|spec|features)/})
19+
end
20+
spec.bindir = "exe"
21+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22+
spec.require_paths = ["lib"]
23+
24+
spec.add_development_dependency "bundler", "~> 1.13"
25+
spec.add_development_dependency "rake", "~> 10.0"
26+
spec.add_development_dependency "rspec", "~> 3.0"
27+
# spec.add_development_dependency "cucumber", "~> 3.0.0.pre.1"
28+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{"type":"source","uri":"features/failing.feature","data":"Feature: Failing feature\n Scenario: failling\n Given this step fails\n Then this step will be skipped\n","media":{"encoding":"utf-8","type":"text/vnd.cucumber.gherkin+plain"}}
2+
{"type":"test-run-started","workingDirectory":"{{Dir.pwd}}/examples/a-failing-scenario","timestamp":1490450321}
3+
{"type":"test-case-prepared","sourceLocation":{"uri":"features/failing.feature","line":2},"steps":[{"actionLocation":{"uri":"{{Cucumber::LIBDIR}}/cucumber/filters/prepare_world.rb","line":28},"sourceLocation":{"uri":"{{Cucumber::LIBDIR}}/cucumber/filters/prepare_world.rb","line":28}},{"actionLocation":{"uri":"step_definitions/steps.rb","line":1},"sourceLocation":{"uri":"features/failing.feature","line":3}},{"actionLocation":{"uri":"step_definitions/steps.rb","line":5},"sourceLocation":{"uri":"features/failing.feature","line":4}}]}
4+
{"type":"test-case-started","sourceLocation":{"uri":"features/failing.feature","line":2}}
5+
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/failing.feature","line":2}},"index":0}
6+
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/failing.feature","line":2}},"index":0,"result":{"status":"passed","duration":3000}}
7+
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/failing.feature","line":2}},"index":1}
8+
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/failing.feature","line":2}},"index":1,"result":{"status":"failed","duration":140000,"exception":{"message":"Failing step","type":"RuntimeError","stackTrace":["{{Dir.pwd}}/examples/a-failing-scenario/step_definitions/steps.rb:2:in `/^this step fails$/'","features/failing.feature:3:in `Given this step fails'"]}}}
9+
{"type":"test-step-started","testCase":{"sourceLocation":{"uri":"features/failing.feature","line":2}},"index":2}
10+
{"type":"test-step-finished","testCase":{"sourceLocation":{"uri":"features/failing.feature","line":2}},"index":2,"result":{"status":"skipped","exception":{"message":"","type":"Cucumber::Core::Test::Result::Skipped","stackTrace":null}}}
11+
{"type":"test-case-finished","sourceLocation":{"uri":"features/failing.feature","line":2},"result":{"status":"failed","duration":12344000,"exception":{"message":"Failing step","type":"RuntimeError","stackTrace":["{{Dir.pwd}}/examples/a-failing-scenario/step_definitions/steps.rb:2:in `/^this step fails$/'","features/failing.feature:3:in `Given this step fails'"]}}}

0 commit comments

Comments
 (0)