tsenart-pivotal-tracker 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/Gemfile +16 -0
  2. data/Gemfile.lock +48 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +77 -0
  5. data/Rakefile +50 -0
  6. data/VERSION +1 -0
  7. data/lib/pivotal-tracker/activity.rb +46 -0
  8. data/lib/pivotal-tracker/attachment.rb +16 -0
  9. data/lib/pivotal-tracker/client.rb +41 -0
  10. data/lib/pivotal-tracker/extensions.rb +11 -0
  11. data/lib/pivotal-tracker/iteration.rb +34 -0
  12. data/lib/pivotal-tracker/membership.rb +20 -0
  13. data/lib/pivotal-tracker/note.rb +58 -0
  14. data/lib/pivotal-tracker/project.rb +58 -0
  15. data/lib/pivotal-tracker/proxy.rb +66 -0
  16. data/lib/pivotal-tracker/story.rb +148 -0
  17. data/lib/pivotal-tracker/task.rb +53 -0
  18. data/lib/pivotal-tracker/validation.rb +68 -0
  19. data/lib/pivotal-tracker.rb +40 -0
  20. data/lib/pivotal_tracker.rb +2 -0
  21. data/pivotal-tracker.gemspec +121 -0
  22. data/spec/fixtures/activity.xml +177 -0
  23. data/spec/fixtures/created_note.xml +14 -0
  24. data/spec/fixtures/created_story.xml +14 -0
  25. data/spec/fixtures/iterations_all.xml +237 -0
  26. data/spec/fixtures/iterations_backlog.xml +163 -0
  27. data/spec/fixtures/iterations_current.xml +47 -0
  28. data/spec/fixtures/iterations_done.xml +33 -0
  29. data/spec/fixtures/memberships.xml +42 -0
  30. data/spec/fixtures/notes.xml +33 -0
  31. data/spec/fixtures/project.xml +51 -0
  32. data/spec/fixtures/project_activity.xml +177 -0
  33. data/spec/fixtures/projects.xml +103 -0
  34. data/spec/fixtures/stale_fish.yml +100 -0
  35. data/spec/fixtures/stories.xml +293 -0
  36. data/spec/fixtures/tasks.xml +24 -0
  37. data/spec/spec.opts +1 -0
  38. data/spec/spec_helper.rb +31 -0
  39. data/spec/support/stale_fish_fixtures.rb +67 -0
  40. data/spec/unit/pivotal-tracker/activity_spec.rb +32 -0
  41. data/spec/unit/pivotal-tracker/attachment_spec.rb +62 -0
  42. data/spec/unit/pivotal-tracker/client_spec.rb +87 -0
  43. data/spec/unit/pivotal-tracker/iteration_spec.rb +52 -0
  44. data/spec/unit/pivotal-tracker/membership_spec.rb +20 -0
  45. data/spec/unit/pivotal-tracker/note_spec.rb +61 -0
  46. data/spec/unit/pivotal-tracker/project_spec.rb +55 -0
  47. data/spec/unit/pivotal-tracker/story_spec.rb +185 -0
  48. data/spec/unit/pivotal-tracker/task_spec.rb +21 -0
  49. metadata +236 -0
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe PivotalTracker::Note do
4
+ before do
5
+ @project = PivotalTracker::Project.find(102622)
6
+ @story = @project.stories.find(4460038)
7
+ end
8
+
9
+ context ".all" do
10
+ it "should return an array of notes" do
11
+ @story.notes.all.should be_a(Array)
12
+ @story.notes.all.first.should be_a(PivotalTracker::Note)
13
+ end
14
+ end
15
+
16
+ #context ".find" do
17
+ # it "should return a given task" do
18
+ # @story.tasks.find(179025).should be_a(PivotalTracker::Task)
19
+ # end
20
+ #end
21
+
22
+ context ".create" do
23
+ it "should return the created note" do
24
+ @story.notes.create(:text => 'Test note')
25
+ end
26
+ end
27
+
28
+ context ".new" do
29
+
30
+ def note_for(attrs)
31
+ note = @story.notes.new(attrs)
32
+ @note = Hash.from_xml(note.send(:to_xml))['note']
33
+ end
34
+
35
+ describe "attributes that are not sent to the tracker" do
36
+
37
+ it "should include id" do
38
+ note_for(:id => 10)["id"].should be_nil
39
+ end
40
+
41
+ it "should include author" do
42
+ note_for(:author => "somebody")["author"].should be_nil
43
+ end
44
+
45
+ end
46
+
47
+ describe "attributes that are sent to the tracker" do
48
+
49
+ it "should include text" do
50
+ note_for(:text => "A comment...")["text"].should == "A comment..."
51
+ end
52
+
53
+ it "should include noted_at" do
54
+ note_for(:noted_at => "timestamp")["noted_at"].should == "timestamp"
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe PivotalTracker::Project do
4
+ context ".all" do
5
+ before do
6
+ @projects = PivotalTracker::Project.all
7
+ end
8
+
9
+ it "should return an array of available projects" do
10
+ @projects.should be_a(Array)
11
+ end
12
+
13
+ it "should be a project instance" do
14
+ @projects.first.should be_a(PivotalTracker::Project)
15
+ end
16
+ end
17
+
18
+ context ".find" do
19
+ before do
20
+ @project = PivotalTracker::Project.find(102622)
21
+ end
22
+
23
+ it "should be an instance of Project" do
24
+ @project.should be_a(PivotalTracker::Project)
25
+ end
26
+
27
+ it "should have a use_https attribute" do
28
+ @project.respond_to?(:use_https).should be_true
29
+ end
30
+
31
+ it "should have false for use_https" do
32
+ @project.use_https.should be_false
33
+ end
34
+ end
35
+
36
+ context ".stories" do
37
+ before do
38
+ @project = PivotalTracker::Project.find(102622)
39
+ end
40
+
41
+ it "should have a stories association" do
42
+ @project.respond_to?(:stories).should be_true
43
+ end
44
+ end
45
+
46
+ context ".memberships" do
47
+ before do
48
+ @project = PivotalTracker::Project.find(102622)
49
+ end
50
+
51
+ it "should have a memberships association" do
52
+ @project.respond_to?(:memberships).should be_true
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,185 @@
1
+ require 'spec_helper'
2
+
3
+ describe PivotalTracker::Story do
4
+ before do
5
+ @project = PivotalTracker::Project.find(102622)
6
+ end
7
+
8
+ context ".all" do
9
+ it "should return all stories" do
10
+ @project.stories.all.should be_a(Array)
11
+ @project.stories.all.first.should be_a(PivotalTracker::Story)
12
+ end
13
+ end
14
+
15
+ context ".find" do
16
+ it "should return the matching story" do
17
+ @project.stories.find(4459994).should be_a(PivotalTracker::Story)
18
+ end
19
+ end
20
+
21
+ context ".create" do
22
+ it "should return the created story" do
23
+ @project.stories.create(:name => 'Create Stuff').should be_a(PivotalTracker::Story)
24
+ end
25
+
26
+ context "on failure" do
27
+ before do
28
+ FakeWeb.register_uri(:post, "http://www.pivotaltracker.com/services/v3/projects/#{@project.id}/stories",
29
+ :body => %{<?xml version="1.0" encoding="UTF-8"?>
30
+ <errors>
31
+ <error>error#1 message</error>
32
+ <error>error#2 message</error>
33
+ </errors>%},
34
+ :status => "422")
35
+ end
36
+
37
+ it "should not raise an exception" do
38
+ expect { @project.stories.create }.to_not raise_error(Exception)
39
+ end
40
+
41
+ it "should report errors encountered" do
42
+ story = @project.stories.create :name => "Invalid story"
43
+ story.errors.messages.should =~ ["error#1 message", "error#2 message"]
44
+ end
45
+ end
46
+ end
47
+
48
+ context ".attachments" do
49
+ it "should return an array of attachments" do
50
+ @story = @project.stories.find(4460598)
51
+ @story.attachments.should be_a(Array)
52
+ @story.attachments.first.should be_a(PivotalTracker::Attachment)
53
+ end
54
+ end
55
+
56
+ context ".move_to_project" do
57
+ before(:each) do
58
+ @orig_net_lock = FakeWeb.allow_net_connect?
59
+ FakeWeb.allow_net_connect = true
60
+ @target_project = PivotalTracker::Project.find(103014)
61
+ @movable_story = @project.stories.find(4490874)
62
+ end
63
+
64
+ it "should return an updated story from the target project when passed a PivotalTracker::Story" do
65
+ target_story = @target_project.stories.find(4477972)
66
+ response = @movable_story.move_to_project(target_story)
67
+ response.project_id.should == target_story.project_id
68
+ end
69
+
70
+ it "should return an updated story from the target project when passed a PivotalTracker::Project" do
71
+ response = @movable_story.move_to_project(@target_project)
72
+ response.project_id.should == @target_project.id
73
+ end
74
+
75
+ it "should return an updated story from the target project when passed a String" do
76
+ response = @movable_story.move_to_project('103014')
77
+ response.project_id.should == 103014
78
+ end
79
+
80
+ it "should return an updated story from the target project when passed an Integer"do
81
+ response = @movable_story.move_to_project(103014)
82
+ response.project_id.should == 103014
83
+ end
84
+
85
+ after (:each) do
86
+ @movable_story = @target_project.stories.find(4490874)
87
+ response = @movable_story.move_to_project(102622)
88
+ FakeWeb.allow_net_connect = @orig_net_lock
89
+ response.project_id.should == 102622
90
+ end
91
+ end
92
+
93
+ context ".new" do
94
+
95
+ def story_for(attrs)
96
+ story = @project.stories.new(attrs)
97
+ @story = Hash.from_xml(story.send(:to_xml))['story']
98
+ end
99
+
100
+ describe "attributes that are not sent to the tracker" do
101
+
102
+ it "should include id" do
103
+ story_for(:id => 10)["id"].should be_nil
104
+ end
105
+
106
+ it "should include url" do
107
+ story_for(:url => "somewhere")["url"].should be_nil
108
+ end
109
+
110
+ end
111
+
112
+ describe "attributes that are sent to the tracker" do
113
+
114
+ it "should include name" do
115
+ story_for(:name => "A user should...")["name"].should == "A user should..."
116
+ end
117
+
118
+ it "should include description" do
119
+ story_for(:description => "desc...")["description"].should == "desc..."
120
+ end
121
+
122
+ it "should include story_type" do
123
+ story_for(:story_type => "feature")["story_type"].should == "feature"
124
+ end
125
+
126
+ it "should include estimate" do
127
+ story_for(:estimate => 5)["estimate"].should == "5"
128
+ end
129
+
130
+ it "should include current_state" do
131
+ story_for(:current_state => "accepted")["current_state"].should == "accepted"
132
+ end
133
+
134
+ it "should include requested_by" do
135
+ story_for(:requested_by => "Joe Doe")["requested_by"].should == "Joe Doe"
136
+ end
137
+
138
+ it "should include owned_by" do
139
+ story_for(:owned_by => "Joe Doe")["owned_by"].should == "Joe Doe"
140
+ end
141
+
142
+ it "should include labels" do
143
+ story_for(:labels => "abc")["labels"].should == "abc"
144
+ end
145
+
146
+ it "should include other_id" do
147
+ story_for(:other_id => 10)["other_id"].should == "10"
148
+ end
149
+
150
+ it "should include integration_id" do
151
+ story_for(:integration_id => 1000)["integration_id"].should == '1000'
152
+ end
153
+
154
+ # the tracker returns 422 when this is included, even if it is not used
155
+ # it "should include jira_id" do
156
+ # story_for(:jira_id => 10)["jira_id"].should == "10"
157
+ # end
158
+ #
159
+ # it "should include jira_url" do
160
+ # story_for(:jira_url => "somewhere")["jira_url"].should == "somewhere"
161
+ # end
162
+
163
+ [:created_at, :accepted_at].each do |date_attribute|
164
+ it "should include #{date_attribute} date when given a string" do
165
+ story_for(:created_at => '9/20/1984, 10:23am UTC')["created_at"].should == "1984-09-20T10:23:00+00:00"
166
+ end
167
+
168
+ it "should include #{date_attribute} date when given a Time" do
169
+ story_for(:created_at => Time.parse('9/20/1984, 10:23am UTC'))["created_at"].should == "1984-09-20T10:23:00+00:00"
170
+ end
171
+
172
+ it "should include #{date_attribute} date when given a DateTime" do
173
+ story_for(:created_at => DateTime.parse('9/20/1984, 10:23am UTC'))["created_at"].should == "1984-09-20T10:23:00+00:00"
174
+ end
175
+
176
+ it "should include #{date_attribute} date when given a Date" do
177
+ # Dates don't have time zones, but the time will be in local time, so we convert the date to create the expectation
178
+ story_for(:created_at => Date.parse('9/20/1984'))["created_at"].should == DateTime.parse('9/20/1984').to_s
179
+ end
180
+ end
181
+ end
182
+
183
+ end
184
+
185
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe PivotalTracker::Task do
4
+ before do
5
+ @project = PivotalTracker::Project.find(102622)
6
+ @story = @project.stories.find(4459994)
7
+ end
8
+
9
+ context ".all" do
10
+ it "should return an array of tasks" do
11
+ @story.tasks.all.should be_a(Array)
12
+ @story.tasks.all.first.should be_a(PivotalTracker::Task)
13
+ end
14
+ end
15
+
16
+ context ".find" do
17
+ it "should return a given task" do
18
+ @story.tasks.find(468113).should be_a(PivotalTracker::Task)
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,236 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tsenart-pivotal-tracker
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.4.0
6
+ platform: ruby
7
+ authors:
8
+ - Justin Smestad
9
+ - Josh Nichols
10
+ - Terence Lee
11
+ - "Tom\xC3\xA1s Senart"
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2011-07-07 00:00:00 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: rest-client
20
+ requirement: &id001 !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ~>
24
+ - !ruby/object:Gem::Version
25
+ version: 1.6.0
26
+ type: :runtime
27
+ prerelease: false
28
+ version_requirements: *id001
29
+ - !ruby/object:Gem::Dependency
30
+ name: happymapper
31
+ requirement: &id002 !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.3.2
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: *id002
40
+ - !ruby/object:Gem::Dependency
41
+ name: builder
42
+ requirement: &id003 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: *id003
51
+ - !ruby/object:Gem::Dependency
52
+ name: nokogiri
53
+ requirement: &id004 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ version: "1.4"
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: *id004
62
+ - !ruby/object:Gem::Dependency
63
+ name: rest-client
64
+ requirement: &id005 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.6.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: *id005
73
+ - !ruby/object:Gem::Dependency
74
+ name: happymapper
75
+ requirement: &id006 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.3.2
81
+ type: :runtime
82
+ prerelease: false
83
+ version_requirements: *id006
84
+ - !ruby/object:Gem::Dependency
85
+ name: builder
86
+ requirement: &id007 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: *id007
95
+ - !ruby/object:Gem::Dependency
96
+ name: nokogiri
97
+ requirement: &id008 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: 1.4.3.1
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: *id008
106
+ - !ruby/object:Gem::Dependency
107
+ name: rspec
108
+ requirement: &id009 !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: "0"
114
+ type: :development
115
+ prerelease: false
116
+ version_requirements: *id009
117
+ - !ruby/object:Gem::Dependency
118
+ name: bundler
119
+ requirement: &id010 !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 0.9.26
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: *id010
128
+ - !ruby/object:Gem::Dependency
129
+ name: jeweler
130
+ requirement: &id011 !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: "0"
136
+ type: :development
137
+ prerelease: false
138
+ version_requirements: *id011
139
+ - !ruby/object:Gem::Dependency
140
+ name: stale_fish
141
+ requirement: &id012 !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ~>
145
+ - !ruby/object:Gem::Version
146
+ version: 1.3.0
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: *id012
150
+ description:
151
+ email: justin.smestad@gmail.com
152
+ executables: []
153
+
154
+ extensions: []
155
+
156
+ extra_rdoc_files:
157
+ - LICENSE
158
+ - README.rdoc
159
+ files:
160
+ - Gemfile
161
+ - Gemfile.lock
162
+ - LICENSE
163
+ - README.rdoc
164
+ - Rakefile
165
+ - VERSION
166
+ - lib/pivotal-tracker.rb
167
+ - lib/pivotal-tracker/activity.rb
168
+ - lib/pivotal-tracker/attachment.rb
169
+ - lib/pivotal-tracker/client.rb
170
+ - lib/pivotal-tracker/extensions.rb
171
+ - lib/pivotal-tracker/iteration.rb
172
+ - lib/pivotal-tracker/membership.rb
173
+ - lib/pivotal-tracker/note.rb
174
+ - lib/pivotal-tracker/project.rb
175
+ - lib/pivotal-tracker/proxy.rb
176
+ - lib/pivotal-tracker/story.rb
177
+ - lib/pivotal-tracker/task.rb
178
+ - lib/pivotal-tracker/validation.rb
179
+ - lib/pivotal_tracker.rb
180
+ - pivotal-tracker.gemspec
181
+ - spec/fixtures/activity.xml
182
+ - spec/fixtures/created_note.xml
183
+ - spec/fixtures/created_story.xml
184
+ - spec/fixtures/iterations_all.xml
185
+ - spec/fixtures/iterations_backlog.xml
186
+ - spec/fixtures/iterations_current.xml
187
+ - spec/fixtures/iterations_done.xml
188
+ - spec/fixtures/memberships.xml
189
+ - spec/fixtures/notes.xml
190
+ - spec/fixtures/project.xml
191
+ - spec/fixtures/project_activity.xml
192
+ - spec/fixtures/projects.xml
193
+ - spec/fixtures/stale_fish.yml
194
+ - spec/fixtures/stories.xml
195
+ - spec/fixtures/tasks.xml
196
+ - spec/spec.opts
197
+ - spec/spec_helper.rb
198
+ - spec/support/stale_fish_fixtures.rb
199
+ - spec/unit/pivotal-tracker/activity_spec.rb
200
+ - spec/unit/pivotal-tracker/attachment_spec.rb
201
+ - spec/unit/pivotal-tracker/client_spec.rb
202
+ - spec/unit/pivotal-tracker/iteration_spec.rb
203
+ - spec/unit/pivotal-tracker/membership_spec.rb
204
+ - spec/unit/pivotal-tracker/note_spec.rb
205
+ - spec/unit/pivotal-tracker/project_spec.rb
206
+ - spec/unit/pivotal-tracker/story_spec.rb
207
+ - spec/unit/pivotal-tracker/task_spec.rb
208
+ homepage: http://github.com/tsenart/pivotal-tracker
209
+ licenses: []
210
+
211
+ post_install_message:
212
+ rdoc_options: []
213
+
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: "0"
222
+ required_rubygems_version: !ruby/object:Gem::Requirement
223
+ none: false
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: "0"
228
+ requirements: []
229
+
230
+ rubyforge_project:
231
+ rubygems_version: 1.8.5
232
+ signing_key:
233
+ specification_version: 3
234
+ summary: Ruby wrapper for the Pivotal Tracker API
235
+ test_files: []
236
+