pivotal-tracker 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,19 +6,19 @@ module StaleFishFixtures
6
6
  end
7
7
 
8
8
  def update_project_fixture
9
- connection["/projects/59022"].get
9
+ connection["/projects/102622"].get
10
10
  end
11
11
 
12
12
  def update_stories_fixture
13
- connection["/projects/59022/stories?limit=20"].get
13
+ connection["/projects/102622/stories?limit=20"].get
14
14
  end
15
15
 
16
16
  def update_memberships_fixture
17
- connection["/projects/59022/memberships"].get
17
+ connection["/projects/102622/memberships"].get
18
18
  end
19
19
 
20
20
  def update_tasks_fixture
21
- connection["/projects/59022/stories/2606200/tasks"].get
21
+ connection["/projects/102622/stories/4459994/tasks"].get
22
22
  end
23
23
 
24
24
  def update_activity_fixture
@@ -26,33 +26,37 @@ module StaleFishFixtures
26
26
  end
27
27
 
28
28
  def update_project_activity_fixture
29
- connection["/projects/59022/activities"].get
29
+ connection["/projects/102622/activities"].get
30
30
  end
31
31
 
32
32
  def update_iterations_all_fixture
33
- connection["/projects/59022/iterations"].get
33
+ connection["/projects/102622/iterations"].get
34
34
  end
35
-
35
+
36
36
  def update_iterations_current_fixture
37
- connection["/projects/59022/iterations/current"].get
37
+ connection["/projects/102622/iterations/current"].get
38
38
  end
39
39
 
40
40
  def update_iterations_backlog_fixture
41
- connection["/projects/59022/iterations/backlog"].get
41
+ connection["/projects/102622/iterations/backlog"].get
42
42
  end
43
43
 
44
44
  def update_iterations_done_fixture
45
- connection["/projects/59022/iterations/done"].get
45
+ connection["/projects/102622/iterations/done"].get
46
46
  end
47
47
 
48
48
  def create_new_story
49
- connection["/projects/59022/stories"].post("<story><name>Create stuff</name></story>", :content_type => 'application/xml')
49
+ connection["/projects/102622/stories"].post("<story><name>Create stuff</name></story>", :content_type => 'application/xml')
50
50
  end
51
-
51
+
52
52
  def update_notes_fixture
53
- connection["/projects/59022/stories/2524689/notes"].get
53
+ connection["/projects/102622/stories/4460038/notes"].get
54
54
  end
55
55
 
56
+ # def upload_attachment_fixture
57
+ # connection["/projects/102622/stories/4473735/attachments"].post(:Filedata => File.new(File.dirname(__FILE__) + '/../../LICENSE'))
58
+ # end
59
+
56
60
  protected
57
61
 
58
62
  def connection
@@ -0,0 +1,62 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe PivotalTracker::Attachment do
4
+
5
+ before do
6
+ PivotalTracker::Client.token = TOKEN
7
+ @project = PivotalTracker::Project.find(102622)
8
+ @story = @project.stories.find(4460598)
9
+ end
10
+
11
+ context "always" do
12
+ it "should return an integer id" do
13
+ @story.attachments.first.id.should be_a(Integer)
14
+ end
15
+
16
+ it "should return a string for url" do
17
+ @story.attachments.first.url.should be_a(String)
18
+ end
19
+
20
+ it "should return a string for filename" do
21
+ @story.attachments.first.filename.should be_a(String)
22
+ end
23
+
24
+ it "should return a string for uploaded_by" do
25
+ @story.attachments.first.uploaded_by.should be_a(String)
26
+ end
27
+
28
+ it "should return a datetime for uploaded_at" do
29
+ @story.attachments.first.uploaded_at.should be_a(DateTime)
30
+ end
31
+ end
32
+
33
+ context "without description" do
34
+ it "should have a blank string for the description" do
35
+ @story.attachments.first.description.should be_a(String)
36
+ @story.attachments.first.description.should be_blank
37
+ end
38
+ end
39
+
40
+ context "with description" do
41
+ it "should have a non-blank string for the description" do
42
+ @story.attachments.first.description.should be_a(String)
43
+ @story.attachments.last.description.should_not be_blank
44
+ end
45
+ end
46
+
47
+ context "uploading" do
48
+
49
+ before do
50
+ @target_story = @project.stories.find(4473735)
51
+ @orig_net_lock = FakeWeb.allow_net_connect?
52
+ end
53
+
54
+ it "should return an attachment object with a pending status" do
55
+ FakeWeb.allow_net_connect = true
56
+ resource = @target_story.upload_attachment(File.dirname(__FILE__) + '/../../../LICENSE')
57
+ FakeWeb.allow_net_connect = @orig_net_lock
58
+ resource.should be_a(PivotalTracker::Attachment)
59
+ resource.status.should == 'Pending'
60
+ end
61
+ end
62
+ end
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
2
 
