ticketmaster-lighthouse 0.3.5 → 0.3.6
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/VERSION +1 -1
- data/lib/lighthouse/lighthouse-api.rb +1 -1
- data/lib/provider/ticket.rb +3 -2
- data/spec/comments_spec.rb +64 -0
- data/spec/fixtures/projects.xml +29 -0
- data/spec/fixtures/projects/54448.xml +27 -0
- data/spec/fixtures/projects/create.xml +26 -0
- data/spec/fixtures/tickets.xml +79 -0
- data/spec/fixtures/tickets/2.xml +317 -0
- data/spec/fixtures/tickets/5.xml +78 -0
- data/spec/fixtures/tickets/create.xml +26 -0
- data/spec/projects_spec.rb +71 -0
- data/spec/spec_helper.rb +7 -1
- data/spec/ticketmaster-lighthouse_spec.rb +2 -53
- data/spec/tickets_spec.rb +70 -0
- data/ticketmaster-lighthouse.gemspec +17 -4
- metadata +17 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/lib/provider/ticket.rb
CHANGED
@@ -66,7 +66,7 @@ module TicketMaster::Provider
|
|
66
66
|
|
67
67
|
# Set the description, mapped to body, which actually does a comment
|
68
68
|
def description=(desc)
|
69
|
-
body = desc
|
69
|
+
self.body = desc
|
70
70
|
end
|
71
71
|
|
72
72
|
# Get the assigned person's name
|
@@ -105,9 +105,10 @@ module TicketMaster::Provider
|
|
105
105
|
t = "\"#{t}\"" if t.include?(' ')
|
106
106
|
mem << t
|
107
107
|
end.join(' ') if @tags
|
108
|
-
super
|
108
|
+
result = super
|
109
109
|
body = nil
|
110
110
|
@system_data[:client].body = nil
|
111
|
+
result
|
111
112
|
end
|
112
113
|
|
113
114
|
# The closer
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Lighthouse::Comment" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'X-LighthouseToken' => '000000'}
|
6
|
+
wheaders = headers.merge('Content-Type' => 'application/xml')
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/projects/54448.xml', headers, fixture_for('projects/54448'), 200
|
9
|
+
mock.get '/projects/54448/tickets.xml', headers, fixture_for('tickets'), 200
|
10
|
+
mock.get '/projects/54448/tickets/2.xml', headers, fixture_for('tickets/2'), 200
|
11
|
+
mock.put '/projects/54448/tickets/2.xml', wheaders, '', 200
|
12
|
+
end
|
13
|
+
@project_id = 54448
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
@ticketmaster = TicketMaster.new(:lighthouse, :account => 'ticketmaster', :token => '000000')
|
18
|
+
@project = @ticketmaster.project(@project_id)
|
19
|
+
@ticket = @project.ticket(2)
|
20
|
+
@klass = TicketMaster::Provider::Lighthouse::Comment
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to load all comments" do
|
24
|
+
@comments = @ticket.comments
|
25
|
+
@comments.should be_an_instance_of Array
|
26
|
+
@comments.first.should be_an_instance_of @klass
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to load all comments based on 'id's" do # lighthouse comments don't have ids, so we're faking them
|
30
|
+
@comments = @ticket.comments([0,2,3])
|
31
|
+
@comments.should be_an_instance_of Array
|
32
|
+
@comments.first.id.should == 0
|
33
|
+
@comments.last.id.should == 3
|
34
|
+
@comments[1].should be_an_instance_of @klass
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be able to load all comments based on attributes" do
|
38
|
+
@comments = @ticket.comments(:number => @ticket.id)
|
39
|
+
@comments.should be_an_instance_of Array
|
40
|
+
@comments.first.should be_an_instance_of @klass
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to load a comment based on id" do
|
44
|
+
@comment = @ticket.comment(3)
|
45
|
+
@comment.should be_an_instance_of @klass
|
46
|
+
@comment.id.should == 3
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should be able to load a comment based on attributes" do
|
50
|
+
@comment = @ticket.comment(:number => @ticket.id)
|
51
|
+
@comment.should be_an_instance_of @klass
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return the class" do
|
55
|
+
@ticket.comment.should == @klass
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to create a comment" do # which as mentioned before is technically a ticket update
|
59
|
+
@test = @klass.find_by_id(54448, 2, 10)
|
60
|
+
@klass.should_receive(:find_by_id).with(54448, 2, 11).and_return(@test)
|
61
|
+
@comment = @ticket.comment!(:body => 'hello there boys and girls')
|
62
|
+
@comment.should be_an_instance_of @klass
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projects type="array">
|
3
|
+
<project>
|
4
|
+
<archived type="boolean">false</archived>
|
5
|
+
<created-at type="datetime">2010-06-15T00:44:27Z</created-at>
|
6
|
+
<default-assigned-user-id type="integer" nil="true"></default-assigned-user-id>
|
7
|
+
<default-milestone-id type="integer" nil="true"></default-milestone-id>
|
8
|
+
<default-ticket-text nil="true"></default-ticket-text>
|
9
|
+
<description>This is a test project created in order to test the ticketmaster-lighthouse gem.</description>
|
10
|
+
<description-html><div><p>This is a test project created in order to test the
|
11
|
+
ticketmaster-lighthouse gem.</p></div></description-html>
|
12
|
+
<hidden type="boolean">false</hidden>
|
13
|
+
<id type="integer">54448</id>
|
14
|
+
<license nil="true"></license>
|
15
|
+
<name>lh-test</name>
|
16
|
+
<open-tickets-count type="integer">11</open-tickets-count>
|
17
|
+
<permalink>lh-test</permalink>
|
18
|
+
<public type="boolean">true</public>
|
19
|
+
<send-changesets-to-events type="boolean">true</send-changesets-to-events>
|
20
|
+
<updated-at type="datetime">2010-07-06T22:00:38Z</updated-at>
|
21
|
+
<open-states-list>new,open</open-states-list>
|
22
|
+
<closed-states-list>resolved,hold,invalid</closed-states-list>
|
23
|
+
<open-states>new/f17 # You can add comments here
|
24
|
+
open/aaa # if you want to.</open-states>
|
25
|
+
<closed-states>resolved/6A0 # You can customize colors
|
26
|
+
hold/EB0 # with 3 or 6 character hex codes
|
27
|
+
invalid/A30 # 'A30' expands to 'AA3300'</closed-states>
|
28
|
+
</project>
|
29
|
+
</projects>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<archived type="boolean">false</archived>
|
4
|
+
<created-at type="datetime">2010-06-15T00:44:27Z</created-at>
|
5
|
+
<default-assigned-user-id type="integer" nil="true"></default-assigned-user-id>
|
6
|
+
<default-milestone-id type="integer" nil="true"></default-milestone-id>
|
7
|
+
<default-ticket-text nil="true"></default-ticket-text>
|
8
|
+
<description>This is a test project created in order to test the ticketmaster-lighthouse gem.</description>
|
9
|
+
<description-html><div><p>This is a test project created in order to test the
|
10
|
+
ticketmaster-lighthouse gem.</p></div></description-html>
|
11
|
+
<hidden type="boolean">false</hidden>
|
12
|
+
<id type="integer">54448</id>
|
13
|
+
<license nil="true"></license>
|
14
|
+
<name>lh-test</name>
|
15
|
+
<open-tickets-count type="integer">11</open-tickets-count>
|
16
|
+
<permalink>lh-test</permalink>
|
17
|
+
<public type="boolean">true</public>
|
18
|
+
<send-changesets-to-events type="boolean">true</send-changesets-to-events>
|
19
|
+
<updated-at type="datetime">2010-07-06T22:00:38Z</updated-at>
|
20
|
+
<open-states-list>new,open</open-states-list>
|
21
|
+
<closed-states-list>resolved,hold,invalid</closed-states-list>
|
22
|
+
<open-states>new/f17 # You can add comments here
|
23
|
+
open/aaa # if you want to.</open-states>
|
24
|
+
<closed-states>resolved/6A0 # You can customize colors
|
25
|
+
hold/EB0 # with 3 or 6 character hex codes
|
26
|
+
invalid/A30 # 'A30' expands to 'AA3300'</closed-states>
|
27
|
+
</project>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<archived type="boolean">false</archived>
|
4
|
+
<created-at type="datetime">2010-07-07T18:06:46Z</created-at>
|
5
|
+
<default-assigned-user-id type="integer" nil="true"></default-assigned-user-id>
|
6
|
+
<default-milestone-id type="integer" nil="true"></default-milestone-id>
|
7
|
+
<default-ticket-text nil="true"></default-ticket-text>
|
8
|
+
<description nil="true"></description>
|
9
|
+
<description-html></description-html>
|
10
|
+
<hidden type="boolean">false</hidden>
|
11
|
+
<id type="integer">55789</id>
|
12
|
+
<license nil="true"></license>
|
13
|
+
<name>Project #1</name>
|
14
|
+
<open-tickets-count type="integer">0</open-tickets-count>
|
15
|
+
<permalink>project-1</permalink>
|
16
|
+
<public type="boolean">false</public>
|
17
|
+
<send-changesets-to-events type="boolean">true</send-changesets-to-events>
|
18
|
+
<updated-at type="datetime">2010-07-07T18:06:46Z</updated-at>
|
19
|
+
<open-states-list>new,open</open-states-list>
|
20
|
+
<closed-states-list>resolved,hold,invalid</closed-states-list>
|
21
|
+
<open-states>new/f17 # You can add comments here
|
22
|
+
open/aaa # if you want to.</open-states>
|
23
|
+
<closed-states>resolved/6A0 # You can customize colors
|
24
|
+
hold/EB0 # with 3 or 6 character hex codes
|
25
|
+
invalid/A30 # 'A30' expands to 'AA3300'</closed-states>
|
26
|
+
</project>
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<tickets type="array">
|
3
|
+
<ticket>
|
4
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
5
|
+
<attachments-count type="integer">0</attachments-count>
|
6
|
+
<closed type="boolean">false</closed>
|
7
|
+
<created-at type="datetime">2010-07-03T05:01:48Z</created-at>
|
8
|
+
<creator-id type="integer">67916</creator-id>
|
9
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
10
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
11
|
+
<number type="integer">5</number>
|
12
|
+
<permalink>tehantuehn</permalink>
|
13
|
+
<priority type="integer">3</priority>
|
14
|
+
<project-id type="integer">54448</project-id>
|
15
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
16
|
+
<state>new</state>
|
17
|
+
<tag nil="true"></tag>
|
18
|
+
<title>tehantuehn</title>
|
19
|
+
<updated-at type="datetime">2010-07-03T05:01:51Z</updated-at>
|
20
|
+
<user-id type="integer">67916</user-id>
|
21
|
+
<user-name>Kia Kroas</user-name>
|
22
|
+
<creator-name>Kia Kroas</creator-name>
|
23
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
24
|
+
<original-body>cheuasoht atesuhn</original-body>
|
25
|
+
<latest-body>cheuasoht atesuhn</latest-body>
|
26
|
+
<original-body-html><div><p>cheuasoht atesuhn</p></div></original-body-html>
|
27
|
+
</ticket>
|
28
|
+
<ticket>
|
29
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
30
|
+
<attachments-count type="integer">0</attachments-count>
|
31
|
+
<closed type="boolean">false</closed>
|
32
|
+
<created-at type="datetime">2010-07-03T05:00:48Z</created-at>
|
33
|
+
<creator-id type="integer">67916</creator-id>
|
34
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
35
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
36
|
+
<number type="integer">4</number>
|
37
|
+
<permalink>tehantuehn</permalink>
|
38
|
+
<priority type="integer">2</priority>
|
39
|
+
<project-id type="integer">54448</project-id>
|
40
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
41
|
+
<state>new</state>
|
42
|
+
<tag nil="true"></tag>
|
43
|
+
<title>tehantuehn</title>
|
44
|
+
<updated-at type="datetime">2010-07-03T05:00:48Z</updated-at>
|
45
|
+
<user-id type="integer">67916</user-id>
|
46
|
+
<user-name>Kia Kroas</user-name>
|
47
|
+
<creator-name>Kia Kroas</creator-name>
|
48
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/4</url>
|
49
|
+
<original-body nil="true"></original-body>
|
50
|
+
<latest-body nil="true"></latest-body>
|
51
|
+
<original-body-html></original-body-html>
|
52
|
+
</ticket>
|
53
|
+
<ticket>
|
54
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
55
|
+
<attachments-count type="integer">0</attachments-count>
|
56
|
+
<closed type="boolean">false</closed>
|
57
|
+
<created-at type="datetime">2010-07-02T23:13:29Z</created-at>
|
58
|
+
<creator-id type="integer">67916</creator-id>
|
59
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
60
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
61
|
+
<number type="integer">2</number>
|
62
|
+
<permalink>test-ticket</permalink>
|
63
|
+
<priority type="integer">2</priority>
|
64
|
+
<project-id type="integer">54448</project-id>
|
65
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
66
|
+
<state>new</state>
|
67
|
+
<tag>choom heh pers "tag1 tagster" "wha wha waa"</tag>
|
68
|
+
<title>Cheese cakes</title>
|
69
|
+
<updated-at type="datetime">2010-07-02T23:14:06Z</updated-at>
|
70
|
+
<user-id type="integer">67916</user-id>
|
71
|
+
<user-name>Kia Kroas</user-name>
|
72
|
+
<creator-name>Kia Kroas</creator-name>
|
73
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
74
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
75
|
+
<original-body>nt.,hntHOETUHAONTUHANOSTEUHANTOU</original-body>
|
76
|
+
<latest-body>nt.,hntHOETUHAONTUHANOSTEUHANTOU</latest-body>
|
77
|
+
<original-body-html><div><p>nt.,hntHOETUHAONTUHANOSTEUHANTOU</p></div></original-body-html>
|
78
|
+
</ticket>
|
79
|
+
</tickets>
|
@@ -0,0 +1,317 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ticket>
|
3
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
4
|
+
<attachments-count type="integer">0</attachments-count>
|
5
|
+
<closed type="boolean">false</closed>
|
6
|
+
<created-at type="datetime">2010-07-02T23:13:29Z</created-at>
|
7
|
+
<creator-id type="integer">67916</creator-id>
|
8
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
9
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
10
|
+
<number type="integer">2</number>
|
11
|
+
<permalink>test-ticket</permalink>
|
12
|
+
<priority type="integer">2</priority>
|
13
|
+
<project-id type="integer">54448</project-id>
|
14
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
15
|
+
<state>new</state>
|
16
|
+
<tag>choom heh pers "tag1 tagster" "wha wha waa"</tag>
|
17
|
+
<title>Cheese cakes</title>
|
18
|
+
<updated-at type="datetime">2010-07-02T23:14:06Z</updated-at>
|
19
|
+
<user-id type="integer">67916</user-id>
|
20
|
+
<user-name>Kia Kroas</user-name>
|
21
|
+
<creator-name>Kia Kroas</creator-name>
|
22
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
23
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
24
|
+
<original-body>nt.,hntHOETUHAONTUHANOSTEUHANTOU</original-body>
|
25
|
+
<latest-body>nt.,hntHOETUHAONTUHANOSTEUHANTOU</latest-body>
|
26
|
+
<original-body-html><div><p>nt.,hntHOETUHAONTUHANOSTEUHANTOU</p></div></original-body-html>
|
27
|
+
<versions type="array">
|
28
|
+
<version type="Ticket::Version">
|
29
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
30
|
+
<attachments-count type="integer">0</attachments-count>
|
31
|
+
<body>nt.,hntHOETUHAONTUHANOSTEUHANTOU</body>
|
32
|
+
<body-html><div><p>nt.,hntHOETUHAONTUHANOSTEUHANTOU</p></div></body-html>
|
33
|
+
<closed type="boolean">false</closed>
|
34
|
+
<created-at type="datetime">2010-06-15T00:50:22Z</created-at>
|
35
|
+
<creator-id type="integer">67916</creator-id>
|
36
|
+
<diffable-attributes type="yaml">--- {}
|
37
|
+
|
38
|
+
</diffable-attributes>
|
39
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
40
|
+
<number type="integer">2</number>
|
41
|
+
<permalink>test-ticket</permalink>
|
42
|
+
<priority type="integer">0</priority>
|
43
|
+
<project-id type="integer">54448</project-id>
|
44
|
+
<state>new</state>
|
45
|
+
<tag nil="true"></tag>
|
46
|
+
<title>Test ticket</title>
|
47
|
+
<updated-at type="datetime">2010-06-29T22:36:01Z</updated-at>
|
48
|
+
<user-id type="integer">67916</user-id>
|
49
|
+
<user-name>Kia Kroas</user-name>
|
50
|
+
<creator-name>Kia Kroas</creator-name>
|
51
|
+
<assigned-user-name nil="true"></assigned-user-name>
|
52
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
53
|
+
</version>
|
54
|
+
<version type="Ticket::Version">
|
55
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
56
|
+
<attachments-count type="integer">0</attachments-count>
|
57
|
+
<body nil="true"></body>
|
58
|
+
<body-html nil="true"></body-html>
|
59
|
+
<closed type="boolean">false</closed>
|
60
|
+
<created-at type="datetime">2010-06-15T01:39:36Z</created-at>
|
61
|
+
<creator-id type="integer">67916</creator-id>
|
62
|
+
<diffable-attributes type="yaml">---
|
63
|
+
:title: Test ticket
|
64
|
+
</diffable-attributes>
|
65
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
66
|
+
<number type="integer">2</number>
|
67
|
+
<permalink>test-ticket</permalink>
|
68
|
+
<priority type="integer">0</priority>
|
69
|
+
<project-id type="integer">54448</project-id>
|
70
|
+
<state>new</state>
|
71
|
+
<tag nil="true"></tag>
|
72
|
+
<title>Cheese cakes</title>
|
73
|
+
<updated-at type="datetime">2010-06-15T01:39:40Z</updated-at>
|
74
|
+
<user-id type="integer">67916</user-id>
|
75
|
+
<user-name>Kia Kroas</user-name>
|
76
|
+
<creator-name>Kia Kroas</creator-name>
|
77
|
+
<assigned-user-name nil="true"></assigned-user-name>
|
78
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
79
|
+
</version>
|
80
|
+
<version type="Ticket::Version">
|
81
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
82
|
+
<attachments-count type="integer">0</attachments-count>
|
83
|
+
<body>Rokatoo</body>
|
84
|
+
<body-html><div><p>Rokatoo</p></div></body-html>
|
85
|
+
<closed type="boolean">false</closed>
|
86
|
+
<created-at type="datetime">2010-06-29T22:35:37Z</created-at>
|
87
|
+
<creator-id type="integer">67916</creator-id>
|
88
|
+
<diffable-attributes type="yaml">---
|
89
|
+
:assigned_user:
|
90
|
+
:priority: 0
|
91
|
+
:tag:
|
92
|
+
</diffable-attributes>
|
93
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
94
|
+
<number type="integer">2</number>
|
95
|
+
<permalink>test-ticket</permalink>
|
96
|
+
<priority type="integer">2</priority>
|
97
|
+
<project-id type="integer">54448</project-id>
|
98
|
+
<state>new</state>
|
99
|
+
<tag>"tag1 tagster"</tag>
|
100
|
+
<title>Cheese cakes</title>
|
101
|
+
<updated-at type="datetime">2010-06-29T22:35:39Z</updated-at>
|
102
|
+
<user-id type="integer">67916</user-id>
|
103
|
+
<user-name>Kia Kroas</user-name>
|
104
|
+
<creator-name>Kia Kroas</creator-name>
|
105
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
106
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
107
|
+
</version>
|
108
|
+
<version type="Ticket::Version">
|
109
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
110
|
+
<attachments-count type="integer">0</attachments-count>
|
111
|
+
<body>This is a ticket set from tm console</body>
|
112
|
+
<body-html><div><p>This is a ticket set from tm console</p></div></body-html>
|
113
|
+
<closed type="boolean">false</closed>
|
114
|
+
<created-at type="datetime">2010-07-02T05:32:19Z</created-at>
|
115
|
+
<creator-id type="integer">67916</creator-id>
|
116
|
+
<diffable-attributes type="yaml">--- {}
|
117
|
+
|
118
|
+
</diffable-attributes>
|
119
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
120
|
+
<number type="integer">2</number>
|
121
|
+
<permalink>test-ticket</permalink>
|
122
|
+
<priority type="integer">2</priority>
|
123
|
+
<project-id type="integer">54448</project-id>
|
124
|
+
<state>new</state>
|
125
|
+
<tag>"tag1 tagster"</tag>
|
126
|
+
<title>Cheese cakes</title>
|
127
|
+
<updated-at type="datetime">2010-07-02T05:32:20Z</updated-at>
|
128
|
+
<user-id type="integer">67916</user-id>
|
129
|
+
<user-name>Kia Kroas</user-name>
|
130
|
+
<creator-name>Kia Kroas</creator-name>
|
131
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
132
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
133
|
+
</version>
|
134
|
+
<version type="Ticket::Version">
|
135
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
136
|
+
<attachments-count type="integer">0</attachments-count>
|
137
|
+
<body>What the hey?</body>
|
138
|
+
<body-html><div><p>What the hey?</p></div></body-html>
|
139
|
+
<closed type="boolean">false</closed>
|
140
|
+
<created-at type="datetime">2010-07-02T05:32:49Z</created-at>
|
141
|
+
<creator-id type="integer">67916</creator-id>
|
142
|
+
<diffable-attributes type="yaml">--- {}
|
143
|
+
|
144
|
+
</diffable-attributes>
|
145
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
146
|
+
<number type="integer">2</number>
|
147
|
+
<permalink>test-ticket</permalink>
|
148
|
+
<priority type="integer">2</priority>
|
149
|
+
<project-id type="integer">54448</project-id>
|
150
|
+
<state>new</state>
|
151
|
+
<tag>"tag1 tagster"</tag>
|
152
|
+
<title>Cheese cakes</title>
|
153
|
+
<updated-at type="datetime">2010-07-02T05:32:51Z</updated-at>
|
154
|
+
<user-id type="integer">67916</user-id>
|
155
|
+
<user-name>Kia Kroas</user-name>
|
156
|
+
<creator-name>Kia Kroas</creator-name>
|
157
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
158
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
159
|
+
</version>
|
160
|
+
<version type="Ticket::Version">
|
161
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
162
|
+
<attachments-count type="integer">0</attachments-count>
|
163
|
+
<body>What the hey?</body>
|
164
|
+
<body-html><div><p>What the hey?</p></div></body-html>
|
165
|
+
<closed type="boolean">false</closed>
|
166
|
+
<created-at type="datetime">2010-07-02T05:34:24Z</created-at>
|
167
|
+
<creator-id type="integer">67916</creator-id>
|
168
|
+
<diffable-attributes type="yaml">--- {}
|
169
|
+
|
170
|
+
</diffable-attributes>
|
171
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
172
|
+
<number type="integer">2</number>
|
173
|
+
<permalink>test-ticket</permalink>
|
174
|
+
<priority type="integer">2</priority>
|
175
|
+
<project-id type="integer">54448</project-id>
|
176
|
+
<state>new</state>
|
177
|
+
<tag>"tag1 tagster"</tag>
|
178
|
+
<title>Cheese cakes</title>
|
179
|
+
<updated-at type="datetime">2010-07-02T05:34:27Z</updated-at>
|
180
|
+
<user-id type="integer">67916</user-id>
|
181
|
+
<user-name>Kia Kroas</user-name>
|
182
|
+
<creator-name>Kia Kroas</creator-name>
|
183
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
184
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
185
|
+
</version>
|
186
|
+
<version type="Ticket::Version">
|
187
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
188
|
+
<attachments-count type="integer">0</attachments-count>
|
189
|
+
<body></body>
|
190
|
+
<body-html></body-html>
|
191
|
+
<closed type="boolean">false</closed>
|
192
|
+
<created-at type="datetime">2010-07-02T05:39:37Z</created-at>
|
193
|
+
<creator-id type="integer">67916</creator-id>
|
194
|
+
<diffable-attributes type="yaml">---
|
195
|
+
:tag: "\"tag1 tagster\""
|
196
|
+
</diffable-attributes>
|
197
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
198
|
+
<number type="integer">2</number>
|
199
|
+
<permalink>test-ticket</permalink>
|
200
|
+
<priority type="integer">2</priority>
|
201
|
+
<project-id type="integer">54448</project-id>
|
202
|
+
<state>new</state>
|
203
|
+
<tag>"tag1 tagster" "wha wha waa"</tag>
|
204
|
+
<title>Cheese cakes</title>
|
205
|
+
<updated-at type="datetime">2010-07-02T05:39:40Z</updated-at>
|
206
|
+
<user-id type="integer">67916</user-id>
|
207
|
+
<user-name>Kia Kroas</user-name>
|
208
|
+
<creator-name>Kia Kroas</creator-name>
|
209
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
210
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
211
|
+
</version>
|
212
|
+
<version type="Ticket::Version">
|
213
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
214
|
+
<attachments-count type="integer">0</attachments-count>
|
215
|
+
<body></body>
|
216
|
+
<body-html></body-html>
|
217
|
+
<closed type="boolean">false</closed>
|
218
|
+
<created-at type="datetime">2010-07-02T05:40:03Z</created-at>
|
219
|
+
<creator-id type="integer">67916</creator-id>
|
220
|
+
<diffable-attributes type="yaml">---
|
221
|
+
:tag: "\"tag1 tagster\" \"wha wha waa\""
|
222
|
+
</diffable-attributes>
|
223
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
224
|
+
<number type="integer">2</number>
|
225
|
+
<permalink>test-ticket</permalink>
|
226
|
+
<priority type="integer">2</priority>
|
227
|
+
<project-id type="integer">54448</project-id>
|
228
|
+
<state>new</state>
|
229
|
+
<tag>choom heh pers "tag1 tagster" "wha wha waa"</tag>
|
230
|
+
<title>Cheese cakes</title>
|
231
|
+
<updated-at type="datetime">2010-07-02T05:40:04Z</updated-at>
|
232
|
+
<user-id type="integer">67916</user-id>
|
233
|
+
<user-name>Kia Kroas</user-name>
|
234
|
+
<creator-name>Kia Kroas</creator-name>
|
235
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
236
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
237
|
+
</version>
|
238
|
+
<version type="Ticket::Version">
|
239
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
240
|
+
<attachments-count type="integer">0</attachments-count>
|
241
|
+
<body>taoh natht aehu sa utaohe nsahu saeho nsahoeunsau '</body>
|
242
|
+
<body-html><div><p>taoh natht aehu sa utaohe nsahu saeho nsahoeunsau '</p></div></body-html>
|
243
|
+
<closed type="boolean">false</closed>
|
244
|
+
<created-at type="datetime">2010-07-02T06:11:06Z</created-at>
|
245
|
+
<creator-id type="integer">67916</creator-id>
|
246
|
+
<diffable-attributes type="yaml">--- {}
|
247
|
+
|
248
|
+
</diffable-attributes>
|
249
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
250
|
+
<number type="integer">2</number>
|
251
|
+
<permalink>test-ticket</permalink>
|
252
|
+
<priority type="integer">2</priority>
|
253
|
+
<project-id type="integer">54448</project-id>
|
254
|
+
<state>new</state>
|
255
|
+
<tag>choom heh pers "tag1 tagster" "wha wha waa"</tag>
|
256
|
+
<title>Cheese cakes</title>
|
257
|
+
<updated-at type="datetime">2010-07-02T06:11:06Z</updated-at>
|
258
|
+
<user-id type="integer">67916</user-id>
|
259
|
+
<user-name>Kia Kroas</user-name>
|
260
|
+
<creator-name>Kia Kroas</creator-name>
|
261
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
262
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
263
|
+
</version>
|
264
|
+
<version type="Ticket::Version">
|
265
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
266
|
+
<attachments-count type="integer">0</attachments-count>
|
267
|
+
<body nil="true"></body>
|
268
|
+
<body-html nil="true"></body-html>
|
269
|
+
<closed type="boolean">false</closed>
|
270
|
+
<created-at type="datetime">2010-07-02T20:01:33Z</created-at>
|
271
|
+
<creator-id type="integer">67916</creator-id>
|
272
|
+
<diffable-attributes type="yaml">--- {}
|
273
|
+
|
274
|
+
</diffable-attributes>
|
275
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
276
|
+
<number type="integer">2</number>
|
277
|
+
<permalink>test-ticket</permalink>
|
278
|
+
<priority type="integer">2</priority>
|
279
|
+
<project-id type="integer">54448</project-id>
|
280
|
+
<state>new</state>
|
281
|
+
<tag>choom heh pers "tag1 tagster" "wha wha waa"</tag>
|
282
|
+
<title>Cheese cakes</title>
|
283
|
+
<updated-at type="datetime">2010-07-02T20:01:36Z</updated-at>
|
284
|
+
<user-id type="integer">67916</user-id>
|
285
|
+
<user-name>Kia Kroas</user-name>
|
286
|
+
<creator-name>Kia Kroas</creator-name>
|
287
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
288
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
289
|
+
</version>
|
290
|
+
<version type="Ticket::Version">
|
291
|
+
<assigned-user-id type="integer">67916</assigned-user-id>
|
292
|
+
<attachments-count type="integer">0</attachments-count>
|
293
|
+
<body>tt</body>
|
294
|
+
<body-html><div><p>tt</p></div></body-html>
|
295
|
+
<closed type="boolean">false</closed>
|
296
|
+
<created-at type="datetime">2010-07-02T20:02:25Z</created-at>
|
297
|
+
<creator-id type="integer">67916</creator-id>
|
298
|
+
<diffable-attributes type="yaml">--- {}
|
299
|
+
|
300
|
+
</diffable-attributes>
|
301
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
302
|
+
<number type="integer">2</number>
|
303
|
+
<permalink>test-ticket</permalink>
|
304
|
+
<priority type="integer">2</priority>
|
305
|
+
<project-id type="integer">54448</project-id>
|
306
|
+
<state>new</state>
|
307
|
+
<tag>choom heh pers "tag1 tagster" "wha wha waa"</tag>
|
308
|
+
<title>Cheese cakes</title>
|
309
|
+
<updated-at type="datetime">2010-07-02T23:14:04Z</updated-at>
|
310
|
+
<user-id type="integer">67916</user-id>
|
311
|
+
<user-name>Kia Kroas</user-name>
|
312
|
+
<creator-name>Kia Kroas</creator-name>
|
313
|
+
<assigned-user-name>Kia Kroas</assigned-user-name>
|
314
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/2</url>
|
315
|
+
</version>
|
316
|
+
</versions>
|
317
|
+
</ticket>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ticket>
|
3
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
4
|
+
<attachments-count type="integer">0</attachments-count>
|
5
|
+
<closed type="boolean">false</closed>
|
6
|
+
<created-at type="datetime">2010-07-03T05:01:48Z</created-at>
|
7
|
+
<creator-id type="integer">67916</creator-id>
|
8
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
9
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
10
|
+
<number type="integer">5</number>
|
11
|
+
<permalink>tehantuehn</permalink>
|
12
|
+
<priority type="integer">3</priority>
|
13
|
+
<project-id type="integer">54448</project-id>
|
14
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
15
|
+
<state>new</state>
|
16
|
+
<tag nil="true"></tag>
|
17
|
+
<title>tehantuehn</title>
|
18
|
+
<updated-at type="datetime">2010-07-08T02:11:21Z</updated-at>
|
19
|
+
<user-id type="integer">67916</user-id>
|
20
|
+
<user-name>Kia Kroas</user-name>
|
21
|
+
<creator-name>Kia Kroas</creator-name>
|
22
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
23
|
+
<original-body>cheuasoht atesuhn</original-body>
|
24
|
+
<latest-body>cheuasoht atesuhn</latest-body>
|
25
|
+
<original-body-html><div><p>cheuasoht atesuhn</p></div></original-body-html>
|
26
|
+
<versions type="array">
|
27
|
+
<version type="Ticket::Version">
|
28
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
29
|
+
<attachments-count type="integer">0</attachments-count>
|
30
|
+
<body>cheuasoht atesuhn</body>
|
31
|
+
<body-html><div><p>cheuasoht atesuhn</p></div></body-html>
|
32
|
+
<closed type="boolean">false</closed>
|
33
|
+
<created-at type="datetime">2010-07-03T05:01:48Z</created-at>
|
34
|
+
<creator-id type="integer">67916</creator-id>
|
35
|
+
<diffable-attributes type="yaml">--- {}
|
36
|
+
|
37
|
+
</diffable-attributes>
|
38
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
39
|
+
<number type="integer">5</number>
|
40
|
+
<permalink>tehantuehn</permalink>
|
41
|
+
<priority type="integer">3</priority>
|
42
|
+
<project-id type="integer">54448</project-id>
|
43
|
+
<state>new</state>
|
44
|
+
<tag nil="true"></tag>
|
45
|
+
<title>tehantuehn</title>
|
46
|
+
<updated-at type="datetime">2010-07-03T05:01:51Z</updated-at>
|
47
|
+
<user-id type="integer">67916</user-id>
|
48
|
+
<user-name>Kia Kroas</user-name>
|
49
|
+
<creator-name>Kia Kroas</creator-name>
|
50
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
51
|
+
</version>
|
52
|
+
<version type="Ticket::Version">
|
53
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
54
|
+
<attachments-count type="integer">0</attachments-count>
|
55
|
+
<body>New Body</body>
|
56
|
+
<body-html><div><p>New Body</p></div></body-html>
|
57
|
+
<closed type="boolean">false</closed>
|
58
|
+
<created-at type="datetime">2010-07-08T02:11:17Z</created-at>
|
59
|
+
<creator-id type="integer">67916</creator-id>
|
60
|
+
<diffable-attributes type="yaml">--- {}
|
61
|
+
|
62
|
+
</diffable-attributes>
|
63
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
64
|
+
<number type="integer">5</number>
|
65
|
+
<permalink>tehantuehn</permalink>
|
66
|
+
<priority type="integer">3</priority>
|
67
|
+
<project-id type="integer">54448</project-id>
|
68
|
+
<state>new</state>
|
69
|
+
<tag nil="true"></tag>
|
70
|
+
<title>tehantuehn</title>
|
71
|
+
<updated-at type="datetime">2010-07-08T02:11:21Z</updated-at>
|
72
|
+
<user-id type="integer">67916</user-id>
|
73
|
+
<user-name>Kia Kroas</user-name>
|
74
|
+
<creator-name>Kia Kroas</creator-name>
|
75
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
76
|
+
</version>
|
77
|
+
</versions>
|
78
|
+
</ticket>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ticket>
|
3
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
4
|
+
<attachments-count type="integer">0</attachments-count>
|
5
|
+
<closed type="boolean">false</closed>
|
6
|
+
<created-at type="datetime">2010-07-08T01:50:26Z</created-at>
|
7
|
+
<creator-id type="integer">67916</creator-id>
|
8
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
9
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
10
|
+
<number type="integer">12</number>
|
11
|
+
<permalink>ticket-12</permalink>
|
12
|
+
<priority type="integer">10</priority>
|
13
|
+
<project-id type="integer">54448</project-id>
|
14
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
15
|
+
<state>new</state>
|
16
|
+
<tag nil="true"></tag>
|
17
|
+
<title>Ticket #12</title>
|
18
|
+
<updated-at type="datetime">2010-07-08T01:50:26Z</updated-at>
|
19
|
+
<user-id type="integer">67916</user-id>
|
20
|
+
<user-name>Kia Kroas</user-name>
|
21
|
+
<creator-name>Kia Kroas</creator-name>
|
22
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/12</url>
|
23
|
+
<original-body>Body</original-body>
|
24
|
+
<latest-body>Body</latest-body>
|
25
|
+
<original-body-html><div><p>Body</p></div></original-body-html>
|
26
|
+
</ticket>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Lighthouse::Project" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'X-LighthouseToken' => '000000'}
|
6
|
+
wheaders = headers.merge('Content-Type' => 'application/xml')
|
7
|
+
@project_id = 54448
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/projects/54448.xml', headers, fixture_for('projects/54448'), 200
|
11
|
+
mock.get '/projects/create.xml', headers, fixture_for('projects/create'), 200
|
12
|
+
mock.delete '/projects/54448.xml', headers, '', 200
|
13
|
+
mock.put '/projects/54448.xml', wheaders, '', 200
|
14
|
+
mock.post '/projects.xml', wheaders, '', 201, 'Location' => '/projects/create.xml'
|
15
|
+
mock.get '/projects/54448/tickets.xml', headers, fixture_for('tickets'), 200
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
@ticketmaster = TicketMaster.new(:lighthouse, :token => '000000', :account => 'ticketmaster')
|
21
|
+
@klass = TicketMaster::Provider::Lighthouse::Project
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to load all projects" do
|
25
|
+
@ticketmaster.projects.should be_an_instance_of Array
|
26
|
+
@ticketmaster.projects.first.should be_an_instance_of @klass
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to load projects from an array of ids" do
|
30
|
+
@projects = @ticketmaster.projects([@project_id])
|
31
|
+
@projects.should be_an_instance_of Array
|
32
|
+
@projects.first.should be_an_instance_of @klass
|
33
|
+
@projects.first.id.should == @project_id
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to load all projects from attributes" do
|
37
|
+
@projects = @ticketmaster.projects(:id => @project_id)
|
38
|
+
@projects.should be_an_instance_of Array
|
39
|
+
@projects.first.should be_an_instance_of @klass
|
40
|
+
@projects.first.id.should == @project_id
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to find a project" do
|
44
|
+
@ticketmaster.project.should == @klass
|
45
|
+
@ticketmaster.project.find(@project_id).should be_an_instance_of @klass
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to find a project by id" do
|
49
|
+
@ticketmaster.project(@project_id).should be_an_instance_of @klass
|
50
|
+
@ticketmaster.project(@project_id).id.should == @project_id
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to find a project by attributes" do
|
54
|
+
@ticketmaster.project(:id => @project_id).id.should == @project_id
|
55
|
+
@ticketmaster.project(:id => @project_id).should be_an_instance_of @klass
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to update and save a project" do
|
59
|
+
@project = @ticketmaster.project(@project_id)
|
60
|
+
@project.save.should == nil
|
61
|
+
@project.update!(:name => 'some new name').should == true
|
62
|
+
@project.name = 'this is a change'
|
63
|
+
@project.save.should == true
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should be able to create a project" do
|
67
|
+
@project = @ticketmaster.project.create(:name => 'Project #1')
|
68
|
+
@project.should be_an_instance_of @klass
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
require '
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ticketmaster'
|
4
5
|
require 'ticketmaster-lighthouse'
|
6
|
+
require 'active_resource/http_mock'
|
5
7
|
require 'spec'
|
6
8
|
require 'spec/autorun'
|
7
9
|
|
8
10
|
Spec::Runner.configure do |config|
|
9
11
|
|
10
12
|
end
|
13
|
+
|
14
|
+
def fixture_for(name)
|
15
|
+
File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.xml')
|
16
|
+
end
|
@@ -1,62 +1,11 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe "Ticketmaster" do
|
4
|
-
before(:each) do
|
5
|
-
@ticketmaster = TicketMaster.new(:lighthouse, :token => '00c00123b00f00dc0de', :account => 'ticketmaster')
|
6
|
-
@project_class = TicketMaster::Provider::Lighthouse::Project
|
7
|
-
@ticket_class = TicketMaster::Provider::Lighthouse::Ticket
|
8
|
-
@lh_project = LighthouseAPI::Project.new
|
9
|
-
@lh_project.attributes = {"permalink"=>"lh-test", "name"=>"lh-test", "created_at"=>Time.now, "description_html"=>"<div><p>This is a test project created in order to test the\nticketmaster-lighthouse gem.</p></div>", "closed_states_list"=>"resolved,hold,invalid", "public"=>true, "default_ticket_text"=>nil, "license"=>nil, "default_milestone_id"=>nil, "closed_states"=>"resolved/6A0 # You can customize colors\nhold/EB0 # with 3 or 6 character hex codes\ninvalid/A30 # 'A30' expands to 'AA3300'", "updated_at"=>Time.now, "archived"=>false, "send_changesets_to_events"=>true, "open_states_list"=>"new,open", "open_tickets_count"=>2, "id"=>54448, "default_assigned_user_id"=>nil, "description"=>"This is a test project created in order to test the ticketmaster-lighthouse gem.", "open_states"=>"new/f17 # You can add comments here\nopen/aaa # if you want to.", "hidden"=>false}
|
10
|
-
@lh_project.prefix_options = {}
|
11
|
-
|
12
|
-
end
|
3
|
+
describe "Ticketmaster::Provider::Lighthouse" do
|
13
4
|
|
14
|
-
# Essentially just a sanity check on the include since .new always returns the object's instance
|
15
5
|
it "should be able to instantiate a new instance" do
|
6
|
+
@ticketmaster = TicketMaster.new(:lighthouse, {:account => 'ticketmaster', :token => '000000'})
|
16
7
|
@ticketmaster.should be_an_instance_of TicketMaster
|
17
8
|
@ticketmaster.should be_a_kind_of TicketMaster::Provider::Lighthouse
|
18
9
|
end
|
19
10
|
|
20
|
-
it "should be able to load projects" do
|
21
|
-
LighthouseAPI::Project.should_receive(:find).with(:all).at_least(:once).and_return([@lh_project])
|
22
|
-
@ticketmaster.projects.should be_an_instance_of Array
|
23
|
-
@ticketmaster.projects.first.should be_an_instance_of @project_class
|
24
|
-
@ticketmaster.projects.first.description.should == @lh_project.attributes['description']
|
25
|
-
@ticketmaster.projects(:id => 54448).should be_an_instance_of Array
|
26
|
-
@ticketmaster.projects(:id => 54448).first.should be_an_instance_of @project_class
|
27
|
-
@ticketmaster.projects(:id => 54448).first.id.should == 54448
|
28
|
-
|
29
|
-
@ticketmaster.project.should == @project_class
|
30
|
-
@ticketmaster.project(:name => "lh-test").should be_an_instance_of @project_class
|
31
|
-
@ticketmaster.project(:name => "lh-test").name.should == "lh-test"
|
32
|
-
@ticketmaster.project.find(:first, :description => @lh_project.attributes['description']).should be_an_instance_of @project_class
|
33
|
-
@ticketmaster.project.find(:first, :description => @lh_project.attributes['description']).description.should == @lh_project.attributes['description']
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should be able to do project stuff" do
|
37
|
-
info = {:name => 'Test create'}
|
38
|
-
LighthouseAPI::Project.should_receive(:new).at_least(:once).and_return(@lh_project)
|
39
|
-
@lh_project.should_receive(:save).at_least(:once).and_return(true)
|
40
|
-
@ticketmaster.project.create(info).should be_an_instance_of @project_class
|
41
|
-
@ticketmaster.project.new(info).should be_an_instance_of @project_class
|
42
|
-
@ticketmaster.project.create(info).id.should == 54448
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be able to load tickets" do
|
46
|
-
LighthouseAPI::Project.should_receive(:find).with(:all).at_least(:once).and_return([@lh_project])
|
47
|
-
LighthouseAPI::Ticket.should_receive(:find).with(:all, :params => {:project_id => 54448}).at_least(:once).and_return([LighthouseAPI::Ticket.new])
|
48
|
-
LighthouseAPI::Ticket.should_receive(:find).with(999, :params => {:project_id => 54448}).at_least(:once).and_return(LighthouseAPI::Ticket.new(:id => 999))
|
49
|
-
LighthouseAPI::Ticket.should_receive(:find).with(:all, :params => {:project_id => 54448, :id => 888}).at_least(:once).and_return([LighthouseAPI::Ticket.new(:id => 888)])
|
50
|
-
project = @ticketmaster.projects.first
|
51
|
-
project.tickets.should be_an_instance_of Array
|
52
|
-
project.tickets.first.should be_an_instance_of @ticket_class
|
53
|
-
project.tickets(999).should be_an_instance_of Array
|
54
|
-
project.tickets(999).first.should be_an_instance_of @ticket_class
|
55
|
-
project.tickets(999).first.id.should == 999
|
56
|
-
|
57
|
-
project.ticket.should == TicketMaster::Provider::Lighthouse::Ticket
|
58
|
-
project.ticket(999).should be_an_instance_of @ticket_class
|
59
|
-
project.ticket(999).id.should == 999
|
60
|
-
project.ticket.find(:first, :project_id => 54448, :id => 888).should be_an_instance_of @ticket_class
|
61
|
-
end
|
62
11
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Lighthouse::Ticket" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'X-LighthouseToken' => '000000'}
|
6
|
+
wheaders = headers.merge('Content-Type' => 'application/xml')
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/projects/54448.xml', headers, fixture_for('projects/54448'), 200
|
9
|
+
mock.get '/projects/54448/tickets.xml', headers, fixture_for('tickets'), 200
|
10
|
+
mock.get '/projects/54448/tickets/5.xml', headers, fixture_for('tickets/5'), 200
|
11
|
+
mock.put '/projects/54448/tickets/5.xml', wheaders, '', 200
|
12
|
+
mock.post '/projects/54448/tickets.xml', wheaders, fixture_for('tickets/create'), 200
|
13
|
+
end
|
14
|
+
@project_id = 54448
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
@ticketmaster = TicketMaster.new(:lighthouse, :account => 'ticketmaster', :token => '000000')
|
19
|
+
@project = @ticketmaster.project(@project_id)
|
20
|
+
@klass = TicketMaster::Provider::Lighthouse::Ticket
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to load all tickets" do
|
24
|
+
@project.tickets.should be_an_instance_of Array
|
25
|
+
@project.tickets.first.should be_an_instance_of @klass
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be able to load all tickets based on an array of ids" do
|
29
|
+
@tickets = @project.tickets([5])
|
30
|
+
@tickets.should be_an_instance_of Array
|
31
|
+
@tickets.first.should be_an_instance_of @klass
|
32
|
+
@tickets.first.id.should == 5
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should be able to load all tickets based on attributes" do
|
36
|
+
@tickets = @project.tickets(:id => 5)
|
37
|
+
@tickets.should be_an_instance_of Array
|
38
|
+
@tickets.first.should be_an_instance_of @klass
|
39
|
+
@tickets.first.id.should == 5
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return the ticket class" do
|
43
|
+
@project.ticket.should == @klass
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to load a single ticket" do
|
47
|
+
@ticket = @project.ticket(5)
|
48
|
+
@ticket.should be_an_instance_of @klass
|
49
|
+
@ticket.id.should == 5
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be able to load a single ticket based on attributes" do
|
53
|
+
@ticket = @project.ticket(:id => 5)
|
54
|
+
@ticket.should be_an_instance_of @klass
|
55
|
+
@ticket.id.should == 5
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to update and save a ticket" do
|
59
|
+
@ticket = @project.ticket(5)
|
60
|
+
@ticket.save.should == nil
|
61
|
+
@ticket.description = 'hello'
|
62
|
+
@ticket.save.should == true
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be able to create a ticket" do
|
66
|
+
@ticket = @project.ticket!(:title => 'Ticket #12', :description => 'Body')
|
67
|
+
@ticket.should be_an_instance_of @klass
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ticketmaster-lighthouse}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Hong"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-07}
|
13
13
|
s.description = %q{Allows ticketmaster to interact with Lighthouse's issue tracking system.}
|
14
14
|
s.email = %q{hong.quach@abigfisch.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,9 +31,19 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/provider/project.rb",
|
32
32
|
"lib/provider/ticket.rb",
|
33
33
|
"lib/ticketmaster-lighthouse.rb",
|
34
|
+
"spec/comments_spec.rb",
|
35
|
+
"spec/fixtures/projects.xml",
|
36
|
+
"spec/fixtures/projects/54448.xml",
|
37
|
+
"spec/fixtures/projects/create.xml",
|
38
|
+
"spec/fixtures/tickets.xml",
|
39
|
+
"spec/fixtures/tickets/2.xml",
|
40
|
+
"spec/fixtures/tickets/5.xml",
|
41
|
+
"spec/fixtures/tickets/create.xml",
|
42
|
+
"spec/projects_spec.rb",
|
34
43
|
"spec/spec.opts",
|
35
44
|
"spec/spec_helper.rb",
|
36
45
|
"spec/ticketmaster-lighthouse_spec.rb",
|
46
|
+
"spec/tickets_spec.rb",
|
37
47
|
"ticketmaster-lighthouse.gemspec"
|
38
48
|
]
|
39
49
|
s.homepage = %q{http://github.com/kiafaldorius/ticketmaster-lighthouse}
|
@@ -42,8 +52,11 @@ Gem::Specification.new do |s|
|
|
42
52
|
s.rubygems_version = %q{1.3.7}
|
43
53
|
s.summary = %q{Ticketmaster Provider for Lighthouse}
|
44
54
|
s.test_files = [
|
45
|
-
"spec/
|
46
|
-
"spec/
|
55
|
+
"spec/comments_spec.rb",
|
56
|
+
"spec/projects_spec.rb",
|
57
|
+
"spec/spec_helper.rb",
|
58
|
+
"spec/ticketmaster-lighthouse_spec.rb",
|
59
|
+
"spec/tickets_spec.rb"
|
47
60
|
]
|
48
61
|
|
49
62
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster-lighthouse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 6
|
10
|
+
version: 0.3.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Hong
|
@@ -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
|
@@ -122,9 +122,19 @@ files:
|
|
122
122
|
- lib/provider/project.rb
|
123
123
|
- lib/provider/ticket.rb
|
124
124
|
- lib/ticketmaster-lighthouse.rb
|
125
|
+
- spec/comments_spec.rb
|
126
|
+
- spec/fixtures/projects.xml
|
127
|
+
- spec/fixtures/projects/54448.xml
|
128
|
+
- spec/fixtures/projects/create.xml
|
129
|
+
- spec/fixtures/tickets.xml
|
130
|
+
- spec/fixtures/tickets/2.xml
|
131
|
+
- spec/fixtures/tickets/5.xml
|
132
|
+
- spec/fixtures/tickets/create.xml
|
133
|
+
- spec/projects_spec.rb
|
125
134
|
- spec/spec.opts
|
126
135
|
- spec/spec_helper.rb
|
127
136
|
- spec/ticketmaster-lighthouse_spec.rb
|
137
|
+
- spec/tickets_spec.rb
|
128
138
|
- ticketmaster-lighthouse.gemspec
|
129
139
|
has_rdoc: true
|
130
140
|
homepage: http://github.com/kiafaldorius/ticketmaster-lighthouse
|
@@ -161,5 +171,8 @@ signing_key:
|
|
161
171
|
specification_version: 3
|
162
172
|
summary: Ticketmaster Provider for Lighthouse
|
163
173
|
test_files:
|
174
|
+
- spec/comments_spec.rb
|
175
|
+
- spec/projects_spec.rb
|
164
176
|
- spec/spec_helper.rb
|
165
177
|
- spec/ticketmaster-lighthouse_spec.rb
|
178
|
+
- spec/tickets_spec.rb
|