redcukes 0.1.0
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.
- data/.gitignore +4 -0
- data/.travis.yml +3 -0
- data/Gemfile +8 -0
- data/README.textile +4 -0
- data/Rakefile +7 -0
- data/lib/redcukes.rb +21 -0
- data/lib/redcukes/feature_report.rb +20 -0
- data/lib/redcukes/issue.rb +23 -0
- data/lib/redcukes/redmine.rb +31 -0
- data/lib/redcukes/version.rb +3 -0
- data/lib/support.rb +4 -0
- data/redcukes.gemspec +25 -0
- data/spec/lib/issues_spec.rb +10 -0
- data/spec/lib/redmine_spec.rb +28 -0
- data/spec/spec_helper.rb +1 -0
- metadata +94 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.textile
ADDED
data/Rakefile
ADDED
data/lib/redcukes.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'support.rb'
|
2
|
+
class Cucumber::Runtime
|
3
|
+
alias cucumber_features features
|
4
|
+
|
5
|
+
def features
|
6
|
+
filters = []
|
7
|
+
features = Cucumber::Ast::Features.new
|
8
|
+
issues = Redcukes::Issue.cucumber_features
|
9
|
+
issues.each do |s|
|
10
|
+
feature_file = Cucumber::FeatureFile.new("#{s.id}.feature", "Feature: #{s.subject}\n #{s.description}\n")
|
11
|
+
feature = feature_file.parse(filters, {}) rescue nil
|
12
|
+
features.add_feature(feature) if feature
|
13
|
+
end
|
14
|
+
features
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
AfterConfiguration do |config|
|
20
|
+
config.formats << ['Redcukes::FeatureReport', config.out_stream]
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Redcukes
|
2
|
+
class FeatureReport
|
3
|
+
def initialize(step_mother, io, options)
|
4
|
+
@status = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def before_feature feature
|
8
|
+
@status[:errors] = @status[:undefined] = @status[:failed] = @status[:passed]= 0
|
9
|
+
end
|
10
|
+
|
11
|
+
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
|
12
|
+
@status[status] += 1 if @status.has_key? status
|
13
|
+
end
|
14
|
+
|
15
|
+
def after_feature feature
|
16
|
+
id = feature.file.scan(/(\d+)/).flatten[0].to_i
|
17
|
+
Issue.update_status id, @status
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Redcukes
|
2
|
+
class Issue < Redmine
|
3
|
+
|
4
|
+
@@default_filter = {:status_id => '*'}
|
5
|
+
|
6
|
+
def self.cucumber_features
|
7
|
+
filter = @@default_filter.merge(self.search_filter)
|
8
|
+
find(:all, :params => filter)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.update_status(id, status={})
|
12
|
+
s = Issue.find(id)
|
13
|
+
return if s.nil?
|
14
|
+
if (status[:failed] != 0 || status[:errors] != 0)
|
15
|
+
s.status_id = self.result_status[:failed]
|
16
|
+
else
|
17
|
+
s.status_id = self.result_status[:passed] if status[:passed] > 0
|
18
|
+
end
|
19
|
+
s.save
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'active_resource'
|
2
|
+
|
3
|
+
module Redcukes
|
4
|
+
|
5
|
+
class Redmine < ActiveResource::Base
|
6
|
+
@@result = nil
|
7
|
+
@@search_content = nil
|
8
|
+
self.format = :xml
|
9
|
+
|
10
|
+
def self.result_status=(value)
|
11
|
+
@@result = value
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.result_status
|
15
|
+
@@result || {:passed => 3,:failed => 6}
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.search_filter=(value)
|
19
|
+
@@search_content = value
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.search_filter
|
23
|
+
@@search_content || {}
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.configure &block
|
27
|
+
block.call(self)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/lib/support.rb
ADDED
data/redcukes.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "redcukes/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "redcukes"
|
7
|
+
s.version = Redcukes::VERSION
|
8
|
+
s.authors = ["Jijesh Mohan"]
|
9
|
+
s.email = ["jijeshmohan@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/jijeshmohan/redcukes"
|
11
|
+
s.summary = %q{Redmine-cucumber integration gem}
|
12
|
+
s.description = %q{To run redmine issues using cucumber and update the execution status back in redmine}
|
13
|
+
|
14
|
+
s.rubyforge_project = "redcukes"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "rspec"
|
23
|
+
s.add_runtime_dependency "activeresource"
|
24
|
+
s.add_runtime_dependency "cucumber"
|
25
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require (File.expand_path('./../../spec_helper', __FILE__))
|
2
|
+
|
3
|
+
describe Redcukes::Issue do
|
4
|
+
it "should respond to active resource attributes" do
|
5
|
+
Redcukes::Issue.should be_respond_to :find
|
6
|
+
end
|
7
|
+
it "should respond to cucumber_features" do
|
8
|
+
Redcukes::Issue.should be_respond_to :cucumber_features
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require (File.expand_path('./../../spec_helper', __FILE__))
|
2
|
+
|
3
|
+
describe Redcukes::Redmine do
|
4
|
+
|
5
|
+
it "should have default attributes" do
|
6
|
+
Redcukes::Redmine.format.should == ActiveResource::Formats::XmlFormat
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should respond to search filter attribute" do
|
10
|
+
Redcukes::Redmine.should be_respond_to :search_filter
|
11
|
+
end
|
12
|
+
|
13
|
+
context "redmine configuration" do
|
14
|
+
|
15
|
+
it "should respond to configure" do
|
16
|
+
Redcukes::Redmine.should be_respond_to :configure
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to configure attributes" do
|
20
|
+
Redcukes::Redmine.configure do |c|
|
21
|
+
c.user= "user"
|
22
|
+
end
|
23
|
+
Redcukes::Redmine.user.should == "user"
|
24
|
+
Redcukes::Redmine.password.should be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require(File.expand_path('../../lib/support', __FILE__))
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redcukes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jijesh Mohan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-31 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &73547580 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *73547580
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activeresource
|
27
|
+
requirement: &73545730 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *73545730
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: cucumber
|
38
|
+
requirement: &73545240 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *73545240
|
47
|
+
description: To run redmine issues using cucumber and update the execution status
|
48
|
+
back in redmine
|
49
|
+
email:
|
50
|
+
- jijeshmohan@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- .travis.yml
|
57
|
+
- Gemfile
|
58
|
+
- README.textile
|
59
|
+
- Rakefile
|
60
|
+
- lib/redcukes.rb
|
61
|
+
- lib/redcukes/feature_report.rb
|
62
|
+
- lib/redcukes/issue.rb
|
63
|
+
- lib/redcukes/redmine.rb
|
64
|
+
- lib/redcukes/version.rb
|
65
|
+
- lib/support.rb
|
66
|
+
- redcukes.gemspec
|
67
|
+
- spec/lib/issues_spec.rb
|
68
|
+
- spec/lib/redmine_spec.rb
|
69
|
+
- spec/spec_helper.rb
|
70
|
+
homepage: https://github.com/jijeshmohan/redcukes
|
71
|
+
licenses: []
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project: redcukes
|
90
|
+
rubygems_version: 1.8.10
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: Redmine-cucumber integration gem
|
94
|
+
test_files: []
|