3
3
  describe PivotalTracker::Project do
4
4
  before do
5
- @project = PivotalTracker::Project.find(59022)
5
+ @project = PivotalTracker::Project.find(102622)
6
6
  end
7
7
 
8
8
  context ".all" do
@@ -14,7 +14,7 @@ describe PivotalTracker::Project do
14
14
 
15
15
  context ".find" do
16
16
  it "should return the given membership" do
17
- @project.memberships.find(207328).should be_a(PivotalTracker::Membership)
17
+ @project.memberships.find(331832).should be_a(PivotalTracker::Membership)
18
18
  end
19
19
  end
20
20
  end
@@ -2,8 +2,8 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
2
 
3
3
  describe PivotalTracker::Note do
4
4
  before do
5
- @project = PivotalTracker::Project.find(59022)
6
- @story = @project.stories.find(2524689)
5
+ @project = PivotalTracker::Project.find(102622)
6
+ @story = @project.stories.find(4460038)
7
7
  end
8
8
 
9
9
  context ".all" do
@@ -18,7 +18,7 @@ describe PivotalTracker::Note do
18
18
  # @story.tasks.find(179025).should be_a(PivotalTracker::Task)
19
19
  # end
20
20
  #end
21
-
21
+
22
22
  context ".create" do
23
23
  it "should return the created note" do
24
24
  @story.notes.create(:text => 'Test note')
@@ -26,29 +26,29 @@ describe PivotalTracker::Note do
26
26
  end
27
27
 
28
28
  context ".new" do
29
-
29
+
30
30
  def note_for(attrs)
31
31
  note = @story.notes.new(attrs)
32
32
  @note = Hash.from_xml(note.send(:to_xml))['note']
33
33
  end
34
-
34
+
35
35
  describe "attributes that are not sent to the tracker" do
36
-
36
+
37
37
  it "should include id" do
38
38
  note_for(:id => 10)["id"].should be_nil
39
39
  end
40
-
40
+
41
41
  it "should include author" do
42
42
  note_for(:author => "somebody")["author"].should be_nil
43
43
  end
44
-
44
+
45
45
  end
46
-
46
+
47
47
  describe "attributes that are sent to the tracker" do
48
-
48
+
49
49
  it "should include text" do
50
50
  note_for(:text => "A comment...")["text"].should == "A comment..."
51
- end
51
+ end
52
52
 
53
53
  it "should include noted_at" do
54
54
  note_for(:noted_at => "timestamp")["noted_at"].should == "timestamp"
@@ -17,17 +17,25 @@ describe PivotalTracker::Project do
17
17
 
18
18
  context ".find" do
19
19
  before do
20
- @project = PivotalTracker::Project.find(59022)
20
+ @project = PivotalTracker::Project.find(102622)
21
21
  end
22
22
 
23
23
  it "should be an instance of Project" do
24
24
  @project.should be_a(PivotalTracker::Project)
25
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
26
34
  end
27
35
 
28
36
  context ".stories" do
29
37
  before do
30
- @project = PivotalTracker::Project.find(59022)
38
+ @project = PivotalTracker::Project.find(102622)
31
39
  end
32
40
 
33
41
  it "should have a stories association" do
@@ -37,7 +45,7 @@ describe PivotalTracker::Project do
37
45
 
38
46
  context ".memberships" do
39
47
  before do
40
- @project = PivotalTracker::Project.find(59022)
48
+ @project = PivotalTracker::Project.find(102622)
41
49
  end
