report_factory-rspec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.rubocop.yml +5 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +51 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +4 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/report_factory/rspec.rb +14 -0
- data/lib/report_factory/rspec/api.rb +53 -0
- data/lib/report_factory/rspec/configuration.rb +34 -0
- data/lib/report_factory/rspec/formatter.rb +130 -0
- data/lib/report_factory/rspec/version.rb +7 -0
- data/report_factory-rspec.gemspec +28 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 99f8061be2d4748bb726f5c3d82fc5227a1114b1
|
4
|
+
data.tar.gz: a11ae46c7e7e1b06261860a8a6bbc4da51cd4856
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6493ed54f04c27eddfb9e45dc73142f6113dff8562c5f18b63f3e4631b08a92caae280ed8326cf2f648cf40edd806c677968b03ba64e135cde7e0b71688417e3
|
7
|
+
data.tar.gz: afad6732a00c255d919c7c60611d32b790eff327922cd1b510a8487d07a8d13d66b512cc8652fed581cfca396f914f90f9230245a0453d0804da29bd21d80fd6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
report_factory-rspec
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
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 contactigorstar@gmail.com. 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/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
report_factory-rspec (0.1.0)
|
5
|
+
rspec (~> 3.5)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.3.0)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
parallel (1.12.0)
|
13
|
+
parser (2.4.0.2)
|
14
|
+
ast (~> 2.3)
|
15
|
+
powerpack (0.1.1)
|
16
|
+
rainbow (2.2.2)
|
17
|
+
rake
|
18
|
+
rake (12.3.0)
|
19
|
+
rspec (3.7.0)
|
20
|
+
rspec-core (~> 3.7.0)
|
21
|
+
rspec-expectations (~> 3.7.0)
|
22
|
+
rspec-mocks (~> 3.7.0)
|
23
|
+
rspec-core (3.7.0)
|
24
|
+
rspec-support (~> 3.7.0)
|
25
|
+
rspec-expectations (3.7.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.7.0)
|
28
|
+
rspec-mocks (3.7.0)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.7.0)
|
31
|
+
rspec-support (3.7.0)
|
32
|
+
rubocop (0.51.0)
|
33
|
+
parallel (~> 1.10)
|
34
|
+
parser (>= 2.3.3.1, < 3.0)
|
35
|
+
powerpack (~> 0.1)
|
36
|
+
rainbow (>= 2.2.2, < 3.0)
|
37
|
+
ruby-progressbar (~> 1.7)
|
38
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
39
|
+
ruby-progressbar (1.9.0)
|
40
|
+
unicode-display_width (1.3.0)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
bundler (~> 1.16)
|
47
|
+
report_factory-rspec!
|
48
|
+
rubocop (~> 0.51.0)
|
49
|
+
|
50
|
+
BUNDLED WITH
|
51
|
+
1.16.0
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 IgorS
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 igor-starostenko
|
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,64 @@
|
|
1
|
+
# ReportFactory::Rspec
|
2
|
+
|
3
|
+
*ReportFactory* helps you save each of your test runs so that they are always available for reports and analytics.
|
4
|
+
It consists of three parts:
|
5
|
+
1. A [rails server](https://github.com/igor-starostenko/report_factory) that provides an interface via JSON API and saves your test runs in a DB;
|
6
|
+
2. A web application which gives you an easy way to configure your test projects and reports (Currently in development);
|
7
|
+
3. And a test formatter that automatically sends reports to the server after each test run. This repo is the formatter for RSpec.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'report_factory-rspec'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install report_factory-rspec
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Before you start using this formatter, make sure you have the [ReportFactory](https://github.com/igor-starostenko/report_factory) server deployed and running.
|
28
|
+
|
29
|
+
To setup this formatter to work with your RSpec tests, add this to your `spec_helper.rb` file:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'report_factory-rspec'
|
33
|
+
```
|
34
|
+
|
35
|
+
and configure:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
ReportFactory::RSpec.configure do |config|
|
39
|
+
config.url = "The url of the ReportFactory server. It's 'http://0.0.0.0:3000' if you're running locally"
|
40
|
+
config.project_name = "The name of the project that you are testing. Needs to be previously created in ReportFactory"
|
41
|
+
config.auth_token = "Your user X_API_KEY. Can be found in ReportFactory in your user information"
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
Then you can just simply run rspec with `--format ReportFactory::RSpec::Formatter` and your reports will be available on the server after each test run.
|
46
|
+
You can add that line to your `.rspec` file if you want it to be the default behavior.
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
|
+
|
52
|
+
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).
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/igor-starostenko/report_factory-rspec. 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.
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
61
|
+
|
62
|
+
## Code of Conduct
|
63
|
+
|
64
|
+
Everyone interacting in the ReportFactory::Rspec project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/igor-starostenko/report_factory-rspec/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'report_factory/rspec'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'report_factory/rspec/configuration'
|
4
|
+
require 'report_factory/rspec/version'
|
5
|
+
|
6
|
+
module ReportFactory
|
7
|
+
# Top level namespace module
|
8
|
+
module Rspec
|
9
|
+
extend Configuration
|
10
|
+
# TODO: Add method missing
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'report_factory/rspec/formatter'
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module ReportFactory
|
8
|
+
module Rspec
|
9
|
+
# An RSpec formatter that formats json from the test run
|
10
|
+
class API
|
11
|
+
def self.send_report(report_hash)
|
12
|
+
uri = create_report_url
|
13
|
+
request = Net::HTTP::Post.new(uri.request_uri, format_headers)
|
14
|
+
request.body = format_payload(report_hash).to_json
|
15
|
+
net_http = Net::HTTP.new(uri.host, uri.port)
|
16
|
+
net_http.use_ssl = true if uri.scheme == 'https'
|
17
|
+
net_http.request(request)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.format_headers
|
21
|
+
{
|
22
|
+
'Content-Type': 'application/json',
|
23
|
+
'X-API-KEY' => x_api_key
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.format_payload(report_hash)
|
28
|
+
{
|
29
|
+
data: {
|
30
|
+
type: 'rspec_report',
|
31
|
+
attributes: report_hash
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.x_api_key
|
37
|
+
ReportFactory::Rspec.auth_token
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.base_url
|
41
|
+
ReportFactory::Rspec.url
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.project_name
|
45
|
+
ReportFactory::Rspec.project_name
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.create_report_url
|
49
|
+
URI.parse("#{base_url}/api/v1/projects/#{project_name}/reports/rspec")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ReportFactory
|
4
|
+
module Rspec
|
5
|
+
# Defines all configurable attributes of ReportFactory::RSpec
|
6
|
+
module Configuration
|
7
|
+
VALID_CONFIG_KEYS = %i[url project_name auth_token].freeze
|
8
|
+
|
9
|
+
DEFAULT_URL = 'http://0.0.0.0:3000'
|
10
|
+
|
11
|
+
DEFAULT_PROJECT_NAME = nil
|
12
|
+
|
13
|
+
DEFAULT_AUTH_TOKEN = nil
|
14
|
+
|
15
|
+
VALID_CONFIG_KEYS.each { |key| attr_accessor key }
|
16
|
+
|
17
|
+
# Make sure the default values are set when the module is 'extended'
|
18
|
+
def self.extended(base)
|
19
|
+
base.reset
|
20
|
+
end
|
21
|
+
|
22
|
+
def configure
|
23
|
+
yield self
|
24
|
+
end
|
25
|
+
|
26
|
+
def reset
|
27
|
+
VALID_CONFIG_KEYS.each do |key|
|
28
|
+
constant_name = "DEFAULT_#{key}".upcase
|
29
|
+
send("#{key}=", self::Configuration.const_get(constant_name))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'report_factory/rspec/api'
|
5
|
+
require 'rspec/core'
|
6
|
+
require 'rspec/core/formatters/base_formatter'
|
7
|
+
|
8
|
+
module ReportFactory
|
9
|
+
module Rspec
|
10
|
+
# An RSpec formatter that formats json from the test run
|
11
|
+
class Formatter < RSpec::Core::Formatters::BaseFormatter
|
12
|
+
RSpec::Core::Formatters.register self, :message, :dump_summary,
|
13
|
+
:dump_profile, :stop, :seed, :close
|
14
|
+
|
15
|
+
attr_reader :output_hash
|
16
|
+
|
17
|
+
def initialize(output)
|
18
|
+
super
|
19
|
+
@output_hash = {
|
20
|
+
version: RSpec::Core::Version::STRING
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def message(notification)
|
25
|
+
(@output_hash[:messages] ||= []) << notification.message
|
26
|
+
end
|
27
|
+
|
28
|
+
def dump_summary(summary)
|
29
|
+
errors_outside_count = summary.errors_outside_of_examples_count
|
30
|
+
@output_hash[:summary] = {
|
31
|
+
duration: summary.duration,
|
32
|
+
example_count: summary.example_count,
|
33
|
+
failure_count: summary.failure_count,
|
34
|
+
pending_count: summary.pending_count,
|
35
|
+
errors_outside_of_examples_count: errors_outside_count
|
36
|
+
}
|
37
|
+
@output_hash[:summary_line] = summary.totals_line
|
38
|
+
end
|
39
|
+
|
40
|
+
def stop(notification)
|
41
|
+
@output_hash[:examples] = notification.examples.map do |example|
|
42
|
+
format_example(example).tap do |hash|
|
43
|
+
hash[:exception] = format_exception(example)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def seed(notification)
|
49
|
+
return unless notification.seed_used?
|
50
|
+
@output_hash[:seed] = notification.seed
|
51
|
+
end
|
52
|
+
|
53
|
+
def close(_notification)
|
54
|
+
return if @output_hash[:examples].empty?
|
55
|
+
print_result(ReportFactory::Rspec::API.send_report(@output_hash))
|
56
|
+
end
|
57
|
+
|
58
|
+
def dump_profile(profile)
|
59
|
+
@output_hash[:profile] = {}
|
60
|
+
dump_profile_slowest_examples(profile)
|
61
|
+
dump_profile_slowest_example_groups(profile)
|
62
|
+
end
|
63
|
+
|
64
|
+
# @api private
|
65
|
+
def dump_profile_slowest_examples(profile)
|
66
|
+
@output_hash[:profile] = {}
|
67
|
+
@output_hash[:profile][:examples] = format_profile_examples(profile)
|
68
|
+
@output_hash[:profile][:slowest] = profile.slow_duration
|
69
|
+
@output_hash[:profile][:total] = profile.duration
|
70
|
+
end
|
71
|
+
|
72
|
+
# @api private
|
73
|
+
def dump_profile_slowest_example_groups(profile)
|
74
|
+
@output_hash[:profile] ||= {}
|
75
|
+
@output_hash[:profile][:groups] = format_profile_groups(profile)
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def print_result(response)
|
81
|
+
return print_success if response.code == '201'
|
82
|
+
print_error(response)
|
83
|
+
end
|
84
|
+
|
85
|
+
def print_success
|
86
|
+
output.write "Report was successfullty submitted to ReportFactory\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
def print_error(response)
|
90
|
+
output.write 'Unfortunately the test report could not be submitted'\
|
91
|
+
" to ReportFactory. #{response.code}: #{response.msg}\n"
|
92
|
+
end
|
93
|
+
|
94
|
+
def format_example(example)
|
95
|
+
{
|
96
|
+
id: example.id,
|
97
|
+
description: example.description,
|
98
|
+
full_description: example.full_description,
|
99
|
+
status: example.execution_result.status.to_s,
|
100
|
+
file_path: example.metadata[:file_path],
|
101
|
+
line_number: example.metadata[:line_number],
|
102
|
+
run_time: example.execution_result.run_time,
|
103
|
+
pending_message: example.execution_result.pending_message
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
def format_exception(example)
|
108
|
+
exception = example.exception
|
109
|
+
return unless exception
|
110
|
+
{
|
111
|
+
class: exception.class.name,
|
112
|
+
message: exception.message,
|
113
|
+
backtrace: exception.backtrace
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
117
|
+
def format_profile_examples(profile)
|
118
|
+
profile.slowest_examples.map do |example|
|
119
|
+
format_example(example).tap do |hash|
|
120
|
+
hash[:run_time] = example.execution_result.run_time
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def format_profile_groups(profile)
|
126
|
+
profile.slowest_groups.map { |loc, hash| hash.update(location: loc) }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'report_factory/rspec/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'report_factory-rspec'
|
9
|
+
spec.version = ReportFactory::Rspec::VERSION
|
10
|
+
spec.authors = ['Igor Starostenko']
|
11
|
+
spec.email = ['contactigorstar@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = "report_factory-rspec_#{ReportFactory::Rspec::VERSION}"
|
14
|
+
spec.description = 'RSpec adapter for report_factory'
|
15
|
+
spec.homepage = 'https://github.com/igor-starostenko/report_factory-rspec'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_dependency 'rspec', '~> 3.5'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.51.0'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: report_factory-rspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Starostenko
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.51.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.51.0
|
55
|
+
description: RSpec adapter for report_factory
|
56
|
+
email:
|
57
|
+
- contactigorstar@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".rubocop.yml"
|
65
|
+
- ".ruby-gemset"
|
66
|
+
- ".ruby-version"
|
67
|
+
- CODE_OF_CONDUCT.md
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- LICENSE
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- bin/console
|
75
|
+
- bin/setup
|
76
|
+
- lib/report_factory/rspec.rb
|
77
|
+
- lib/report_factory/rspec/api.rb
|
78
|
+
- lib/report_factory/rspec/configuration.rb
|
79
|
+
- lib/report_factory/rspec/formatter.rb
|
80
|
+
- lib/report_factory/rspec/version.rb
|
81
|
+
- report_factory-rspec.gemspec
|
82
|
+
homepage: https://github.com/igor-starostenko/report_factory-rspec
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata: {}
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 2.6.12
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: report_factory-rspec_0.1.0
|
106
|
+
test_files: []
|