turingstudio-basecamp-rb 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Basecamp #:nodoc:
2
- VERSION = '0.0.2'
3
- end
2
+ VERSION = '0.0.3'
3
+ end
data/lib/basecamp.rb CHANGED
@@ -13,7 +13,7 @@ require 'basecamp/attachment'
13
13
  require 'basecamp/comment'
14
14
  require 'basecamp/company'
15
15
  require 'basecamp/connection'
16
- require 'basecamp/file_category'
16
+ require 'basecamp/attachment_category'
17
17
  require 'basecamp/message'
18
18
  require 'basecamp/milestone'
19
19
  require 'basecamp/project'
@@ -34,4 +34,4 @@ class Hash
34
34
  def to_legacy_xml
35
35
  XmlSimple.xml_out({:request => self}, 'keeproot' => true, 'noattr' => true)
36
36
  end
37
- end
37
+ end
@@ -6,8 +6,8 @@ describe Basecamp::Attachment do
6
6
  end
7
7
 
8
8
  it "should create attachments for comment" do
9
- a1 = Basecamp::Attachment.create('test1', File.read(File.dirname(__FILE__) + '/../fixtures/attachment1'))
10
- a2 = Basecamp::Attachment.create('test2', File.read(File.dirname(__FILE__) + '/../fixtures/attachment2'))
9
+ a1 = Basecamp::Attachment.create('test1', File.read(File.dirname(__FILE__) + '/../../fixtures/attachment1'))
10
+ a2 = Basecamp::Attachment.create('test2', File.read(File.dirname(__FILE__) + '/../../fixtures/attachment2'))
11
11
 
12
12
  comment = Basecamp::Comment.new(:post_id => TEST_MESSAGE_ID)
13
13
  comment.body = "test comment with attachment"
@@ -1,10 +1,16 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
2
 
3
3
  describe Basecamp::Base do
4
- before(:each) do
4
+ before(:all) do
5
5
  establish_connection
6
+ @todo = create_todo_list_for_project_with_todo(TEST_PROJECT_ID)
7
+ @todo_list_id = @todo.todo_list_id
6
8
  end
7
-
9
+
10
+ after(:all) do
11
+ Basecamp::TodoList.delete(@todo_list_id)
12
+ end
13
+
8
14
  describe "Creating a resource" do
9
15
  it "should create a comment for post" do
10
16
  comment = Basecamp::Comment.new(:post_id => TEST_MESSAGE_ID)
@@ -37,8 +43,7 @@ describe Basecamp::Base do
37
43
 
38
44
  describe "Deleting a Resource" do
39
45
  it "should delete todo item" do
40
- todo = Basecamp::TodoItem.create(:todo_list_id => TEST_TODO_LIST_ID, :content => 'Todo for destroy')
41
- Basecamp::TodoItem.delete(todo.id)
46
+ Basecamp::TodoItem.delete(@todo.id)
42
47
  end
43
48
  end
44
49
  end
@@ -3,21 +3,24 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
3
3
  describe Basecamp::TimeEntry do
4
4
  before(:all) do
5
5
  establish_connection
6
+ @todo = create_todo_list_for_project_with_todo(TEST_PROJECT_ID)
7
+ @entry = create_time_entries_for_project_and_todo_item(TEST_PROJECT_ID, @todo.id)
6
8
  end
7
9
 
8
10
  it "should return all time entries" do
9
11
  entries = Basecamp::TimeEntry.report
12
+ entries.should_not be_blank
10
13
  entries.should be_kind_of(Array)
11
14
  end
12
15
 
13
16
  it "should return all time entries for a specified project" do
14
17
  entries = Basecamp::TimeEntry.all(TEST_PROJECT_ID)
18
+ entries.should_not be_blank
15
19
  entries.should be_kind_of(Array)
16
20
  end
17
-
18
- # it "should return parent todo item" do
19
- # entry = Basecamp::TimeEntry.find()
20
- # entry.todo_item.should_not be_blank
21
- # entry.todo_item.class.to_s.should == 'Basecamp::TodoItem'
22
- # end
21
+
22
+ it "should return parent todo item" do
23
+ @entry.todo_item.should_not be_blank
24
+ @entry.todo_item.class.to_s.should == 'Basecamp::TodoItem'
25
+ end
23
26
  end
@@ -19,10 +19,9 @@ describe Basecamp::TodoItem do
19
19
  @todo.comments.should be_kind_of(Array)
20
20
  end
21
21
 