42
50
 
43
51
  it "should have a memberships association" do
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
2
 
3
3
  describe PivotalTracker::Story do
4
4
  before do
5
- @project = PivotalTracker::Project.find(59022)
5
+ @project = PivotalTracker::Project.find(102622)
6
6
  end
7
7
 
8
8
  context ".all" do
@@ -14,7 +14,7 @@ describe PivotalTracker::Story do
14
14
 
15
15
  context ".find" do
16
16
  it "should return the matching story" do
17
- @project.stories.find(2524690).should be_a(PivotalTracker::Story)
17
+ @project.stories.find(4459994).should be_a(PivotalTracker::Story)
18
18
  end
19
19
  end
20
20
 
@@ -23,39 +23,84 @@ describe PivotalTracker::Story do
23
23
  @project.stories.create(:name => 'Create Stuff').should be_a(PivotalTracker::Story)
24
24
  end
25
25
  end
26
-
26
+
27
+ context ".attachments" do
28
+ it "should return an array of attachments" do
29
+ @story = @project.stories.find(4460598)
30
+ @story.attachments.should be_a(Array)
31
+ @story.attachments.first.should be_a(PivotalTracker::Attachment)
32
+ end
33
+ end
34
+
35
+ context ".move_to_project" do
36
+ before(:each) do
37
+ @orig_net_lock = FakeWeb.allow_net_connect?
38
+ FakeWeb.allow_net_connect = true
39
+ @target_project = PivotalTracker::Project.find(103014)
40
+ @movable_story = @project.stories.find(4490874)
41
+ end
42
+
43
+ it "should return an updated story from the target project when passed a PivotalTracker::Story" do
44
+ target_story = @target_project.stories.find(4477972)
45
+ response = @movable_story.move_to_project(target_story)
46
+ response.project_id.should == target_story.project_id
47
+ end
48
+
49
+ it "should return an updated story from the target project when passed a PivotalTracker::Project" do
50
+ response = @movable_story.move_to_project(@target_project)
51
+ response.project_id.should == @target_project.id
52
+ end
53
+
54
+ it "should return an updated story from the target project when passed a String" do
55
+ response = @movable_story.move_to_project('103014')
56
+ response.project_id.should == 103014
57
+ end
58
+
59
+ it "should return an updated story from the target project when passed an Integer"do
60
+ response = @movable_story.move_to_project(103014)
61
+ response.project_id.should == 103014
62
+ end
63
+
64
+ after (:each) do
65
+ @movable_story = @target_project.stories.find(4490874)
66
+ response = @movable_story.move_to_project(102622)
67
+ FakeWeb.allow_net_connect = @orig_net_lock
68
+ response.project_id.should == 102622
69
+ end
70
+ end
71
+
27
72
  context ".new" do
28
-
73
+
29
74
  def story_for(attrs)
30
75
  story = @project.stories.new(attrs)
31
76
  @story = Hash.from_xml(story.send(:to_xml))['story']
32
77
  end
33
-
78
+
34
79
  describe "attributes that are not sent to the tracker" do
35
-
80
+
36
81
  it "should include id" do
37
82
  story_for(:id => 10)["id"].should be_nil
38
83
  end
39
-
84
+
40
85
  it "should include url" do
41
86
  story_for(:url => "somewhere")["url"].should be_nil
42
87
  end
43
-
88
+
44
89
  it "should include created_at" do
45
90
  story_for(:created_at => Time.now)["created_at"].should be_nil
46
91
  end
47
-
92
+
48
93
  it "should include accepted_at" do
49
94
  story_for(:accepted_at => Time.now)["accepted_at"].should be_nil
50
95
  end
51
-
96
+
52
97
  end
53
-
98
+
54
99
  describe "attributes that are sent to the tracker" do
55
-
100
+
56
101
  it "should include name" do
57
102
  story_for(:name => "A user should...")["name"].should == "A user should..."
58
- end
103
+ end
59
104
 
60
105
  it "should include description" do
61
106
  story_for(:description => "desc...")["description"].should == "desc..."
@@ -64,40 +109,44 @@ describe PivotalTracker::Story do
64
109
  it "should include story_type" do
