taskmapper-redmine 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/provider/comment.rb +13 -0
- data/spec/comments_spec.rb +72 -57
- data/spec/tickets_spec.rb +62 -45
- data/taskmapper-redmine.gemspec +3 -3
- metadata +78 -57
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/lib/provider/comment.rb
CHANGED
@@ -23,6 +23,10 @@ module TaskMapper::Provider
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def save
|
27
|
+
raise TaskMapper::Exception.new "Redmine API doesn't support comment updates"
|
28
|
+
end
|
29
|
+
|
26
30
|
def self.find_by_id(project_id, ticket_id, id)
|
27
31
|
self.search(ticket_id).select { |journal| journal.id == id.to_i }.first
|
28
32
|
end
|
@@ -51,5 +55,14 @@ module TaskMapper::Provider
|
|
51
55
|
journal
|
52
56
|
end
|
53
57
|
end
|
58
|
+
|
59
|
+
class Net::HTTP
|
60
|
+
def send(*args)
|
61
|
+
puts "request: #{args.inspect}"
|
62
|
+
resp = super
|
63
|
+
puts "response: #{resp.inspect}"
|
64
|
+
resp
|
65
|
+
end
|
66
|
+
end
|
54
67
|
end
|
55
68
|
end
|
data/spec/comments_spec.rb
CHANGED
@@ -5,67 +5,82 @@ describe TaskMapper::Provider::Redmine::Comment do
|
|
5
5
|
let(:project_id) { 1 }
|
6
6
|
let(:ticket_id) { 1 }
|
7
7
|
let(:comment_id) { 1 }
|
8
|
-
let(:
|
9
|
-
let(:
|
10
|
-
let(:
|
11
|
-
|
12
|
-
|
13
|
-
headers = {'X-Redmine-API-Key' => 'abcdefghijk', 'Accept' => 'application/xml'}
|
14
|
-
headers_post_put = {'X-Redmine-API-Key' => 'abcdefghijk', 'Content-Type' => 'application/xml'}
|
15
|
-
ActiveResource::HttpMock.respond_to do |mock|
|
16
|
-
mock.get '/projects.xml', headers, fixture_for('projects'), 200
|
17
|
-
mock.get '/projects/1.xml', headers, fixture_for('projects/test-repo12'), 200
|
18
|
-
mock.get '/issues.xml?project_id=1', headers, fixture_for('issues'), 200
|
19
|
-
mock.get '/issues.xml', headers, fixture_for('issues'), 200
|
20
|
-
mock.get '/issues/1.xml?include=journals', headers, fixture_for('issues/1'), 200
|
21
|
-
mock.put '/issues/1.xml', headers_post_put, '', 200
|
22
|
-
mock.post '/issues.xml', headers_post_put, '', 200
|
23
|
-
end
|
24
|
-
end
|
8
|
+
let(:comment_class) { TaskMapper::Provider::Redmine::Comment }
|
9
|
+
let(:tm) { TaskMapper.new :redmine, :server => 'http://demo.redmine.org/', :token => 'abcdefghijk' }
|
10
|
+
let(:headers_auth) { {'X-Redmine-API-Key' => 'abcdefghijk' } }
|
11
|
+
let(:headers_get) { headers_auth.merge('Accept' => 'application/xml') }
|
12
|
+
let(:headers_post) { headers_auth.merge('Content-Type' => 'application/xml') }
|
25
13
|
|
26
14
|
before(:each) do
|
27
|
-
@ticket = project.ticket(ticket_id)
|
28
15
|
end
|
29
16
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
comments
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
comments
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
comment
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
comment
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
17
|
+
describe "Retrieving comments" do
|
18
|
+
before(:each) do
|
19
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
20
|
+
mock.get '/projects/1.xml', headers_get, fixture_for('projects/test-repo12'), 200
|
21
|
+
mock.get '/issues/1.xml?include=journals', headers_get, fixture_for('issues/1'), 200
|
22
|
+
end
|
23
|
+
end
|
24
|
+
let(:project) { tm.project project_id }
|
25
|
+
let(:ticket) { project.ticket ticket_id }
|
26
|
+
|
27
|
+
context "when #comments" do
|
28
|
+
subject { ticket.comments }
|
29
|
+
it { should be_an_instance_of Array }
|
30
|
+
it { should have(2).items }
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when #comments with a list of id's" do
|
34
|
+
subject { ticket.comments [comment_id] }
|
35
|
+
it { should be_an_instance_of Array }
|
36
|
+
it { should have(1).items }
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when #comments with a comment attribute" do
|
40
|
+
subject { ticket.comments :id => comment_id }
|
41
|
+
it { should be_an_instance_of Array }
|
42
|
+
it { should have(1).items }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "Retrieve a single comment" do
|
46
|
+
context "when #comment with an id" do
|
47
|
+
subject { ticket.comment comment_id }
|
48
|
+
it { should be_an_instance_of comment_class }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when #comment with an attribute" do
|
52
|
+
subject { ticket.comment :id => comment_id }
|
53
|
+
it { should be_an_instance_of comment_class }
|
54
|
+
end
|
55
|
+
end
|
63
56
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
57
|
+
|
58
|
+
describe "Create and update" do
|
59
|
+
before(:each) do
|
60
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
61
|
+
mock.get '/projects/1.xml', headers_get, fixture_for('projects/test-repo12'), 200
|
62
|
+
mock.get '/issues/1.xml?include=journals', headers_get, fixture_for('issues/1'), 200
|
63
|
+
mock.put '/issues/1.xml', headers_post, '', 200
|
64
|
+
end
|
65
|
+
end
|
66
|
+
let(:project) { tm.project project_id }
|
67
|
+
let(:ticket) { project.ticket ticket_id }
|
68
|
+
|
69
|
+
context "when #comment!" do
|
70
|
+
subject { ticket.comment! :body => 'hello there boys and girls' }
|
71
|
+
it { should be_an_instance_of comment_class }
|
72
|
+
context "when #ticket_id" do
|
73
|
+
subject { ticket.comment!(:body => 'hello there boys and girls').ticket_id }
|
74
|
+
it { should_not be_nil }
|
75
|
+
it { should_not be_zero }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "when #save" do
|
80
|
+
let(:comment) { ticket.comment(comment_id) }
|
81
|
+
let(:changed_comment) { comment.body = 'change'; comment }
|
82
|
+
subject { lambda { changed_comment.save } }
|
83
|
+
it { should raise_error "Redmine API doesn't support comment updates" }
|
84
|
+
end
|
70
85
|
end
|
71
86
|
end
|
data/spec/tickets_spec.rb
CHANGED
@@ -1,64 +1,81 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe TaskMapper::Provider::Redmine::Ticket do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
let(:headers_auth) { {'X-Redmine-API-Key' => 'abcdefghijk'} }
|
5
|
+
let(:headers_get) { headers_auth.merge('Accept' => 'application/xml') }
|
6
|
+
let(:headers_post_put) { headers_auth.merge('Content-Type' => 'application/xml') }
|
7
|
+
let(:project_id) { 1 }
|
8
|
+
let(:tm) { TaskMapper.new :redmine, :server => 'http://demo.redmine.org/', :token => 'abcdefghijk' }
|
9
|
+
let(:ticket_class) { TaskMapper::Provider::Redmine::Ticket }
|
10
|
+
let(:ticket_id) { 1 }
|
11
|
+
|
12
|
+
describe "Retrieving tickets" do
|
13
|
+
before(:each) do
|
14
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
15
|
+
mock.get '/projects/1.xml', headers_get, fixture_for('projects/test-repo12'), 200
|
16
|
+
mock.get '/issues.xml?include=journals&project_id=1', headers_get, fixture_for('issues'), 200
|
17
|
+
mock.get '/issues/1.xml?include=journals', headers_get, fixture_for('issues/1'), 200
|
18
|
+
end
|
16
19
|
end
|
17
|
-
|
18
|
-
@taskmapper = TaskMapper.new :redmine, :server => 'http://demo.redmine.org/', :token => 'abcdefghijk'
|
19
|
-
@project = @taskmapper.project(@project_id)
|
20
|
-
@klass = TaskMapper::Provider::Redmine::Ticket
|
21
|
-
end
|
20
|
+
let(:project) { tm.project project_id }
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
22
|
+
context "when #tickets" do
|
23
|
+
subject { project.tickets }
|
24
|
+
it { should be_an_instance_of Array }
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
26
|
+
context "when #tickets.first" do
|
27
|
+
subject { project.tickets.first }
|
28
|
+
it { should be_an_instance_of ticket_class }
|
29
|
+
end
|
30
|
+
end
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
context "when #tickets with an array of id's" do
|
33
|
+
subject { project.tickets [ticket_id] }
|
34
|
+
it { should be_an_instance_of Array }
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when #tickets with attributes" do
|
38
|
+
subject { project.tickets :id => ticket_id }
|
39
|
+
it { should be_an_instance_of Array }
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
describe "Retrieving a single ticket" do
|
43
|
+
context "when #ticket with an id" do
|
44
|
+
subject { project.ticket ticket_id }
|
45
|
+
it { should be_an_instance_of ticket_class }
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when #ticket with attributes" do
|
49
|
+
subject { project.ticket :id => ticket_id }
|
50
|
+
it { should be_an_instance_of ticket_class }
|
51
|
+
end
|
52
|
+
end
|
44
53
|
end
|
45
54
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
55
|
+
describe "Create and Update" do
|
56
|
+
before(:each) do
|
57
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
58
|
+
mock.get '/projects/1.xml', headers_get, fixture_for('projects/test-repo12'), 200
|
59
|
+
mock.post '/issues.xml', headers_post_put, '', 200
|
60
|
+
end
|
61
|
+
end
|
62
|
+
let(:project) { tm.project project_id }
|
63
|
+
|
64
|
+
context "when #ticket!" do
|
65
|
+
subject { project.ticket! :title => 'Ticket #12', :description => 'Body'}
|
66
|
+
it { should be_an_instance_of ticket_class }
|
67
|
+
end
|
68
|
+
|
69
|
+
context "when #save" do
|
70
|
+
subject { project.ticket ticket_id }
|
71
|
+
end
|
50
72
|
end
|
51
73
|
|
52
74
|
it "should be able to update and save a ticket" do
|
75
|
+
pending
|
53
76
|
@ticket = @project.ticket(1)
|
54
77
|
@ticket.description = 'hello'
|
55
78
|
@ticket.save.should == true
|
56
79
|
end
|
57
80
|
|
58
|
-
it "should be able to create a ticket" do
|
59
|
-
@ticket = @project.ticket!(:title => 'Ticket #12', :description => 'Body')
|
60
|
-
@ticket.should be_an_instance_of(@klass)
|
61
|
-
@ticket.project_id.should_not be_nil
|
62
|
-
end
|
63
|
-
|
64
81
|
end
|
data/taskmapper-redmine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "taskmapper-redmine"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rafael George"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-07-04"
|
13
13
|
s.description = "Allows taskmapper to interact with Your System."
|
14
14
|
s.email = "rafael@hybridgroup.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
]
|
49
49
|
s.homepage = "http://github.com/hybridgroup/taskmapper-redmine"
|
50
50
|
s.require_paths = ["lib"]
|
51
|
-
s.rubygems_version = "1.8.
|
51
|
+
s.rubygems_version = "1.8.24"
|
52
52
|
s.summary = "taskmapper Provider for Redmine"
|
53
53
|
|
54
54
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,82 +1,104 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskmapper-redmine
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.5.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Rafael George
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: taskmapper
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
18
|
+
requirements:
|
20
19
|
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.8'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.8'
|
30
|
+
- !ruby/object:Gem::Dependency
|
27
31
|
name: rspec
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
|
-
requirements:
|
34
|
+
requirements:
|
31
35
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.8'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.8'
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
name: jeweler
|
39
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
40
49
|
none: false
|
41
|
-
requirements:
|
50
|
+
requirements:
|
42
51
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version:
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.6'
|
45
54
|
type: :development
|
46
55
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
- !ruby/object:Gem::Dependency
|
49
63
|
name: simplecov
|
50
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
51
65
|
none: false
|
52
|
-
requirements:
|
66
|
+
requirements:
|
53
67
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.5'
|
56
70
|
type: :development
|
57
71
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.5'
|
78
|
+
- !ruby/object:Gem::Dependency
|
60
79
|
name: rcov
|
61
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
62
81
|
none: false
|
63
|
-
requirements:
|
82
|
+
requirements:
|
64
83
|
- - ~>
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version:
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.0'
|
67
86
|
type: :development
|
68
87
|
prerelease: false
|
69
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.0'
|
70
94
|
description: Allows taskmapper to interact with Your System.
|
71
95
|
email: rafael@hybridgroup.com
|
72
96
|
executables: []
|
73
|
-
|
74
97
|
extensions: []
|
75
|
-
|
76
|
-
extra_rdoc_files:
|
98
|
+
extra_rdoc_files:
|
77
99
|
- LICENSE
|
78
100
|
- README.md
|
79
|
-
files:
|
101
|
+
files:
|
80
102
|
- .rbenv-gemsets
|
81
103
|
- .rvmrc
|
82
104
|
- .travis.yml
|
@@ -107,30 +129,29 @@ files:
|
|
107
129
|
- ticketmaster-redmine.gemspec
|
108
130
|
homepage: http://github.com/hybridgroup/taskmapper-redmine
|
109
131
|
licenses: []
|
110
|
-
|
111
132
|
post_install_message:
|
112
133
|
rdoc_options: []
|
113
|
-
|
114
|
-
require_paths:
|
134
|
+
require_paths:
|
115
135
|
- lib
|
116
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
137
|
none: false
|
118
|
-
requirements:
|
119
|
-
- -
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version:
|
122
|
-
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
hash: 1055099377
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
146
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version:
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
128
151
|
requirements: []
|
129
|
-
|
130
152
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.8.
|
153
|
+
rubygems_version: 1.8.24
|
132
154
|
signing_key:
|
133
155
|
specification_version: 3
|
134
156
|
summary: taskmapper Provider for Redmine
|
135
157
|
test_files: []
|
136
|
-
|