ticketmaster-pivotal 0.3.3 → 0.3.4
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 +8 -7
- data/lib/provider/pivotal.rb +16 -0
- data/lib/provider/project.rb +5 -0
- data/lib/provider/ticket.rb +0 -8
- data/spec/comments_spec.rb +66 -0
- data/spec/fixtures/notes.xml +15 -0
- data/spec/fixtures/notes/1946635.xml +7 -0
- data/spec/fixtures/projects.xml +35 -0
- data/spec/fixtures/projects/93790.xml +33 -0
- data/spec/fixtures/stories.xml +121 -0
- data/spec/fixtures/stories/4056827.xml +28 -0
- data/spec/projects_spec.rb +70 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/ticketmaster-pivotal_spec.rb +5 -2
- data/spec/tickets_spec.rb +71 -0
- data/ticketmaster-pivotal.gemspec +16 -4
- metadata +16 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/lib/provider/comment.rb
CHANGED
@@ -48,14 +48,15 @@ module TicketMaster::Provider
|
|
48
48
|
@system_data[:ticket] = @system_data[:client] = ticket if ticket
|
49
49
|
if note.is_a?(PivotalAPI::Note)
|
50
50
|
@system_data[:note] = note
|
51
|
-
self.project_id = note.prefix_options[:project_id]
|
52
|
-
self.project_id ||= ticket.prefix_options[:project_id] if ticket
|
53
|
-
self.ticket_id = note.prefix_options[:story_id]
|
54
|
-
self.ticket_id ||= ticket.id if ticket
|
55
|
-
self.id = note.id
|
56
|
-
self.prefix_options = note.prefix_options
|
51
|
+
# self.project_id = note.prefix_options[:project_id]
|
52
|
+
# self.project_id ||= ticket.prefix_options[:project_id] if ticket
|
53
|
+
# self.ticket_id = note.prefix_options[:story_id]
|
54
|
+
# self.ticket_id ||= ticket.id if ticket
|
55
|
+
# self.id = note.id
|
56
|
+
# self.prefix_options = note.prefix_options
|
57
57
|
end
|
58
|
-
|
58
|
+
#raise @system_data[:note].inspect
|
59
|
+
super(@system_data[:note].attributes)
|
59
60
|
end
|
60
61
|
|
61
62
|
def body
|
data/lib/provider/pivotal.rb
CHANGED
@@ -21,5 +21,21 @@ module TicketMaster::Provider
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def projects(*options)
|
25
|
+
if options[0].is_a?(Hash) and (options[0][:id].is_a?(Fixnum) or options[0]['id'].is_a?(Fixnum))
|
26
|
+
options[0][:id] = options[0][:id].to_s if options[0][:id]
|
27
|
+
options[o]['id'] = options[0]['id'].to_s if options[0]['id']
|
28
|
+
end
|
29
|
+
super(*options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def project(*options)
|
33
|
+
if options[0].is_a?(Hash) and (options[0][:id].is_a?(Fixnum) or options[0]['id'].is_a?(Fixnum))
|
34
|
+
options[0][:id] = options[0][:id].to_s if options[0][:id]
|
35
|
+
options[o]['id'] = options[0]['id'].to_s if options[0]['id']
|
36
|
+
end
|
37
|
+
super(*options)
|
38
|
+
end
|
39
|
+
|
24
40
|
end
|
25
41
|
end
|
data/lib/provider/project.rb
CHANGED
data/lib/provider/ticket.rb
CHANGED
@@ -43,14 +43,6 @@ module TicketMaster::Provider
|
|
43
43
|
self.name=title
|
44
44
|
end
|
45
45
|
|
46
|
-
def description
|
47
|
-
self.text
|
48
|
-
end
|
49
|
-
|
50
|
-
def description=(desc)
|
51
|
-
self.text=desc
|
52
|
-
end
|
53
|
-
|
54
46
|
# The closer
|
55
47
|
def close(resolution = 'resolved')
|
56
48
|
resolution = 'resolved' unless @@allowed_states.include?(resolution)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Pivotal::Comment" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'X-TrackerToken' => '000000'}
|
6
|
+
wheaders = headers.merge('Content-Type' => 'application/xml')
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/services/v3/projects/93790.xml', headers, fixture_for('projects/93790'), 200
|
9
|
+
mock.get '/services/v3/projects/93790/stories.xml', headers, fixture_for('stories'), 200
|
10
|
+
mock.get '/services/v3/projects/93790/stories/4056827.xml', headers, fixture_for('stories/4056827'), 200
|
11
|
+
mock.get '/services/v3/projects/93790/stories/4056827/notes.xml', headers, fixture_for('notes'), 200
|
12
|
+
mock.get '/services/v3/projects/93790/stories/4056827/notes/1946635.xml', headers, fixture_for('notes/1946635'), 200
|
13
|
+
mock.post '/services/v3/projects/93790/stories/4056827/notes.xml', wheaders, fixture_for('notes/1946635'), 200
|
14
|
+
mock.put '/services/v3/projects/93790/stories/4056827.xml', wheaders, '', 200
|
15
|
+
end
|
16
|
+
@project_id = 93790
|
17
|
+
@ticket_id = 4056827
|
18
|
+
@comment_id = 1946635
|
19
|
+
end
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
@ticketmaster = TicketMaster.new(:pivotal, :token => '000000')
|
23
|
+
@project = @ticketmaster.project(@project_id)
|
24
|
+
@ticket = @project.ticket(4056827)
|
25
|
+
@klass = TicketMaster::Provider::Pivotal::Comment
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be able to load all comments" do
|
29
|
+
@comments = @ticket.comments
|
30
|
+
@comments.should be_an_instance_of Array
|
31
|
+
@comments.first.should be_an_instance_of @klass
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to load all comments based on 'id's" do
|
35
|
+
@comments = @ticket.comments([@comment_id])
|
36
|
+
@comments.should be_an_instance_of Array
|
37
|
+
@comments.first.should be_an_instance_of @klass
|
38
|
+
@comments.first.id.should == @comment_id
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be able to load all comments based on attributes" do
|
42
|
+
@comments = @ticket.comments(:id => @comment_id)
|
43
|
+
@comments.should be_an_instance_of Array
|
44
|
+
@comments.first.should be_an_instance_of @klass
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to load a comment based on id" do
|
48
|
+
@comment = @ticket.comment(@comment_id)
|
49
|
+
@comment.should be_an_instance_of @klass
|
50
|
+
@comment.id.should == @comment_id
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to load a comment based on attributes" do
|
54
|
+
@comment = @ticket.comment(:id => @comment_id)
|
55
|
+
@comment.should be_an_instance_of @klass
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should return the class" do
|
59
|
+
@ticket.comment.should == @klass
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should be able to create a comment" do # which as mentioned before is technically a ticket update
|
63
|
+
@comment = @ticket.comment!(:body => 'hello there boys and girls')
|
64
|
+
@comment.should be_an_instance_of @klass
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<notes type="array">
|
3
|
+
<note>
|
4
|
+
<id type="integer">1946635</id>
|
5
|
+
<text>note</text>
|
6
|
+
<author>Hong Quach</author>
|
7
|
+
<noted_at type="datetime">2010/07/03 08:09:38 UTC</noted_at>
|
8
|
+
</note>
|
9
|
+
<note>
|
10
|
+
<id type="integer">1946719</id>
|
11
|
+
<text>etuhanoeth naou</text>
|
12
|
+
<author>Hong Quach</author>
|
13
|
+
<noted_at type="datetime">2010/07/03 09:57:03 UTC</noted_at>
|
14
|
+
</note>
|
15
|
+
</notes>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projects type="array">
|
3
|
+
<project>
|
4
|
+
<id>93790</id>
|
5
|
+
<name>TicketMaster</name>
|
6
|
+
<iteration_length type="integer">1</iteration_length>
|
7
|
+
<week_start_day>Monday</week_start_day>
|
8
|
+
<point_scale>0,1,2,3</point_scale>
|
9
|
+
<account>Hong Quach</account>
|
10
|
+
<velocity_scheme>Average of 3 iterations</velocity_scheme>
|
11
|
+
<current_velocity>10</current_velocity>
|
12
|
+
<initial_velocity>10</initial_velocity>
|
13
|
+
<number_of_done_iterations_to_show>12</number_of_done_iterations_to_show>
|
14
|
+
<labels></labels>
|
15
|
+
<last_activity_at type="datetime">2010/07/06 21:47:40 UTC</last_activity_at>
|
16
|
+
<allow_attachments>true</allow_attachments>
|
17
|
+
<public>false</public>
|
18
|
+
<use_https>false</use_https>
|
19
|
+
<bugs_and_chores_are_estimatable>false</bugs_and_chores_are_estimatable>
|
20
|
+
<commit_mode>false</commit_mode>
|
21
|
+
<memberships>
|
22
|
+
<membership>
|
23
|
+
<id>305546</id>
|
24
|
+
<person>
|
25
|
+
<email>hong.quach@abigfisch.com</email>
|
26
|
+
<name>Hong Quach</name>
|
27
|
+
<initials>HQ</initials>
|
28
|
+
</person>
|
29
|
+
<role>Owner</role>
|
30
|
+
</membership>
|
31
|
+
</memberships>
|
32
|
+
<integrations>
|
33
|
+
</integrations>
|
34
|
+
</project>
|
35
|
+
</projects>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<id>93790</id>
|
4
|
+
<name>TicketMaster</name>
|
5
|
+
<iteration_length type="integer">1</iteration_length>
|
6
|
+
<week_start_day>Monday</week_start_day>
|
7
|
+
<point_scale>0,1,2,3</point_scale>
|
8
|
+
<account>Hong Quach</account>
|
9
|
+
<velocity_scheme>Average of 3 iterations</velocity_scheme>
|
10
|
+
<current_velocity>10</current_velocity>
|
11
|
+
<initial_velocity>10</initial_velocity>
|
12
|
+
<number_of_done_iterations_to_show>12</number_of_done_iterations_to_show>
|
13
|
+
<labels></labels>
|
14
|
+
<last_activity_at type="datetime">2010/07/06 21:47:40 UTC</last_activity_at>
|
15
|
+
<allow_attachments>true</allow_attachments>
|
16
|
+
<public>false</public>
|
17
|
+
<use_https>false</use_https>
|
18
|
+
<bugs_and_chores_are_estimatable>false</bugs_and_chores_are_estimatable>
|
19
|
+
<commit_mode>false</commit_mode>
|
20
|
+
<memberships>
|
21
|
+
<membership>
|
22
|
+
<id>305546</id>
|
23
|
+
<person>
|
24
|
+
<email>hong.quach@abigfisch.com</email>
|
25
|
+
<name>Hong Quach</name>
|
26
|
+
<initials>HQ</initials>
|
27
|
+
</person>
|
28
|
+
<role>Owner</role>
|
29
|
+
</membership>
|
30
|
+
</memberships>
|
31
|
+
<integrations>
|
32
|
+
</integrations>
|
33
|
+
</project>
|
@@ -0,0 +1,121 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<stories type="array" count="17" total="17">
|
3
|
+
<story>
|
4
|
+
<id type="integer">4056827</id>
|
5
|
+
<project_id type="integer">93790</project_id>
|
6
|
+
<story_type>feature</story_type>
|
7
|
+
<url>http://www.pivotaltracker.com/story/show/4056827</url>
|
8
|
+
<estimate type="integer">-1</estimate>
|
9
|
+
<current_state>unstarted</current_state>
|
10
|
+
<description>Hi hi. Description!</description>
|
11
|
+
<name>Hello</name>
|
12
|
+
<requested_by>Hong Quach</requested_by>
|
13
|
+
<created_at type="datetime">2010/06/26 22:31:08 UTC</created_at>
|
14
|
+
<updated_at type="datetime">2010/06/26 22:56:02 UTC</updated_at>
|
15
|
+
<notes type="array">
|
16
|
+
<note>
|
17
|
+
<id type="integer">1946635</id>
|
18
|
+
<text>note</text>
|
19
|
+
<author>Hong Quach</author>
|
20
|
+
<noted_at type="datetime">2010/07/03 08:09:38 UTC</noted_at>
|
21
|
+
</note>
|
22
|
+
<note>
|
23
|
+
<id type="integer">1946719</id>
|
24
|
+
<text>etuhanoeth naou</text>
|
25
|
+
<author>Hong Quach</author>
|
26
|
+
<noted_at type="datetime">2010/07/03 09:57:03 UTC</noted_at>
|
27
|
+
</note>
|
28
|
+
</notes>
|
29
|
+
</story>
|
30
|
+
<story>
|
31
|
+
<id type="integer">4175660</id>
|
32
|
+
<project_id type="integer">93790</project_id>
|
33
|
+
<story_type>feature</story_type>
|
34
|
+
<url>http://www.pivotaltracker.com/story/show/4175660</url>
|
35
|
+
<estimate type="integer">-1</estimate>
|
36
|
+
<current_state>unscheduled</current_state>
|
37
|
+
<description></description>
|
38
|
+
<name>Some ticket</name>
|
39
|
+
<requested_by>Hong Quach</requested_by>
|
40
|
+
<created_at type="datetime">2010/07/06 21:47:38 UTC</created_at>
|
41
|
+
<updated_at type="datetime">2010/07/06 21:47:38 UTC</updated_at>
|
42
|
+
<notes type="array">
|
43
|
+
<note>
|
44
|
+
<id type="integer">1959905</id>
|
45
|
+
<text>Yeah yeah</text>
|
46
|
+
<author>Hong Quach</author>
|
47
|
+
<noted_at type="datetime">2010/07/06 21:47:39 UTC</noted_at>
|
48
|
+
</note>
|
49
|
+
<note>
|
50
|
+
<id type="integer">1959906</id>
|
51
|
+
<text>ntua aeotnh aouetn
|
52
|
+
|
53
|
+
Hmm...</text>
|
54
|
+
<author>Hong Quach</author>
|
55
|
+
<noted_at type="datetime">2010/07/06 21:47:40 UTC</noted_at>
|
56
|
+
</note>
|
57
|
+
</notes>
|
58
|
+
</story>
|
59
|
+
<story>
|
60
|
+
<id type="integer">4175659</id>
|
61
|
+
<project_id type="integer">93790</project_id>
|
62
|
+
<story_type>feature</story_type>
|
63
|
+
<url>http://www.pivotaltracker.com/story/show/4175659</url>
|
64
|
+
<estimate type="integer">-1</estimate>
|
65
|
+
<current_state>unscheduled</current_state>
|
66
|
+
<description></description>
|
67
|
+
<name>Cheese cakes</name>
|
68
|
+
<requested_by>Hong Quach</requested_by>
|
69
|
+
<created_at type="datetime">2010/07/06 21:47:22 UTC</created_at>
|
70
|
+
<updated_at type="datetime">2010/07/06 21:47:22 UTC</updated_at>
|
71
|
+
<notes type="array">
|
72
|
+
<note>
|
73
|
+
<id type="integer">1959894</id>
|
74
|
+
<text>nt.,hntHOETUHAONTUHANOSTEUHANTOU</text>
|
75
|
+
<author>Hong Quach</author>
|
76
|
+
<noted_at type="datetime">2010/07/06 21:47:23 UTC</noted_at>
|
77
|
+
</note>
|
78
|
+
<note>
|
79
|
+
<id type="integer">1959895</id>
|
80
|
+
<text>Rokatoo</text>
|
81
|
+
<author>Hong Quach</author>
|
82
|
+
<noted_at type="datetime">2010/07/06 21:47:25 UTC</noted_at>
|
83
|
+
</note>
|
84
|
+
<note>
|
85
|
+
<id type="integer">1959897</id>
|
86
|
+
<text>This is a ticket set from tm console</text>
|
87
|
+
<author>Hong Quach</author>
|
88
|
+
<noted_at type="datetime">2010/07/06 21:47:27 UTC</noted_at>
|
89
|
+
</note>
|
90
|
+
<note>
|
91
|
+
<id type="integer">1959898</id>
|
92
|
+
<text>What the hey?</text>
|
93
|
+
<author>Hong Quach</author>
|
94
|
+
<noted_at type="datetime">2010/07/06 21:47:28 UTC</noted_at>
|
95
|
+
</note>
|
96
|
+
<note>
|
97
|
+
<id type="integer">1959899</id>
|
98
|
+
<text>What the hey?</text>
|
99
|
+
<author>Hong Quach</author>
|
100
|
+
<noted_at type="datetime">2010/07/06 21:47:29 UTC</noted_at>
|
101
|
+
</note>
|
102
|
+
<note>
|
103
|
+
<id type="integer">1959901</id>
|
104
|
+
<text>taoh natht aehu sa utaohe nsahu saeho nsahoeunsau '</text>
|
105
|
+
<author>Hong Quach</author>
|
106
|
+
<noted_at type="datetime">2010/07/06 21:47:33 UTC</noted_at>
|
107
|
+
</note>
|
108
|
+
<note>
|
109
|
+
<id type="integer">1959903</id>
|
110
|
+
<text>tt</text>
|
111
|
+
<author>Hong Quach</author>
|
112
|
+
<noted_at type="datetime">2010/07/06 21:47:35 UTC</noted_at>
|
113
|
+
</note>
|
114
|
+
<note>
|
115
|
+
<id type="integer">1959904</id>
|
116
|
+
<text>nhdhdntdtdtdt</text>
|
117
|
+
<author>Hong Quach</author>
|
118
|
+
<noted_at type="datetime">2010/07/06 21:47:37 UTC</noted_at>
|
119
|
+
</note>
|
120
|
+
</notes>
|
121
|
+
</story></stories>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<story>
|
3
|
+
<id type="integer">4056827</id>
|
4
|
+
<project_id type="integer">93790</project_id>
|
5
|
+
<story_type>feature</story_type>
|
6
|
+
<url>http://www.pivotaltracker.com/story/show/4056827</url>
|
7
|
+
<estimate type="integer">-1</estimate>
|
8
|
+
<current_state>unstarted</current_state>
|
9
|
+
<description>Hi hi. Description!</description>
|
10
|
+
<name>Hello</name>
|
11
|
+
<requested_by>Hong Quach</requested_by>
|
12
|
+
<created_at type="datetime">2010/06/26 22:31:08 UTC</created_at>
|
13
|
+
<updated_at type="datetime">2010/06/26 22:56:02 UTC</updated_at>
|
14
|
+
<notes type="array">
|
15
|
+
<note>
|
16
|
+
<id type="integer">1946635</id>
|
17
|
+
<text>note</text>
|
18
|
+
<author>Hong Quach</author>
|
19
|
+
<noted_at type="datetime">2010/07/03 08:09:38 UTC</noted_at>
|
20
|
+
</note>
|
21
|
+
<note>
|
22
|
+
<id type="integer">1946719</id>
|
23
|
+
<text>etuhanoeth naou</text>
|
24
|
+
<author>Hong Quach</author>
|
25
|
+
<noted_at type="datetime">2010/07/03 09:57:03 UTC</noted_at>
|
26
|
+
</note>
|
27
|
+
</notes>
|
28
|
+
</story>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Pivotal::Project" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'X-TrackerToken' => '000000'}
|
6
|
+
wheaders = headers.merge('Content-Type' => 'application/xml')
|
7
|
+
@project_id = 93790
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/services/v3/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/services/v3/projects/93790.xml', headers, fixture_for('projects/93790'), 200
|
11
|
+
mock.get '/projects/create.xml', headers, fixture_for('projects/93790'), 200
|
12
|
+
mock.put '/services/v3/projects/93790.xml', wheaders, '', 200
|
13
|
+
mock.post '/services/v3/projects.xml', wheaders, '', 201, 'Location' => '/projects/create.xml'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
@ticketmaster = TicketMaster.new(:pivotal, :token => '000000')
|
19
|
+
@klass = TicketMaster::Provider::Pivotal::Project
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be able to load all projects" do
|
23
|
+
@ticketmaster.projects.should be_an_instance_of Array
|
24
|
+
@ticketmaster.projects.first.should be_an_instance_of @klass
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be able to load projects from an array of ids" do
|
28
|
+
@projects = @ticketmaster.projects([@project_id])
|
29
|
+
@projects.should be_an_instance_of Array
|
30
|
+
@projects.first.should be_an_instance_of @klass
|
31
|
+
@projects.first.id.should == @project_id
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to load all projects from attributes" do
|
35
|
+
@projects = @ticketmaster.projects(:id => @project_id)
|
36
|
+
@projects.should be_an_instance_of Array
|
37
|
+
@projects.first.should be_an_instance_of @klass
|
38
|
+
@projects.first.id.should == @project_id
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be able to find a project" do
|
42
|
+
@ticketmaster.project.should == @klass
|
43
|
+
@ticketmaster.project.find(@project_id).should be_an_instance_of @klass
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to find a project by id" do
|
47
|
+
@ticketmaster.project(@project_id).should be_an_instance_of @klass
|
48
|
+
@ticketmaster.project(@project_id).id.should == @project_id
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should be able to find a project by attributes" do
|
52
|
+
@ticketmaster.project(:id => @project_id).id.should == @project_id
|
53
|
+
@ticketmaster.project(:id => @project_id).should be_an_instance_of @klass
|
54
|
+
end
|
55
|
+
|
56
|
+
# always returns true, pivotal doesn't allow updating project attributes
|
57
|
+
# (at least not the ones ticketmaster cares about at the moment)
|
58
|
+
it "should be able to update and save a project" do
|
59
|
+
@project = @ticketmaster.project(@project_id)
|
60
|
+
@project.update!(:name => 'some new name').should == true
|
61
|
+
@project.name = 'this is a change'
|
62
|
+
@project.save.should == true
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be able to create a project" do
|
66
|
+
@project = @ticketmaster.project.create(:name => 'Project #1')
|
67
|
+
@project.should be_an_instance_of @klass
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ticketmaster'
|
3
5
|
require 'ticketmaster-pivotal'
|
6
|
+
require 'active_resource/http_mock'
|
4
7
|
require 'spec'
|
5
8
|
require 'spec/autorun'
|
6
9
|
|
7
10
|
Spec::Runner.configure do |config|
|
8
11
|
|
9
12
|
end
|
13
|
+
|
14
|
+
def fixture_for(name)
|
15
|
+
File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.xml')
|
16
|
+
end
|
@@ -1,7 +1,10 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "TicketmasterPivotal" do
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
it "should be able to instantiate a new instance" do
|
6
|
+
@ticketmaster = TicketMaster.new(:pivotal, {:token => '000000'})
|
7
|
+
@ticketmaster.should be_an_instance_of TicketMaster
|
8
|
+
@ticketmaster.should be_a_kind_of TicketMaster::Provider::Pivotal
|
6
9
|
end
|
7
10
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Pivotal::Ticket" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'X-TrackerToken' => '000000'}
|
6
|
+
wheaders = headers.merge('Content-Type' => 'application/xml')
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/services/v3/projects/93790.xml', headers, fixture_for('projects/93790'), 200
|
9
|
+
mock.get '/services/v3/projects/93790/stories.xml', headers, fixture_for('stories'), 200
|
10
|
+
mock.get '/services/v3/projects/93790/stories/4056827.xml', headers, fixture_for('stories/4056827'), 200
|
11
|
+
mock.put '/services/v3/projects/93790/stories/4056827.xml', wheaders, '', 200
|
12
|
+
mock.post '/services/v3/projects/93790/stories.xml', wheaders, fixture_for('stories/4056827'), 200
|
13
|
+
end
|
14
|
+
@project_id = 93790
|
15
|
+
@ticket_id = 4056827
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@ticketmaster = TicketMaster.new(:pivotal, :token => '000000')
|
20
|
+
@project = @ticketmaster.project(@project_id)
|
21
|
+
@klass = TicketMaster::Provider::Pivotal::Ticket
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to load all tickets" do
|
25
|
+
@project.tickets.should be_an_instance_of Array
|
26
|
+
@project.tickets.first.should be_an_instance_of @klass
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to load all tickets based on an array of ids" do
|
30
|
+
@tickets = @project.tickets([@ticket_id])
|
31
|
+
@tickets.should be_an_instance_of Array
|
32
|
+
@tickets.first.should be_an_instance_of @klass
|
33
|
+
@tickets.first.id.should == @ticket_id
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to load all tickets based on attributes" do
|
37
|
+
@tickets = @project.tickets(:id => @ticket_id)
|
38
|
+
@tickets.should be_an_instance_of Array
|
39
|
+
@tickets.first.should be_an_instance_of @klass
|
40
|
+
@tickets.first.id.should == @ticket_id
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should return the ticket class" do
|
44
|
+
@project.ticket.should == @klass
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to load a single ticket" do
|
48
|
+
@ticket = @project.ticket(@ticket_id)
|
49
|
+
@ticket.should be_an_instance_of @klass
|
50
|
+
@ticket.id.should == @ticket_id
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to load a single ticket based on attributes" do
|
54
|
+
@ticket = @project.ticket(:id => @ticket_id)
|
55
|
+
@ticket.should be_an_instance_of @klass
|
56
|
+
@ticket.id.should == @ticket_id
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should be able to update and save a ticket" do
|
60
|
+
@ticket = @project.ticket(4056827)
|
61
|
+
#@ticket.save.should == nil
|
62
|
+
@ticket.description = 'hello'
|
63
|
+
@ticket.save.should == true
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should be able to create a ticket" do
|
67
|
+
@ticket = @project.ticket!(:title => 'Ticket #12', :description => 'Body')
|
68
|
+
@ticket.should be_an_instance_of @klass
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ticketmaster-pivotal}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["HybridGroup"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-07}
|
13
13
|
s.description = %q{This is a ticketmaster provider for interacting with Pivotal Tracker .}
|
14
14
|
s.email = %q{hong.quach@abigfisch.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,9 +29,18 @@ Gem::Specification.new do |s|
|
|
29
29
|
"lib/provider/project.rb",
|
30
30
|
"lib/provider/ticket.rb",
|
31
31
|
"lib/ticketmaster-pivotal.rb",
|
32
|
+
"spec/comments_spec.rb",
|
33
|
+
"spec/fixtures/notes.xml",
|
34
|
+
"spec/fixtures/notes/1946635.xml",
|
35
|
+
"spec/fixtures/projects.xml",
|
36
|
+
"spec/fixtures/projects/93790.xml",
|
37
|
+
"spec/fixtures/stories.xml",
|
38
|
+
"spec/fixtures/stories/4056827.xml",
|
39
|
+
"spec/projects_spec.rb",
|
32
40
|
"spec/spec.opts",
|
33
41
|
"spec/spec_helper.rb",
|
34
42
|
"spec/ticketmaster-pivotal_spec.rb",
|
43
|
+
"spec/tickets_spec.rb",
|
35
44
|
"ticketmaster-pivotal.gemspec"
|
36
45
|
]
|
37
46
|
s.homepage = %q{http://ticket.rb}
|
@@ -40,8 +49,11 @@ Gem::Specification.new do |s|
|
|
40
49
|
s.rubygems_version = %q{1.3.7}
|
41
50
|
s.summary = %q{This is a ticketmaster provider for interacting with Pivotal Tracker}
|
42
51
|
s.test_files = [
|
43
|
-
"spec/
|
44
|
-
"spec/
|
52
|
+
"spec/comments_spec.rb",
|
53
|
+
"spec/projects_spec.rb",
|
54
|
+
"spec/spec_helper.rb",
|
55
|
+
"spec/ticketmaster-pivotal_spec.rb",
|
56
|
+
"spec/tickets_spec.rb"
|
45
57
|
]
|
46
58
|
|
47
59
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster-pivotal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- HybridGroup
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -88,9 +88,18 @@ files:
|
|
88
88
|
- lib/provider/project.rb
|
89
89
|
- lib/provider/ticket.rb
|
90
90
|
- lib/ticketmaster-pivotal.rb
|
91
|
+
- spec/comments_spec.rb
|
92
|
+
- spec/fixtures/notes.xml
|
93
|
+
- spec/fixtures/notes/1946635.xml
|
94
|
+
- spec/fixtures/projects.xml
|
95
|
+
- spec/fixtures/projects/93790.xml
|
96
|
+
- spec/fixtures/stories.xml
|
97
|
+
- spec/fixtures/stories/4056827.xml
|
98
|
+
- spec/projects_spec.rb
|
91
99
|
- spec/spec.opts
|
92
100
|
- spec/spec_helper.rb
|
93
101
|
- spec/ticketmaster-pivotal_spec.rb
|
102
|
+
- spec/tickets_spec.rb
|
94
103
|
- ticketmaster-pivotal.gemspec
|
95
104
|
has_rdoc: true
|
96
105
|
homepage: http://ticket.rb
|
@@ -127,5 +136,8 @@ signing_key:
|
|
127
136
|
specification_version: 3
|
128
137
|
summary: This is a ticketmaster provider for interacting with Pivotal Tracker
|
129
138
|
test_files:
|
139
|
+
- spec/comments_spec.rb
|
140
|
+
- spec/projects_spec.rb
|
130
141
|
- spec/spec_helper.rb
|
131
142
|
- spec/ticketmaster-pivotal_spec.rb
|
143
|
+
- spec/tickets_spec.rb
|