ticketmaster-mingle 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +20 -0
- data/README.md +74 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/lib/mingle/mingle-api.rb +228 -0
- data/lib/provider/comment.rb +47 -0
- data/lib/provider/mingle.rb +29 -0
- data/lib/provider/project.rb +53 -0
- data/lib/provider/ticket.rb +102 -0
- data/lib/ticketmaster-mingle.rb +5 -0
- data/spec/comments_spec.rb +40 -0
- data/spec/fixtures/cards/42.xml +41 -0
- data/spec/fixtures/cards/43.xml +42 -0
- data/spec/fixtures/cards/create.xml +42 -0
- data/spec/fixtures/cards.xml +83 -0
- data/spec/fixtures/comments/create.xml +10 -0
- data/spec/fixtures/comments.xml +20 -0
- data/spec/fixtures/projects/another_project_.xml +29 -0
- data/spec/fixtures/projects/create.xml +29 -0
- data/spec/fixtures/projects/test_project.xml +29 -0
- data/spec/fixtures/projects.xml +57 -0
- data/spec/projects_spec.rb +55 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/ticketmaster-mingle_spec.rb +11 -0
- data/spec/tickets_spec.rb +71 -0
- data/ticketmaster-mingle.gemspec +93 -0
- metadata +210 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Mingle::Comment" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'Authorization' => 'Basic MDAwMDAwOg==', 'Accept' => 'application/xml'}
|
6
|
+
headers_post = {'Authorization' => 'Basic MDAwMDAwOg==', 'Content-Type' => 'application/xml'}
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/api/v2/projects/test_project.xml', headers, fixture_for('projects/test_project'), 200
|
9
|
+
mock.get '/api/v2/projects/test_project/cards.xml', headers, fixture_for('cards'), 200
|
10
|
+
mock.get '/api/v2/projects/test_project/cards/42.xml', headers, fixture_for('cards/42'), 200
|
11
|
+
mock.get '/api/v2/projects/test_project/cards/42/comments.xml', headers, fixture_for('comments'), 200
|
12
|
+
mock.post '/api/v2/projects/test_project/cards/42/comments.xml?comment[content]=New%20comment%20created.', headers_post, fixture_for('comments/create'), 200
|
13
|
+
end
|
14
|
+
@identifier = 'test_project'
|
15
|
+
@number = 42
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@ticketmaster = TicketMaster.new(:mingle, {:name => 'anymoto', :login => '000000', :server => 'localhost:8080'})
|
20
|
+
@project = @ticketmaster.project(@identifier)
|
21
|
+
@ticket = @project.ticket(@number)
|
22
|
+
@ticket.identifier = @project.identifier
|
23
|
+
@klass = TicketMaster::Provider::Mingle::Comment
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to load all comments" do
|
27
|
+
@comments = @ticket.comments
|
28
|
+
@comments.should be_an_instance_of(Array)
|
29
|
+
@comments.first.should be_an_instance_of(@klass)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the class" do
|
33
|
+
@ticket.comment.should == @klass
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to create a comment" do
|
37
|
+
@comment = @ticket.comment!(:content => 'New comment created.')
|
38
|
+
@comment.should be_an_instance_of(@klass)
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<card>
|
3
|
+
<name>As an API user, I would like to lookup a card in Mingle, given that I know the card number.</name>
|
4
|
+
<description>
|
5
|
+
</description>
|
6
|
+
<card_type>
|
7
|
+
<name>Story</name>
|
8
|
+
</card_type>
|
9
|
+
<number type="integer">42</number>
|
10
|
+
<project url="http://myserver.com/api/v2/projects/test_project.xml">
|
11
|
+
<name>test project</name>
|
12
|
+
<identifier>test_project</identifier>
|
13
|
+
</project>
|
14
|
+
<version type="integer">1</version>
|
15
|
+
<project_card_rank type="integer">1</project_card_rank>
|
16
|
+
<created_on type="datetime">2009-10-14T09:14:54Z</created_on>
|
17
|
+
<modified_on type="datetime">2009-10-14T09:14:54Z</modified_on>
|
18
|
+
<modified_by url="http://myserver.com/api/v2/users/1.xml">
|
19
|
+
<name>anne</name>
|
20
|
+
<login>anne</login>
|
21
|
+
</modified_by>
|
22
|
+
<created_by url="http://myserver.com/api/v2/users/2.xml">
|
23
|
+
<name>jane</name>
|
24
|
+
<login>jane</login>
|
25
|
+
</created_by>
|
26
|
+
<properties type="array">
|
27
|
+
<property type_description="Managed text list" hidden="false">
|
28
|
+
<name>Status</name>
|
29
|
+
<value>Closed</value>
|
30
|
+
</property>
|
31
|
+
<property type_description="Managed number list" hidden="false">
|
32
|
+
<name>Estimate</name>
|
33
|
+
<value>4</value>
|
34
|
+
</property>
|
35
|
+
<property type_description="Managed text list" hidden="false">
|
36
|
+
<name>Priority</name>
|
37
|
+
<value nil="true"/>
|
38
|
+
</property>
|
39
|
+
</properties>
|
40
|
+
</card>
|
41
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<card>
|
3
|
+
<name>Automatically update event status when event date has passed</name>
|
4
|
+
<description>
|
5
|
+
</description>
|
6
|
+
<card_type>
|
7
|
+
<name>Story</name>
|
8
|
+
</card_type>
|
9
|
+
<id type="integer">410</id>
|
10
|
+
<number type="integer">43</number>
|
11
|
+
<project url="http://localhost:8080/api/v2/projects/test_project.xml">
|
12
|
+
<name>test project</name>
|
13
|
+
<identifier>test_project</identifier>
|
14
|
+
</project>
|
15
|
+
<version type="integer">1</version>
|
16
|
+
<project_card_rank type="integer">1</project_card_rank>
|
17
|
+
<created_on type="datetime">2009-10-14T09:14:54Z</created_on>
|
18
|
+
<modified_on type="datetime">2009-10-14T09:14:54Z</modified_on>
|
19
|
+
<modified_by url="http://localhost:8080/api/v2/users/1.xml">
|
20
|
+
<name>anne</name>
|
21
|
+
<login>anne</login>
|
22
|
+
</modified_by>
|
23
|
+
<created_by url="http://localhost:8080/api/v2/users/2.xml">
|
24
|
+
<name>jane</name>
|
25
|
+
<login>jane</login>
|
26
|
+
</created_by>
|
27
|
+
<properties type="array">
|
28
|
+
<property type_description="Managed text list" hidden="false">
|
29
|
+
<name>Status</name>
|
30
|
+
<value>Closed</value>
|
31
|
+
</property>
|
32
|
+
<property type_description="Managed number list" hidden="false">
|
33
|
+
<name>Estimate</name>
|
34
|
+
<value>4</value>
|
35
|
+
</property>
|
36
|
+
<property type_description="Managed text list" hidden="false">
|
37
|
+
<name>Priority</name>
|
38
|
+
<value nil="true"/>
|
39
|
+
</property>
|
40
|
+
</properties>
|
41
|
+
</card>
|
42
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<card>
|
3
|
+
<name>Show event details in event list</name>
|
4
|
+
<description>
|
5
|
+
</description>
|
6
|
+
<card_type>
|
7
|
+
<name>Story</name>
|
8
|
+
</card_type>
|
9
|
+
<id type="integer">411</id>
|
10
|
+
<number type="integer">44</number>
|
11
|
+
<project url="http://localhost:8080/api/v2/projects/test_project.xml">
|
12
|
+
<name>test project</name>
|
13
|
+
<identifier>test_project</identifier>
|
14
|
+
</project>
|
15
|
+
<version type="integer">1</version>
|
16
|
+
<project_card_rank type="integer">1</project_card_rank>
|
17
|
+
<created_on type="datetime">2009-10-14T09:14:54Z</created_on>
|
18
|
+
<modified_on type="datetime">2009-10-14T09:14:54Z</modified_on>
|
19
|
+
<modified_by url="http://localhost:8080/api/v2/users/1.xml">
|
20
|
+
<name>anne</name>
|
21
|
+
<login>anne</login>
|
22
|
+
</modified_by>
|
23
|
+
<created_by url="http://localhost:8080/api/v2/users/2.xml">
|
24
|
+
<name>jane</name>
|
25
|
+
<login>jane</login>
|
26
|
+
</created_by>
|
27
|
+
<properties type="array">
|
28
|
+
<property type_description="Managed text list" hidden="false">
|
29
|
+
<name>Status</name>
|
30
|
+
<value>Closed</value>
|
31
|
+
</property>
|
32
|
+
<property type_description="Managed number list" hidden="false">
|
33
|
+
<name>Estimate</name>
|
34
|
+
<value>4</value>
|
35
|
+
</property>
|
36
|
+
<property type_description="Managed text list" hidden="false">
|
37
|
+
<name>Priority</name>
|
38
|
+
<value nil="true"/>
|
39
|
+
</property>
|
40
|
+
</properties>
|
41
|
+
</card>
|
42
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<cards type="array">
|
3
|
+
<card>
|
4
|
+
<name>Ticket 1</name>
|
5
|
+
<description>
|
6
|
+
</description>
|
7
|
+
<card_type>
|
8
|
+
<name>Story</name>
|
9
|
+
</card_type>
|
10
|
+
<id type="integer">409</id>
|
11
|
+
<number type="integer">42</number>
|
12
|
+
<project url="http://myserver.com/api/v2/projects/test_project.xml">
|
13
|
+
<name>test project</name>
|
14
|
+
<identifier>test_project</identifier>
|
15
|
+
</project>
|
16
|
+
<version type="integer">1</version>
|
17
|
+
<project_card_rank type="integer">1</project_card_rank>
|
18
|
+
<created_on type="datetime">2009-10-14T09:14:54Z</created_on>
|
19
|
+
<modified_on type="datetime">2009-10-14T09:14:54Z</modified_on>
|
20
|
+
<modified_by url="http://myserver.com/api/v2/users/1.xml">
|
21
|
+
<name>anne</name>
|
22
|
+
<login>anne</login>
|
23
|
+
</modified_by>
|
24
|
+
<created_by url="http://myserver.com/api/v2/users/2.xml">
|
25
|
+
<name>jane</name>
|
26
|
+
<login>jane</login>
|
27
|
+
</created_by>
|
28
|
+
<properties type="array">
|
29
|
+
<property type_description="Managed text list" hidden="false">
|
30
|
+
<name>Status</name>
|
31
|
+
<value>Closed</value>
|
32
|
+
</property>
|
33
|
+
<property type_description="Managed number list" hidden="false">
|
34
|
+
<name>Estimate</name>
|
35
|
+
<value>4</value>
|
36
|
+
</property>
|
37
|
+
<property type_description="Managed text list" hidden="false">
|
38
|
+
<name>Priority</name>
|
39
|
+
<value nil="true"/>
|
40
|
+
</property>
|
41
|
+
</properties>
|
42
|
+
</card>
|
43
|
+
<card>
|
44
|
+
<name>Automatically update event status when event date has passed</name>
|
45
|
+
<description>
|
46
|
+
</description>
|
47
|
+
<card_type>
|
48
|
+
<name>Story</name>
|
49
|
+
</card_type>
|
50
|
+
<id type="integer">410</id>
|
51
|
+
<number type="integer">43</number>
|
52
|
+
<project url="http://myserver.com/api/v2/projects/test_project.xml">
|
53
|
+
<name>test project</name>
|
54
|
+
<identifier>test_project</identifier>
|
55
|
+
</project>
|
56
|
+
<version type="integer">1</version>
|
57
|
+
<project_card_rank type="integer">1</project_card_rank>
|
58
|
+
<created_on type="datetime">2009-10-14T09:14:54Z</created_on>
|
59
|
+
<modified_on type="datetime">2009-10-14T09:14:54Z</modified_on>
|
60
|
+
<modified_by url="http://myserver.com/api/v2/users/1.xml">
|
61
|
+
<name>anne</name>
|
62
|
+
<login>anne</login>
|
63
|
+
</modified_by>
|
64
|
+
<created_by url="http://myserver.com/api/v2/users/2.xml">
|
65
|
+
<name>jane</name>
|
66
|
+
<login>jane</login>
|
67
|
+
</created_by>
|
68
|
+
<properties type="array">
|
69
|
+
<property type_description="Managed text list" hidden="false">
|
70
|
+
<name>Status</name>
|
71
|
+
<value>Closed</value>
|
72
|
+
</property>
|
73
|
+
<property type_description="Managed number list" hidden="false">
|
74
|
+
<name>Estimate</name>
|
75
|
+
<value>4</value>
|
76
|
+
</property>
|
77
|
+
<property type_description="Managed text list" hidden="false">
|
78
|
+
<name>Priority</name>
|
79
|
+
<value nil="true"/>
|
80
|
+
</property>
|
81
|
+
</properties>
|
82
|
+
</card>
|
83
|
+
</cards>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<comment>
|
3
|
+
<content>a new comment</content>
|
4
|
+
<created_by url="http://localhost:8080/api/v2/users/1.xml">
|
5
|
+
<name>bonna</name>
|
6
|
+
<login>bonna</login>
|
7
|
+
</created_by>
|
8
|
+
<created_at type="datetime">2010-04-11T20:18:02Z</created_at>
|
9
|
+
</comment>
|
10
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<card_comments type="array">
|
3
|
+
<comment>
|
4
|
+
<content>Hi</content>
|
5
|
+
<created_by url="http://localhost:8080/api/v2/users/21.xml">
|
6
|
+
<name>Jeff</name>
|
7
|
+
<login>j</login>
|
8
|
+
</created_by>
|
9
|
+
<created_at type="datetime">2010-03-10T21:16:39Z</created_at>
|
10
|
+
</comment>
|
11
|
+
<comment>
|
12
|
+
<content>hello there</content>
|
13
|
+
<created_by url="http://localhost:8080/api/v2/users/1.xml">
|
14
|
+
<name>bonna</name>
|
15
|
+
<login>bonna</login>
|
16
|
+
</created_by>
|
17
|
+
<created_at type="datetime">2010-03-10T21:16:02Z</created_at>
|
18
|
+
</comment>
|
19
|
+
</card_comments>
|
20
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<name>Another Project</name>
|
4
|
+
<identifier>another_project</identifier>
|
5
|
+
<description>Another Project description</description>
|
6
|
+
<created_at type="datetime">2010-11-20T10:37:52Z></created_at>
|
7
|
+
<updated_at type="datetime">2010-11-21T00:47:55Z></updated_at>
|
8
|
+
<created_by url="http://localhost:8080/api/v2/users/8.xml">
|
9
|
+
<name>anne</name>
|
10
|
+
<login>anne</login>
|
11
|
+
</created_by>
|
12
|
+
<modified_by url="http://localhost:8080/api/v2/users/2.xml">
|
13
|
+
<name>bonna</name>
|
14
|
+
<login>bonna</login>
|
15
|
+
</modified_by>
|
16
|
+
<keywords>
|
17
|
+
<keyword>card</keyword>
|
18
|
+
<keyword>#</keyword>
|
19
|
+
</keywords>
|
20
|
+
<template type="boolean">false</template>
|
21
|
+
<email_address></email_address>
|
22
|
+
<email_sender_name></email_sender_name>
|
23
|
+
<date_format>%d %b %Y</date_format>
|
24
|
+
<time_zone>Beijing</time_zone>
|
25
|
+
<precision type="integer">2</precision>
|
26
|
+
<anonymous_accessible type="boolean">false</anonymous_accessible>
|
27
|
+
<auto_enroll_user_type nil="true"></auto_enroll_user_type>
|
28
|
+
</project>
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<name>Dumb Project</name>
|
4
|
+
<identifier>dumb</identifier>
|
5
|
+
<description>Dumb project description</description>
|
6
|
+
<created_at type="datetime">2009-10-20T10:37:52Z></created_at>
|
7
|
+
<updated_at type="datetime">2009-10-21T00:47:55Z></updated_at>
|
8
|
+
<created_by url="http://myserver.com/api/v2/users/8.xml">
|
9
|
+
<name>anne</name>
|
10
|
+
<login>anne</login>
|
11
|
+
</created_by>
|
12
|
+
<modified_by url="http://myserver.com/api/v2/users/2.xml">
|
13
|
+
<name>bonna</name>
|
14
|
+
<login>bonna</login>
|
15
|
+
</modified_by>
|
16
|
+
<keywords>
|
17
|
+
<keyword>card</keyword>
|
18
|
+
<keyword>#</keyword>
|
19
|
+
</keywords>
|
20
|
+
<template type="boolean">false</template>
|
21
|
+
<email_address></email_address>
|
22
|
+
<email_sender_name></email_sender_name>
|
23
|
+
<date_format>%d %b %Y</date_format>
|
24
|
+
<time_zone>Beijing</time_zone>
|
25
|
+
<precision type="integer">2</precision>
|
26
|
+
<anonymous_accessible type="boolean">false</anonymous_accessible>
|
27
|
+
<auto_enroll_user_type nil="true"></auto_enroll_user_type>
|
28
|
+
</project>
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<name>Test Project</name>
|
4
|
+
<identifier>test_project</identifier>
|
5
|
+
<description>Test Project description</description>
|
6
|
+
<created_at type="datetime">2009-10-20T10:37:52Z></created_at>
|
7
|
+
<updated_at type="datetime">2009-10-21T00:47:55Z></updated_at>
|
8
|
+
<created_by url="http://localhost:8080/api/v2/users/8.xml">
|
9
|
+
<name>anne</name>
|
10
|
+
<login>anne</login>
|
11
|
+
</created_by>
|
12
|
+
<modified_by url="http://localhost:8080/api/v2/users/2.xml">
|
13
|
+
<name>bonna</name>
|
14
|
+
<login>bonna</login>
|
15
|
+
</modified_by>
|
16
|
+
<keywords>
|
17
|
+
<keyword>card</keyword>
|
18
|
+
<keyword>#</keyword>
|
19
|
+
</keywords>
|
20
|
+
<template type="boolean">false</template>
|
21
|
+
<email_address></email_address>
|
22
|
+
<email_sender_name></email_sender_name>
|
23
|
+
<date_format>%d %b %Y</date_format>
|
24
|
+
<time_zone>Beijing</time_zone>
|
25
|
+
<precision type="integer">2</precision>
|
26
|
+
<anonymous_accessible type="boolean">false</anonymous_accessible>
|
27
|
+
<auto_enroll_user_type nil="true"></auto_enroll_user_type>
|
28
|
+
</project>
|
29
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projects type="array">
|
3
|
+
<project>
|
4
|
+
<name>Test Project</name>
|
5
|
+
<identifier>test_project</identifier>
|
6
|
+
<description>Test Project description</description>
|
7
|
+
<created_at type="datetime">2009-10-20T10:37:52Z></created_at>
|
8
|
+
<updated_at type="datetime">2009-10-21T00:47:55Z></updated_at>
|
9
|
+
<created_by url="http://localhost:8080/api/v2/users/8.xml">
|
10
|
+
<name>anne</name>
|
11
|
+
<login>anne</login>
|
12
|
+
</created_by>
|
13
|
+
<modified_by url="http://localhost:8080/api/v2/users/2.xml">
|
14
|
+
<name>bonna</name>
|
15
|
+
<login>bonna</login>
|
16
|
+
</modified_by>
|
17
|
+
<keywords>
|
18
|
+
<keyword>card</keyword>
|
19
|
+
<keyword>#</keyword>
|
20
|
+
</keywords>
|
21
|
+
<template type="boolean">false</template>
|
22
|
+
<email_address></email_address>
|
23
|
+
<email_sender_name></email_sender_name>
|
24
|
+
<date_format>%d %b %Y</date_format>
|
25
|
+
<time_zone>Beijing</time_zone>
|
26
|
+
<precision type="integer">2</precision>
|
27
|
+
<anonymous_accessible type="boolean">false</anonymous_accessible>
|
28
|
+
<auto_enroll_user_type nil="true"></auto_enroll_user_type>
|
29
|
+
</project>
|
30
|
+
<project>
|
31
|
+
<name>Another Project</name>
|
32
|
+
<identifier>another_project</identifier>
|
33
|
+
<description>Another Project description</description>
|
34
|
+
<created_at type="datetime">2010-11-20T10:37:52Z></created_at>
|
35
|
+
<updated_at type="datetime">2010-11-21T00:47:55Z></updated_at>
|
36
|
+
<created_by url="http://localhost:8080/api/v2/users/8.xml">
|
37
|
+
<name>anne</name>
|
38
|
+
<login>anne</login>
|
39
|
+
</created_by>
|
40
|
+
<modified_by url="http://localhost:8080/api/v2/users/2.xml">
|
41
|
+
<name>bonna</name>
|
42
|
+
<login>bonna</login>
|
43
|
+
</modified_by>
|
44
|
+
<keywords>
|
45
|
+
<keyword>card</keyword>
|
46
|
+
<keyword>#</keyword>
|
47
|
+
</keywords>
|
48
|
+
<template type="boolean">false</template>
|
49
|
+
<email_address></email_address>
|
50
|
+
<email_sender_name></email_sender_name>
|
51
|
+
<date_format>%d %b %Y</date_format>
|
52
|
+
<time_zone>Beijing</time_zone>
|
53
|
+
<precision type="integer">2</precision>
|
54
|
+
<anonymous_accessible type="boolean">false</anonymous_accessible>
|
55
|
+
<auto_enroll_user_type nil="true"></auto_enroll_user_type>
|
56
|
+
</project>
|
57
|
+
</projects>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Mingle::Project" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'Authorization' => 'Basic OjAwMDAwMA==', 'Accept' => 'application/xml'}
|
6
|
+
headers_post = {'Authorization' => 'Basic OjAwMDAwMA==', 'Content-Type' => 'application/xml'}
|
7
|
+
@identifier = 'test_project'
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/api/v2/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/api/v2/projects/test_project.xml', headers, fixture_for('projects/test_project'), 200
|
11
|
+
mock.get '/api/v2/projects/dumb.xml', headers, fixture_for('projects/create'), 404
|
12
|
+
mock.post '/api/v2/projects.xml?project[name]=Another%20project&project[description]=This%20is%20a%20another%20project&project[identifier]=dumb', headers_post, '', 200, 'Location' => '/projects/dumb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
@ticketmaster = TicketMaster.new(:mingle, {:server => 'myserver.com', :username => 'anymoto', :password => '000000'})
|
18
|
+
@klass = TicketMaster::Provider::Mingle::Project
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to load all projects" do
|
22
|
+
@ticketmaster.projects.should be_an_instance_of(Array)
|
23
|
+
@ticketmaster.projects.first.should be_an_instance_of(@klass)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to load projects from an array of id's" do
|
27
|
+
@projects = @ticketmaster.projects([@identifier])
|
28
|
+
@projects.should be_an_instance_of(Array)
|
29
|
+
@projects.first.should be_an_instance_of(@klass)
|
30
|
+
@projects.first.identifier.should == @identifier
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should be able to load all projects from attributes" do
|
34
|
+
@projects = @ticketmaster.projects(:identifier => 'test_project')
|
35
|
+
@projects.should be_an_instance_of(Array)
|
36
|
+
@projects.first.should be_an_instance_of(@klass)
|
37
|
+
@projects.first.identifier.should == 'test_project'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should be able to find a project" do
|
41
|
+
@ticketmaster.project.should == @klass
|
42
|
+
@ticketmaster.project.find(@identifier).should be_an_instance_of(@klass)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be able to find a project by identifier" do
|
46
|
+
@ticketmaster.project(@identifier).should be_an_instance_of(@klass)
|
47
|
+
@ticketmaster.project(@identifier).identifier.should == @identifier
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should be able to create a new project" do
|
51
|
+
@project = @ticketmaster.project!(:name => 'Another project', :identifier => 'dumb', :description => 'This is a another project').should be_an_instance_of(@klass)
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ticketmaster'
|
5
|
+
require 'ticketmaster-mingle'
|
6
|
+
require 'spec'
|
7
|
+
require 'spec/autorun'
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def fixture_for(name)
|
14
|
+
File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.xml')
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Mingle" do
|
4
|
+
|
5
|
+
it "should be able to instantiate a new instance" do
|
6
|
+
@ticketmaster = TicketMaster.new(:mingle, {:server => 'myserver.com', :username => 'anymoto', :password => '000000'})
|
7
|
+
@ticketmaster.should be_an_instance_of(TicketMaster)
|
8
|
+
@ticketmaster.should be_a_kind_of(TicketMaster::Provider::Mingle)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Mingle::Ticket" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'Authorization' => 'Basic OjAwMDAwMA==', 'Accept' => 'application/xml'}
|
6
|
+
headers_post_put = {'Authorization' => 'Basic OjAwMDAwMA==', 'Content-Type' => 'application/xml'}
|
7
|
+
@identifier = 'test_project'
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/api/v2/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/api/v2/projects/test_project.xml', headers, fixture_for('projects/test_project'), 200
|
11
|
+
mock.get '/api/v2/projects/test_project/cards/42.xml', headers, fixture_for('cards/42'), 200
|
12
|
+
mock.get '/api/v2/projects/test_project/cards.xml', headers, fixture_for('cards'), 200
|
13
|
+
mock.get '/api/v2/projects/test_project/cards/42.xml', headers, fixture_for('cards/42'), 200
|
14
|
+
mock.put '/api/v2/projects/test_project/cards/42.xml?card[name]=Ticket%201&card[number]=42&card[created_on]=Wed%20Oct%2014%2009:14:54%20UTC%202009&card[modified_on]=Wed%20Oct%2014%2009:14:54%20UTC%202009&card[id]=0&card[description]=New%20card%20description', headers_post_put, '', 200
|
15
|
+
mock.post '/api/v2/projects/test_project/cards.xml?card[title]=Ticket%20%2312&card[description]=Body', headers_post_put, '', 200
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
@ticketmaster = TicketMaster.new(:mingle, {:server => 'myserver.com', :username => 'anymoto', :password => '000000'})
|
21
|
+
@project = @ticketmaster.project(@identifier)
|
22
|
+
@klass = TicketMaster::Provider::Mingle::Ticket
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be able to load all tickets" do
|
26
|
+
@project.tickets.should be_an_instance_of(Array)
|
27
|
+
@project.tickets.first.should be_an_instance_of(@klass)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should be able to load all tickets based on an array of id's" do
|
31
|
+
@tickets = @project.tickets([42])
|
32
|
+
@tickets.should be_an_instance_of(Array)
|
33
|
+
@tickets.first.should be_an_instance_of(@klass)
|
34
|
+
@tickets.first.name.should == 'Ticket 1'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be able to load all tickets based on attributes" do
|
38
|
+
@tickets = @project.tickets(:number => 42)
|
39
|
+
@tickets.should be_an_instance_of(Array)
|
40
|
+
@tickets.first.should be_an_instance_of(@klass)
|
41
|
+
@tickets.first.name.should == 'Ticket 1'
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return the ticket class" do
|
45
|
+
@project.ticket.should == @klass
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to load a single ticket" do
|
49
|
+
@ticket = @project.ticket(42)
|
50
|
+
@ticket.should be_an_instance_of(@klass)
|
51
|
+
@ticket.name.should == 'Ticket 1'
|
52
|
+
end
|
53
|
+
|
54
|
+
it "shoule be able to load a single ticket based on attributes" do
|
55
|
+
@ticket = @project.ticket(:number => 42)
|
56
|
+
@ticket.should be_an_instance_of(@klass)
|
57
|
+
@ticket.name.should == 'Ticket 1'
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should be able to update and save a ticket" do
|
61
|
+
@ticket = @project.ticket(42)
|
62
|
+
@ticket.description = 'New card description'
|
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
|