22
- # it "should return array of time entries" do
23
- # todo.time_entries.should_not be_blank
24
- # todo.time_entries.should be_kind_of(Array)
25
- # end
22
+ it "should return array of time entries" do
23
+ @todo.time_entries.should be_kind_of(Array)
24
+ end
26
25
 
27
26
  it "should complete todo item" do
28
27
  @todo.complete!
data/spec/spec_helper.rb CHANGED
@@ -8,16 +8,15 @@ end
8
8
 
9
9
  require File.dirname(__FILE__) + '/../lib/basecamp'
10
10
 
11
- SITE_URL = 'flatsoft.grouphub.com'
12
- LOGIN = 'alexey.panin'
13
- PASSWORD = '5721955'
11
+ SITE_URL = ''
12
+ LOGIN = ''
13
+ PASSWORD = ''
14
14
  USE_SSL = true
15
15
 
16
- TEST_PROJECT_ID = 2971868
17
- TEST_MESSAGE_ID = 20216236 # TEST_MESSAGE SHOULD BELONG TO TEST PROJECT!!!
18
- TEST_COMPANY_ID = 1040098
19
- TEST_PERSON_ID = 2766635
20
- TEST_TODO_LIST_ID = 5576947
16
+ TEST_PROJECT_ID =
17
+ TEST_MESSAGE_ID = # TEST_MESSAGE SHOULD BELONG TO TEST PROJECT!!!
18
+ TEST_COMPANY_ID =
19
+ TEST_PERSON_ID =
21
20
 
22
21
  def establish_connection
23
22
  Basecamp::Base.establish_connection!(SITE_URL, LOGIN, PASSWORD, USE_SSL)
@@ -34,10 +33,29 @@ def delete_comments_for_message(id)
34
33
  message.comments.each {|c| Basecamp::Comment.delete(c.id)}
35
34
  end
36
35
 
37
- def delete_time_entries_for_project(id)
38
- entry = Basecamp::Project.find(id)
39
- message.comments.each {|c| Basecamp::Comment.delete(c.id)}
40
- end
36
+ def create_time_entries_for_project_and_todo_item(project_id, todo_id)
37
+ Basecamp::TimeEntry.create(
38
+ :project_id => project_id,
39
+ :person_id => TEST_PERSON_ID,
40
+ :date => Time.now,
41
+ :hours => '1.00',
42
+ :description => 'test time entry'
43
+ )
44
+
45
+ entry = Basecamp::TimeEntry.create(
46
+ :todo_item_id => todo_id,
47
+ :person_id => TEST_PERSON_ID,
48
+ :date => Time.now,
49
+ :hours => '1.00',
50
+ :description => 'test time entry'
51
+ )
52
+ entry.todo_item_id = todo_id
53
+ entry
54
+ end
55
+
56
+ def delete_time_entries_for_project(project_id)
57
+ Basecamp::TimeEntry.all(project_id).each{ |entry| entry.destroy }
58
+ end
41
59
 
42
60
  def create_todo_list_for_project_with_todo(id)
43
61
  todo_list = Basecamp::TodoList.create(
@@ -53,17 +71,11 @@ def create_todo_list_for_project_with_todo(id)
53
71
  comment = Basecamp::Comment.new(:todo_item_id => todo.id)
54
72
  comment.body = "test comment"
55
73
  comment.save
56
-
74
+
57
75
  todo.todo_list_id = todo_list.id
58
76
  todo
59
77
  end
60
78
 
61
- def create_pending_and_finished_lists(id)
62
- list1 = Basecamp::TodoList.create(:project_id => id, :tracked => true, :description => 'private1', :private => false)
63
- list2 = Basecamp::TodoList.create(:project_id => id, :tracked => true, :description => 'private2', :private => false)
64
- [ list1.id, list2.id ]
65
- end
66
-
67
79
  def create_milestone_for_project(id)
68
80
  Basecamp::Milestone.create(TEST_PROJECT_ID,
69
81
  :title => 'new',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turingstudio-basecamp-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Turing Studio, Inc.
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-03 00:00:00 -08:00
12
+ date: 2009-03-04 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -92,9 +92,8 @@ files:
92
92
  has_rdoc: true
93
93
  homepage: http://github.com/turingstudio/basecamp-rb/
94
94
  post_install_message:
95
- rdoc_options:
96
- - --main
97
- - README.rdoc
95
+ rdoc_options: []
96
+
98
97
  require_paths:
99
98
  - lib
100
99
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -111,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
110
  version:
112
111
  requirements: []
113
112
 
114
- rubyforge_project: basecamp-rb
113
+ rubyforge_project:
115
114
  rubygems_version: 1.2.0
116
115
  signing_key:
117
116
  specification_version: 2