65
110
  story_for(:story_type => "feature")["story_type"].should == "feature"
66
111
  end
67
-
112
+
68
113
  it "should include estimate" do
69
114
  story_for(:estimate => 5)["estimate"].should == "5"
70
- end
71
-
115
+ end
116
+
72
117
  it "should include current_state" do
73
118
  story_for(:current_state => "accepted")["current_state"].should == "accepted"
74
119
  end
75
-
120
+
76
121
  it "should include requested_by" do
77
122
  story_for(:requested_by => "Joe Doe")["requested_by"].should == "Joe Doe"
78
123
  end
79
-
124
+
80
125
  it "should include owned_by" do
81
126
  story_for(:owned_by => "Joe Doe")["owned_by"].should == "Joe Doe"
82
127
  end
83
-
128
+
84
129
  it "should include labels" do
85
130
  story_for(:labels => "abc")["labels"].should == "abc"
86
131
  end
87
-
132
+
88
133
  it "should include other_id" do
89
134
  story_for(:other_id => 10)["other_id"].should == "10"
90
- end
91
-
135
+ end
136
+
137
+ it "should include integration_id" do
138
+ story_for(:integration_id => 1000)["integration_id"].should == '1000'
139
+ end
140
+
92
141
  # the tracker returns 422 when this is included, even if it is not used
93
142
  # it "should include jira_id" do
94
143
  # story_for(:jira_id => 10)["jira_id"].should == "10"
95
144
  # end
96
- #
145
+ #
97
146
  # it "should include jira_url" do
98
147
  # story_for(:jira_url => "somewhere")["jira_url"].should == "somewhere"
99
148
  # end
100
-
149
+
101
150
  end
102
151
 
103
152
  end
@@ -2,8 +2,8 @@ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
2
 
3
3
  describe PivotalTracker::Task do
4
4
  before do
5
- @project = PivotalTracker::Project.find(59022)
6
- @story = @project.stories.find(2606200)
5
+ @project = PivotalTracker::Project.find(102622)
6
+ @story = @project.stories.find(4459994)
7
7
  end
8
8
 
9
9
  context ".all" do
@@ -15,7 +15,7 @@ describe PivotalTracker::Task do
15
15
 
16
16
  context ".find" do
17
17
  it "should return a given task" do
18
- @story.tasks.find(179025).should be_a(PivotalTracker::Task)
18
+ @story.tasks.find(468113).should be_a(PivotalTracker::Task)
19
19
  end
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-tracker
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 2
8
- - 0
9
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Justin Smestad
@@ -16,63 +17,132 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-07-05 00:00:00 -06:00
20
+ date: 2010-08-07 00:00:00 -06:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
- type: :runtime
24
24
  name: rest-client
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
26
28
  requirements:
27
29
  - - ~>
28
30
  - !ruby/object:Gem::Version
31
+ hash: 15
29
32
  segments:
30
33
  - 1
31
- - 5
32
- - 1
33
- version: 1.5.1
34
- requirement: *id001
35
- prerelease: false
36
- - !ruby/object:Gem::Dependency
34
+ - 6
35
+ - 0
36
+ version: 1.6.0
37
37
  type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
38
40
  name: happymapper
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
40
44
  requirements:
41
45
  - - ">="
42
46
  - !ruby/object:Gem::Version
47
+ hash: 23
43
48
  segments:
44
49
  - 0
50
+ - 3
45
51
  - 2
46
- - 4
47
- version: 0.2.4
48
- requirement: *id002
49
- prerelease: false
50
- - !ruby/object:Gem::Dependency
52
+ version: 0.3.2
51
53
  type: :runtime
54
+ version_requirements: *id002
55
+ - !ruby/object:Gem::Dependency
52
56
  name: builder
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ prerelease: false
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
54
60
  requirements:
55
61
  - - ">="
56
62
  - !ruby/object:Gem::Version
63
+ hash: 3
57
64
  segments:
58
65
  - 0
59
66
  version: "0"
60
- requirement: *id003
61
- prerelease: false
62
- - !ruby/object:Gem::Dependency
63
67
  type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
64
70
  name: nokogiri
65
- version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ~>
68
76
  - !ruby/object:Gem::Version
