ci_reporter_test_utils 0.0.1

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: a4524dd68b8ca444048a519326c060dd5a995b51
4
+ data.tar.gz: e89df200d023e811089918a8e7a2bdb957869204
5
+ SHA512:
6
+ metadata.gz: fe320dd32c551272e548ee263fe0405dd57860db1ea59ce762c2530f91d3f76c9fed087f3469c56d6192c0b5c4e2a5b11e930fdd6a09bc0f3a359428054533be
7
+ data.tar.gz: ef47db94dc3b9813b5c91b111ebeb2845ae16f9542eba0c0bc4534d0342433e1f615be6aaa66be5873f8c389dbe9d054f2e64c2c7b5b77a597517f34f05bfc37
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ci_reporter_test_utils.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2006-2014 Nick Sieger <nicksieger@gmail.com>
2
+ Copyright (c) 2014 The CI Reporter authors
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # CI::Reporter Test Utils
2
+
3
+ This is a collection of test utilities, and is likely of no interest
4
+ to anyone not developing [CI::Reporter][ci].
5
+
6
+ [ci]: https://github.com/ci-reporter/ci_reporter
7
+
8
+ ## Contributing
9
+
10
+ 1. Fork it ( https://github.com/ci-reporter/ci_reporter_test_utils/fork )
11
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
12
+ 3. Add a failing test.
13
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
14
+ 5. Ensure tests pass.
15
+ 6. Push to the branch (`git push origin my-new-feature`)
16
+ 7. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default do
4
+ puts "No tests to run, everything's fine!"
5
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ci/reporter/test_utils/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ci_reporter_test_utils"
8
+ spec.version = CI::Reporter::TestUtils::VERSION
9
+ spec.authors = ["Nick Sieger", "Jake Goulding"]
10
+ spec.email = ["nick@nicksieger.com", "jake.goulding@gmail.com"]
11
+ spec.summary = %q{Test utilities for CI::Reporter}
12
+ spec.homepage = "https://github.com/ci-reporter/ci_reporter_test_utils"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ end
@@ -0,0 +1,43 @@
1
+ require 'ci/reporter/test_utils'
2
+
3
+ module CI::Reporter::TestUtils
4
+ class Accessor
5
+ attr_reader :root
6
+
7
+ def initialize(xml)
8
+ @root = xml.root
9
+ end
10
+
11
+ def failures
12
+ root.elements.to_a("/testsuite/testcase/failure")
13
+ end
14
+
15
+ def errors
16
+ root.elements.to_a("/testsuite/testcase/error")
17
+ end
18
+
19
+ def testcases
20
+ root.elements.to_a("/testsuite/testcase")
21
+ end
22
+
23
+ [:failures, :errors, :skipped, :assertions, :tests].each do |attr|
24
+ define_method "#{attr}_count" do
25
+ root.attributes[attr.to_s].to_i
26
+ end
27
+ end
28
+
29
+ def system_out
30
+ all_text_nodes_as_string("/testsuite/system-out")
31
+ end
32
+
33
+ def system_err
34
+ all_text_nodes_as_string("/testsuite/system-err")
35
+ end
36
+
37
+ private
38
+
39
+ def all_text_nodes_as_string(xpath)
40
+ root.elements.to_a(xpath).map(&:texts).flatten.map(&:value).join.strip
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ require 'ci/reporter/test_utils'
2
+
3
+ module CI::Reporter::TestUtils
4
+ module Rake
5
+ def run_ruby_acceptance(cmd)
6
+ ENV['CI_REPORTS'] ||= "acceptance/reports"
7
+ if ENV['RUBYOPT']
8
+ opts = ENV['RUBYOPT']
9
+ ENV['RUBYOPT'] = nil
10
+ else
11
+ opts = "-rubygems"
12
+ end
13
+ begin
14
+ result_proc = proc {|ok,*| puts "Failures above are expected." unless ok }
15
+ ruby "-Ilib #{opts} #{cmd}", &result_proc
16
+ ensure
17
+ ENV['RUBYOPT'] = opts if opts != "-rubygems"
18
+ ENV.delete 'CI_REPORTS'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,34 @@
1
+ require 'ci/reporter/test_utils'
2
+
3
+ module CI::Reporter::TestUtils
4
+ module SharedExamples
5
+ shared_examples "nothing was output" do
6
+ describe "stdout" do
7
+ subject { result.system_out }
8
+ it { should be_empty }
9
+ end
10
+
11
+ describe "stderr" do
12
+ subject { result.system_err }
13
+ it { should be_empty }
14
+ end
15
+ end
16
+
17
+ shared_examples "a report with consistent attribute counts" do
18
+ describe "the failure count" do
19
+ subject { result.failures_count }
20
+ it { should eql result.failures.count }
21
+ end
22
+
23
+ describe "the error count" do
24
+ subject { result.errors_count }
25
+ it { should eql result.errors.count }
26
+ end
27
+
28
+ describe "the test count" do
29
+ subject { result.tests_count }
30
+ it { should eql result.testcases.count }
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,14 @@
1
+ require 'ci/reporter/test_utils'
2
+
3
+ module CI::Reporter::TestUtils
4
+ module Unit
5
+ def save_env(v)
6
+ ENV["PREV_#{v}"] = ENV[v]
7
+ end
8
+
9
+ def restore_env(v)
10
+ ENV[v] = ENV["PREV_#{v}"]
11
+ ENV.delete("PREV_#{v}")
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ module CI
2
+ module Reporter
3
+ module TestUtils
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require "ci/reporter/test_utils/version"
2
+
3
+ module CI
4
+ module Reporter
5
+ module TestUtils
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ci_reporter_test_utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nick Sieger
8
+ - Jake Goulding
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-06-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.6'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.6'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ description:
43
+ email:
44
+ - nick@nicksieger.com
45
+ - jake.goulding@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - ci_reporter_test_utils.gemspec
56
+ - lib/ci/reporter/test_utils.rb
57
+ - lib/ci/reporter/test_utils/accessor.rb
58
+ - lib/ci/reporter/test_utils/rake.rb
59
+ - lib/ci/reporter/test_utils/shared_examples.rb
60
+ - lib/ci/reporter/test_utils/unit.rb
61
+ - lib/ci/reporter/test_utils/version.rb
62
+ homepage: https://github.com/ci-reporter/ci_reporter_test_utils
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.2
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Test utilities for CI::Reporter
86
+ test_files: []