ci_reporter_spinach 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3f2e86d5d8c12780724e6fbd018fc29f76bf9dd4
4
+ data.tar.gz: fb084b6533486d9bb45e1a6d653c795ff6b36010
5
+ SHA512:
6
+ metadata.gz: 15f1a4898eafaf09e3ad29d06459ac260f72757017f54392a4a5325397b775cfe4ec4461c96af9857d79dcefe44552280103885ee7580b01de07179f2e9421e3
7
+ data.tar.gz: f859d2dfcee09b71ec12293d0c2388703e304f1905f917fddbaba2361fc0e893071fbdb729904f39d4a77d2e8c35e737be369cee0af72bcc157488a87ade8aee
@@ -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
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0
4
+ - 2.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ci_reporter_spinach.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,65 @@
1
+ # CI::Reporter::Spinach
2
+
3
+ Connects [Spinach][spin] to [CI::Reporter][ci], and then to your CI
4
+ system.
5
+
6
+ [spin]: https://github.com/codegram/spinach
7
+ [ci]: https://github.com/ci-reporter/ci_reporter
8
+
9
+ ## Supported versions
10
+
11
+ The latest release of Spinach 0.8 is supported.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'ci_reporter_spinach'
19
+ ```
20
+
21
+ And then install it:
22
+
23
+ ```
24
+ $ bundle
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Require the reporter in your Rakefile, and ensure that
30
+ `ci:setup:spinach` is a dependency of your RSpec task.
31
+
32
+ Unlike other CI::Reporter gems, you must **also** explictly tell
33
+ Spinach to use the reporter!
34
+
35
+ ```ruby
36
+ require 'ci/reporter/rake/spinach'
37
+
38
+ task :spinach do
39
+ # Note `-r ci_reporter`!
40
+ exec "spinach -r ci_reporter"
41
+ end
42
+
43
+ task :spinach => 'ci:setup:spinach'
44
+ ```
45
+
46
+ ### Advanced usage
47
+
48
+ Refer to the shared [documentation][ci] for details on setting up
49
+ CI::Reporter.
50
+
51
+ ### Cucumber
52
+
53
+ If you use both Cucumber and Spinach, you are likely to see strange
54
+ errors due to `gherkin` and `gherkin-ruby` both being loaded. Choose
55
+ only one of these frameworks.
56
+
57
+ ## Contributing
58
+
59
+ 1. Fork it ( https://github.com/ci-reporter/ci_reporter_spinach/fork )
60
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
61
+ 3. Add a failing test.
62
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 5. Ensure tests pass.
64
+ 6. Push to the branch (`git push origin my-new-feature`)
65
+ 7. Create a new Pull Request
@@ -0,0 +1,27 @@
1
+ require "bundler/gem_tasks"
2
+ require 'ci/reporter/internal'
3
+ include CI::Reporter::Internal
4
+
5
+ namespace :generate do
6
+ task :clean do
7
+ rm_rf "acceptance/reports"
8
+ end
9
+
10
+ task :spinach do
11
+ spinach = "#{Gem.loaded_specs['spinach'].gem_dir}/bin/spinach"
12
+ run_ruby_acceptance "-I../../lib -rci/reporter/rake/spinach_loader -S #{spinach} -r ci_reporter -f acceptance/spinach/features"
13
+ end
14
+
15
+ task :all => [:clean, :spinach]
16
+ end
17
+
18
+ task :acceptance => "generate:all"
19
+
20
+ require 'rspec/core/rake_task'
21
+ RSpec::Core::RakeTask.new(:acceptance_spec) do |t|
22
+ t.pattern = FileList['acceptance/verification_spec.rb']
23
+ t.rspec_opts = "--color"
24
+ end
25
+ task :acceptance => :acceptance_spec
26
+
27
+ task :default => :acceptance
@@ -0,0 +1 @@
1
+ reports/
@@ -0,0 +1,24 @@
1
+ Feature: Example Spinach feature
2
+ As a conscientious developer who writes features
3
+ I want to be able to see my features passing on the CI Server
4
+ So that I can bask in the glow of a green bar
5
+
6
+ Scenario: Conscientious developer
7
+ Given that I am a conscientious developer
8
+ And I write cucumber features
9
+ Then I should see a green bar
10
+
11
+ Scenario: Lazy hacker
12
+ Given that I am a lazy hacker
13
+ And I don't bother writing cucumber features
14
+ Then I should be fired
15
+
16
+ Scenario: Bad coder
17
+ Given that I can't code for peanuts
18
+ And I write step definitions that throw exceptions
19
+ Then I shouldn't be allowed out in public
20
+
21
+ Scenario: Missing steps
22
+ Given that I am a lazy hacker
23
+ And I don't implement steps before I commit
24
+ Then I should be fired
@@ -0,0 +1,34 @@
1
+ require 'rspec'
2
+
3
+ class Spinach::Features::ExampleSpinachFeature < Spinach::FeatureSteps
4
+ include RSpec::Matchers
5
+
6
+ step 'that I am a conscientious developer' do
7
+ end
8
+
9
+ step 'I write cucumber features' do
10
+ end
11
+
12
+ step 'I should see a green bar' do
13
+ end
14
+
15
+ step 'that I am a lazy hacker' do
16
+ end
17
+
18
+ step 'I don\'t bother writing cucumber features' do
19
+ false.should be true
20
+ end
21
+
22
+ step 'I should be fired' do
23
+ end
24
+
25
+ step 'that I can\'t code for peanuts' do
26
+ end
27
+
28
+ step 'I write step definitions that throw exceptions' do
29
+ raise RuntimeError, "User error!"
30
+ end
31
+
32
+ step 'I shouldn\'t be allowed out in public' do
33
+ end
34
+ end
@@ -0,0 +1,44 @@
1
+ require 'rexml/document'
2
+
3
+ REPORTS_DIR = File.dirname(__FILE__) + '/reports'
4
+
5
+ describe "Spinach acceptance" do
6
+ it "should generate one XML file" do
7
+ File.exist?(File.join(REPORTS_DIR, 'FEATURES-Example-Spinach-feature.xml')).should == true
8
+
9
+ Dir["#{REPORTS_DIR}/FEATURES-*Spinach*.xml"].length.should == 1
10
+ end
11
+
12
+ context "SPINACH report file" do
13
+ before :each do
14
+ @doc = File.open(File.join(REPORTS_DIR, 'FEATURES-Example-Spinach-feature.xml')) do |f|
15
+ REXML::Document.new(f)
16
+ end
17
+ end
18
+
19
+ it "should have three tests and two failures" do
20
+ @doc.root.attributes["errors"].should == "2"
21
+ @doc.root.attributes["failures"].should == "1"
22
+ @doc.root.attributes["tests"].should == "4"
23
+ @doc.root.elements.to_a("/testsuite/testcase").size.should == 4
24
+ end
25
+
26
+ it "should have one failure for the lazy hacker" do
27
+ failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Lazy hacker']/failure")
28
+ failures.size.should == 1
29
+ failures.first.attributes["type"].should =~ /ExpectationNotMetError/
30
+ end
31
+
32
+ it "should have one failure for missing steps" do
33
+ failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Missing steps']/failure")
34
+ failures.size.should == 1
35
+ failures.first.attributes["type"].should =~ /StepNotDefinedException/
36
+ end
37
+
38
+ it "should have one failure for the bad coder" do
39
+ failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Bad coder']/failure")
40
+ failures.size.should == 1
41
+ failures.first.attributes["type"].should == "RuntimeError"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,26 @@
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/spinach/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ci_reporter_spinach"
8
+ spec.version = CI::Reporter::SpinachVersion::VERSION
9
+ spec.authors = ["Nick Sieger", "Jake Goulding"]
10
+ spec.email = ["nick@nicksieger.com", "jake.goulding@gmail.com"]
11
+ spec.summary = %q{Connects CI::Reporter to Spinach}
12
+ spec.homepage = "https://github.com/ci-reporter/ci_reporter_spinach"
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|acceptance)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "ci_reporter", "2.0.0.alpha1"
21
+ spec.add_dependency "spinach", "~> 0.8.7"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec", "~> 2.0"
26
+ end
@@ -0,0 +1,19 @@
1
+ namespace :ci do
2
+ namespace :setup do
3
+ task :spinach_report_cleanup do
4
+ rm_rf ENV["CI_REPORTS"] || "features/reports"
5
+ end
6
+
7
+ task :spinach => :spinach_report_cleanup do
8
+ loader = File.expand_path('prepare_ci_reporter.rb', ENV["SPINACH_SUPPORT_PATH"] || 'features/support')
9
+ if !File.exist? loader
10
+ File.open(loader, 'w') do |f|
11
+ f.puts "require 'ci/reporter/rake/spinach_loader'"
12
+ end
13
+ at_exit do
14
+ File.unlink loader
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ $: << File.dirname(__FILE__) + "/../../.."
2
+ require 'ci/reporter/spinach'
3
+
4
+ ENV['CI_CAPTURE'] = 'off'
@@ -0,0 +1,83 @@
1
+ require 'ci/reporter/core'
2
+ require 'ci/reporter/spinach/version'
3
+ require 'spinach'
4
+
5
+ module CI
6
+ module Reporter
7
+ class Spinach < ::Spinach::Reporter
8
+ include SpinachVersion
9
+
10
+ def initialize(options = nil)
11
+ @options = options
12
+ @report_manager = ReportManager.new('features')
13
+ end
14
+
15
+ def before_feature_run(feature)
16
+ @test_suite = TestSuite.new(feature.is_a?(Hash) ? feature['name'] : feature.name)
17
+ @test_suite.start
18
+ end
19
+
20
+ def before_scenario_run(scenario, step_definitions = nil)
21
+ @test_case = TestCase.new(scenario.is_a?(Hash) ? scenario['name'] : scenario.name)
22
+ @test_case.start
23
+ end
24
+
25
+ def on_undefined_step(step, failure, step_definitions = nil)
26
+ @test_case.failures << SpinachFailure.new(:error, step, failure, nil)
27
+ end
28
+
29
+ def on_failed_step(step, failure, step_location, step_definitions = nil)
30
+ @test_case.failures << SpinachFailure.new(:failed, step, failure, step_location)
31
+ end
32
+
33
+ def on_error_step(step, failure, step_location, step_definitions = nil)
34
+ @test_case.failures << SpinachFailure.new(:error, step, failure, step_location)
35
+ end
36
+
37
+ def after_scenario_run(scenario, step_definitions = nil)
38
+ @test_case.finish
39
+ @test_suite.testcases << @test_case
40
+ @test_case = nil
41
+ end
42
+
43
+ def after_feature_run(feature)
44
+ @test_suite.finish
45
+ @report_manager.write_report(@test_suite)
46
+ @test_suite = nil
47
+ end
48
+ end
49
+
50
+ class SpinachFailure
51
+ def initialize(type, step, failure, step_location)
52
+ @type = type
53
+ @step = step
54
+ @failure = failure
55
+ @step_location = step_location
56
+ end
57
+
58
+ def failure?
59
+ @type == :failed
60
+ end
61
+
62
+ def error?
63
+ @type == :error
64
+ end
65
+
66
+ def name
67
+ @failure.class.name
68
+ end
69
+
70
+ def message
71
+ @failure.message
72
+ end
73
+
74
+ def location
75
+ @failure.backtrace.join("\n")
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ class Spinach::Reporter
82
+ CiReporter = ::CI::Reporter::Spinach
83
+ end
@@ -0,0 +1,7 @@
1
+ module CI
2
+ module Reporter
3
+ module SpinachVersion
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ci_reporter_spinach
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-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ci_reporter
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 2.0.0.alpha1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 2.0.0.alpha1
28
+ - !ruby/object:Gem::Dependency
29
+ name: spinach
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.8.7
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.8.7
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.6'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.6'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '2.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '2.0'
84
+ description:
85
+ email:
86
+ - nick@nicksieger.com
87
+ - jake.goulding@gmail.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - acceptance/.gitignore
99
+ - acceptance/spinach/features/spinach_example.feature
100
+ - acceptance/spinach/features/steps/example_spinach_feature.rb
101
+ - acceptance/verification_spec.rb
102
+ - ci_reporter_spinach.gemspec
103
+ - lib/ci/reporter/rake/spinach.rb
104
+ - lib/ci/reporter/rake/spinach_loader.rb
105
+ - lib/ci/reporter/spinach.rb
106
+ - lib/ci/reporter/spinach/version.rb
107
+ homepage: https://github.com/ci-reporter/ci_reporter_spinach
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.2.2
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Connects CI::Reporter to Spinach
131
+ test_files:
132
+ - acceptance/.gitignore
133
+ - acceptance/spinach/features/spinach_example.feature
134
+ - acceptance/spinach/features/steps/example_spinach_feature.rb
135
+ - acceptance/verification_spec.rb