77
+ hash: 113
69
78
  segments:
70
79
  - 1
71
80
  - 4
81
+ - 3
72
82
  - 1
73
- version: 1.4.1
74
- requirement: *id004
83
+ version: 1.4.3.1
84
+ type: :runtime
85
+ version_requirements: *id004
86
+ - !ruby/object:Gem::Dependency
87
+ name: rspec
75
88
  prerelease: false
89
+ requirement: &id005 !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ type: :development
99
+ version_requirements: *id005
100
+ - !ruby/object:Gem::Dependency
101
+ name: bundler
102
+ prerelease: false
103
+ requirement: &id006 !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 15
109
+ segments:
110
+ - 0
111
+ - 9
112
+ - 26
113
+ version: 0.9.26
114
+ type: :development
115
+ version_requirements: *id006
116
+ - !ruby/object:Gem::Dependency
117
+ name: jeweler
118
+ prerelease: false
119
+ requirement: &id007 !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ type: :development
129
+ version_requirements: *id007
130
+ - !ruby/object:Gem::Dependency
131
+ name: stale_fish
132
+ prerelease: false
133
+ requirement: &id008 !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ hash: 27
139
+ segments:
140
+ - 1
141
+ - 3
142
+ - 0
143
+ version: 1.3.0
144
+ type: :development
145
+ version_requirements: *id008
76
146
  description:
77
147
  email: justin.smestad@gmail.com
78
148
  executables: []
@@ -85,12 +155,14 @@ extra_rdoc_files:
85
155
  files:
86
156
  - .gitignore
87
157
  - Gemfile
158
+ - Gemfile.lock
88
159
  - LICENSE
89
160
  - README.rdoc
90
161
  - Rakefile
91
162
  - VERSION
92
163
  - lib/pivotal-tracker.rb
93
164
  - lib/pivotal-tracker/activity.rb
165
+ - lib/pivotal-tracker/attachment.rb
94
166
  - lib/pivotal-tracker/client.rb
95
167
  - lib/pivotal-tracker/extensions.rb
96
168
  - lib/pivotal-tracker/iteration.rb
@@ -121,6 +193,7 @@ files:
121
193
  - spec/spec_helper.rb
122
194
  - spec/support/stale_fish_fixtures.rb
123
195
  - spec/unit/pivotal-tracker/activity_spec.rb
196
+ - spec/unit/pivotal-tracker/attachment_spec.rb
124
197
  - spec/unit/pivotal-tracker/iteration_spec.rb
125
198
  - spec/unit/pivotal-tracker/membership_spec.rb
126
199
  - spec/unit/pivotal-tracker/note_spec.rb
@@ -137,23 +210,27 @@ rdoc_options:
137
210
  require_paths:
138
211
  - lib
139
212
  required_ruby_version: !ruby/object:Gem::Requirement
213
+ none: false
140
214
  requirements:
141
215
  - - ">="
142
216
  - !ruby/object:Gem::Version
217
+ hash: 3
143
218
  segments:
144
219
  - 0
145
220
  version: "0"
146
221
  required_rubygems_version: !ruby/object:Gem::Requirement
222
+ none: false
147
223
  requirements:
148
224
  - - ">="
149
225
  - !ruby/object:Gem::Version
226
+ hash: 3
150
227
  segments:
151
228
  - 0
152
229
  version: "0"
153
230
  requirements: []
154
231
 
155
232
  rubyforge_project:
156
- rubygems_version: 1.3.6
233
+ rubygems_version: 1.3.7
157
234
  signing_key:
158
235
  specification_version: 3
159
236
  summary: Ruby wrapper for the Pivotal Tracker API
@@ -161,6 +238,7 @@ test_files:
161
238
  - spec/spec_helper.rb
162
239
  - spec/support/stale_fish_fixtures.rb
163
240
  - spec/unit/pivotal-tracker/activity_spec.rb
241
+ - spec/unit/pivotal-tracker/attachment_spec.rb
164
242
  - spec/unit/pivotal-tracker/iteration_spec.rb
165
243
  - spec/unit/pivotal-tracker/membership_spec.rb
166
244
  - spec/unit/pivotal-tracker/note_spec.rb