sauce_documentation 0.0.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 97f09861c2efaf81d2a24b4f8636bb6658315aed
4
+ data.tar.gz: 13c0df048a70140d662eec5908e63e10e415f4eb
5
+ SHA512:
6
+ metadata.gz: f1a1999e7d836795c08d9341429224d6e1ccecf9bbc783609e3c320fe761e303e665692661aa34b1153146b896a9b232ea64008c7b53f3c1ea27331162c02086
7
+ data.tar.gz: 6b8fe614763f9143363036b8e65d29c87a0a129040957b1f0b0196f3c8d616a5c747c23e42a9368aa7ca009780d613db76c08aaef62857168f83f5412842cfac
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ coverage/
2
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ Style/Documentation:
2
+ Enabled: false
3
+ Metrics/MethodLength:
4
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.2.3
5
+ script:
6
+ - bundle exec thor spec
7
+ - bundle exec thor cover
8
+ notifications:
9
+ email:
10
+ on_success: never
11
+ on_failure: never
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem 'coveralls', require: false
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Sauce Documentation Formater
2
+ [![Gem Version](https://badge.fury.io/rb/sauce_documentation_formatter.svg)](https://rubygems.org/gems/sauce_documentation_formatter)
3
+ [![Build Status](https://travis-ci.org/bootstraponline/sauce_documentation_formatter.svg)](https://travis-ci.org/bootstraponline/sauce_documentation_formatter/builds)
4
+ [![Dependency Status](https://gemnasium.com/bootstraponline/sauce_documentation_formatter.svg)](https://gemnasium.com/bootstraponline/sauce_documentation_formatter)
5
+ [![Coverage Status](https://coveralls.io/repos/bootstraponline/sauce_documentation_formatter/badge.svg?nocache2)](https://coveralls.io/r/bootstraponline/sauce_documentation_formatter)
6
+
7
+ ## Usage
8
+
9
+ ```ruby
10
+ # spec_helper.rb
11
+ require 'sauce_documentation'
12
+
13
+ RSpec.configure do |config|
14
+ config.before(:suite) do
15
+ config.add_formatter SauceDocumentation
16
+ end
17
+ end
18
+ ```
19
+
20
+ Identical to RSpec Documentation formatter except the `example.metadata[:sauce_test_link]`
21
+ is used to output the sauce test link.
22
+
23
+ # Example output
24
+
25
+ ```
26
+ 2) SauceDocumentation fails and outputs sauce link
27
+ Failure/Error: expect(3).to eq(4)
28
+
29
+ expected: 4
30
+ got: 3
31
+
32
+ (compared using ==)
33
+
34
+ https://saucelabs.com/beta/tests/1234
35
+
36
+ # ./formatter_spec/sauce_documentation_spec.rb:16:in `block (2 levels) in <top (required)>'
37
+ ```
data/Thorfile ADDED
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'appium_thor'
3
+
4
+ Appium::Thor::Config.set do
5
+ gem_name 'sauce_documentation'
6
+ github_owner 'bootstraponline'
7
+ version_file 'lib/sauce_documentation/version.rb'
8
+ end
9
+
10
+ # Must use '::' otherwise Default will point to Thor::Sandbox::Default
11
+ # Debug by calling Thor::Base.subclass_files via Pry
12
+ #
13
+ # https://github.com/erikhuda/thor/issues/484
14
+ #
15
+ # rubocop:disable Style/ClassAndModuleChildren
16
+ class ::Default < Thor
17
+ desc 'spec', 'Run RSpec tests'
18
+ def spec
19
+ exec 'bundle exec rspec spec'
20
+ end
21
+
22
+ desc 'cover', 'Push coverage results to coveralls'
23
+ def cover
24
+ require 'coveralls'
25
+ Coveralls.push!
26
+ end
27
+
28
+ # so many errors.
29
+ desc 'cop', 'Execute rubocop'
30
+ def cop
31
+ exec 'bundle exec rubocop --display-cop-names lib/'
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe 'SauceDocumentation' do
4
+ def add_sauce_link
5
+ RSpec.current_example.metadata[:sauce_test_link] = 'https://saucelabs.com/beta/tests/1234'
6
+ end
7
+
8
+ it 'fails and does not output sauce link' do
9
+ # if we're not using sauce_rspec then we should see the regular failure
10
+ # except omit the link
11
+ expect(1).to eq(2)
12
+ end
13
+
14
+ it 'fails and outputs sauce link' do
15
+ add_sauce_link
16
+ expect(3).to eq(4)
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require_relative 'start_coverage'
3
+
4
+ require 'rspec'
5
+ require_relative '../lib/sauce_documentation'
6
+
7
+ RSpec.configure do |config|
8
+ config.add_formatter SauceDocumentation
9
+ end
@@ -0,0 +1,6 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ # Omit coveralls formatter since we're merging suite results via a Thor task
5
+ # https://coveralls.zendesk.com/hc/en-us/articles/201769485-Ruby-Rails
6
+ SimpleCov.start { add_filter File.basename(__dir__) }
@@ -0,0 +1,45 @@
1
+ class SauceDocumentation < RSpec::Core::Formatters::DocumentationFormatter
2
+ RSpec::Core::Formatters.register self, :dump_failures
3
+
4
+ #
5
+ # Modifying the exception backtrace causes the default formatter to prepend #
6
+ #
7
+ # If the link is outputted after failure.fully_formatted then the backtrace
8
+ # will always appear before the Sauce job link
9
+ #
10
+ # By updating the exception message with instance_eval, the job link will
11
+ # show up after the message and before the backtrace without additional
12
+ # formatting.
13
+ #
14
+
15
+ def dump_failures(notification)
16
+ failure_notifications = notification.failure_notifications
17
+ return if failure_notifications.empty?
18
+
19
+ failure_notifications.each do |failure|
20
+ exception = failure.exception
21
+ next unless exception
22
+
23
+ sauce_test_link = failure.example.metadata[:sauce_test_link]
24
+ next unless sauce_test_link
25
+
26
+ # Use nonbreaking space to bypass message.strip and ensure we have
27
+ # a newline after the message and before the stack trace.
28
+ nbsp = "\u00A0"
29
+ message = "#{exception.message}\n#{sauce_test_link}\n#{nbsp}"
30
+ exception.instance_eval <<-RUBY
31
+ def message
32
+ %q(#{message})
33
+ end
34
+
35
+ def to_s
36
+ message
37
+ end
38
+ RUBY
39
+ end
40
+
41
+ # Use default RSpec logic to format the failures now that we've
42
+ # attached the Sauce test link to the exceptions
43
+ super
44
+ end
45
+ end
@@ -0,0 +1,4 @@
1
+ module SauceDocumentationMetadata
2
+ VERSION = '0.0.3' unless defined? ::SauceDocumentationMetadata::VERSION
3
+ DATE = '2015-10-19' unless defined? ::SauceDocumentationMetadata::DATE
4
+ end
@@ -0,0 +1,2 @@
1
+ require_relative 'sauce_documentation/version'
2
+ require_relative 'sauce_documentation/sauce_documentation'
data/release_notes.md ADDED
@@ -0,0 +1,4 @@
1
+ #### v0.0.3 2015-10-19
2
+
3
+ - [04105e3](https://github.com/bootstraponline/sauce_documentation/commit/04105e3076fd854dcc767b6eee16e5d553880854) Release 0.0.3
4
+ - [47ca8db](https://github.com/bootstraponline/sauce_documentation/commit/47ca8db285f55ca963acf5b57294c28aa99e8498) Fix gemname
@@ -0,0 +1,25 @@
1
+ require_relative 'lib/sauce_documentation/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'sauce_documentation'
5
+ spec.version = SauceDocumentationMetadata::VERSION
6
+ spec.date = SauceDocumentationMetadata::DATE
7
+ spec.license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
8
+ spec.description = spec.summary = 'Sauce documentation formatter for RSpec'
9
+ spec.description += '.' # avoid identical warning
10
+ spec.authors = spec.email = ['code@bootstraponline.com']
11
+ spec.homepage = 'https://github.com/bootstraponline/sauce_rspec'
12
+ spec.require_paths = ['lib']
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
+ f.match(%r{^(test|spec|features)/})
16
+ end
17
+
18
+ spec.add_runtime_dependency 'rspec', '>= 3.3.0'
19
+
20
+ spec.add_development_dependency 'pry', '~> 0.10.2'
21
+ spec.add_development_dependency 'rubocop', '~> 0.34.2'
22
+ spec.add_development_dependency 'appium_thor', '~> 1.0.1'
23
+ spec.add_development_dependency 'simplecov', '~> 0.10.0'
24
+ spec.add_development_dependency 'coveralls', '~> 0.8.3'
25
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sauce_documentation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - code@bootstraponline.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-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.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.2
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.34.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.34.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: appium_thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.10.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.10.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: coveralls
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.8.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.8.3
97
+ description: Sauce documentation formatter for RSpec.
98
+ email:
99
+ - code@bootstraponline.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".coveralls.yml"
105
+ - ".gitignore"
106
+ - ".rubocop.yml"
107
+ - ".travis.yml"
108
+ - Gemfile
109
+ - README.md
110
+ - Thorfile
111
+ - formatter_spec/sauce_documentation_spec.rb
112
+ - formatter_spec/spec_helper.rb
113
+ - formatter_spec/start_coverage.rb
114
+ - lib/sauce_documentation.rb
115
+ - lib/sauce_documentation/sauce_documentation.rb
116
+ - lib/sauce_documentation/version.rb
117
+ - release_notes.md
118
+ - sauce_documentation.gemspec
119
+ homepage: https://github.com/bootstraponline/sauce_rspec
120
+ licenses:
121
+ - http://www.apache.org/licenses/LICENSE-2.0.txt
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.4.8
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Sauce documentation formatter for RSpec
143
+ test_files: []
144
+ has_rdoc: