liquidplanner 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -18,11 +18,16 @@ begin
18
18
 
19
19
  gemspec.files = FileList["[A-Z]*", "{examples,lib,test}/**/*"]
20
20
 
21
- gemspec.add_dependency 'activeresource', '~> 3.0.0'
22
- gemspec.add_dependency 'multipart-post', '>= 1.0.1'
21
+ gemspec.add_dependency 'activeresource', '~> 3.0.0', '>= 3.0.0' # Ensure that we do not use beta gems
22
+ gemspec.add_dependency 'activesupport', '~> 3.0.0', '>= 3.0.0' # Ensure that we do not use beta gems
23
+ gemspec.add_dependency 'multipart-post', '~> 1.0.1', '>= 1.0.1'
23
24
 
24
25
  # For the examples:
25
26
  gemspec.add_development_dependency 'highline', '>= 1.5'
27
+
28
+ # For the tests:
29
+ gemspec.test_files = FileList["test/**/*_test.rb"]
30
+ gemspec.add_development_dependency 'mocha', '= 0.9.8'
26
31
  end
27
32
  rescue LoadError
28
33
  puts "Jeweler not available. Install it with: gem install jeweler"
@@ -32,4 +37,10 @@ Rake::RDocTask.new do |t|
32
37
  t.main = "README.rdoc"
33
38
  t.rdoc_files.include("README.rdoc")
34
39
  t.rdoc_files.include("lib/**/*.rb")
40
+ end
41
+
42
+ Rake::TestTask.new do |t|
43
+ t.libs << 'lib'
44
+ t.pattern = 'test/**/*_test.rb'
45
+ t.verbose = false
35
46
  end
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module LiquidPlanner
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
  API_BASE_URL = "https://app.liquidplanner.com/api"
7
7
  end
8
8
 
@@ -0,0 +1,37 @@
1
+ require 'test/unit'
2
+ require 'mocha'
3
+ require File.dirname(__FILE__) + '/../lib/liquidplanner'
4
+
5
+ # Test that the special behaviors that LiquidPlanner expects behave sanely.
6
+ class LiquidPlannerResourceTest < Test::Unit::TestCase
7
+ def setup
8
+ @email = 'testing@example.com'
9
+ @password = 'password'
10
+ @lp = LiquidPlanner::Base.new(:email=>@email, :password=>@password)
11
+ end
12
+
13
+ # LiquidPlanner does not include redundant data in the responses, ensure that workspace_id is preserved
14
+ def test_loading_does_not_clobber_prefix_options
15
+ id = 7
16
+ task = LiquidPlanner::Resources::Task.new()
17
+ task.prefix_options = {:workspace_id=>id}
18
+ task.load(:name=>'cake')
19
+
20
+ assert_equal id, task.workspace_id
21
+ end
22
+
23
+ # Newly built resources should inherit their parent's prefix options and id as a new prefix option
24
+ def test_building_new_resources
25
+ task_id = 7
26
+ workspace_id = 9
27
+ comment_text = "hello"
28
+
29
+ task = LiquidPlanner::Resources::Task.new(:workspace_id=>workspace_id, :id=>task_id, :name=>'new task')
30
+ comment = task.build_comment(:comment=>comment_text)
31
+ assert_equal LiquidPlanner::Resources::Comment, comment.class
32
+
33
+ assert_equal task_id, comment.prefix_options[:item_id]
34
+ assert_equal workspace_id, comment.prefix_options[:workspace_id]
35
+ assert_equal comment_text, comment.comment
36
+ end
37
+ end
@@ -0,0 +1,31 @@
1
+ require 'test/unit'
2
+ require 'mocha'
3
+ require File.dirname(__FILE__) + '/../lib/liquidplanner'
4
+
5
+ # Very Basic tests around the workspace resource to ensure that it generates proper calls to ActiveResource.
6
+ class WorkspaceTest < Test::Unit::TestCase
7
+ def setup
8
+ @email = 'testing@example.com'
9
+ @password = 'password'
10
+ @lp = LiquidPlanner::Base.new(:email=>@email, :password=>@password)
11
+ end
12
+
13
+ def test_showing_workspace
14
+ id = 17
15
+ LiquidPlanner::LiquidPlannerResource.connection
16
+ .expects(:get)
17
+ .with(regexp_matches(/workspaces\/#{id}\.json$/), anything)
18
+ .returns({})
19
+
20
+ @lp.workspaces(id)
21
+ end
22
+
23
+ def test_listing_workspaces
24
+ LiquidPlanner::LiquidPlannerResource.connection
25
+ .expects(:get)
26
+ .with(regexp_matches(/workspaces\.json$/), anything)
27
+ .returns([])
28
+
29
+ @lp.workspaces
30
+ end
31
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liquidplanner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brett Bender
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-07-14 00:00:00 -07:00
19
+ date: 2010-09-02 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -33,14 +33,54 @@ dependencies:
33
33
  - 0
34
34
  - 0
35
35
  version: 3.0.0
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ hash: 7
39
+ segments:
40
+ - 3
41
+ - 0
42
+ - 0
43
+ version: 3.0.0
36
44
  type: :runtime
37
45
  version_requirements: *id001
38
46
  - !ruby/object:Gem::Dependency
39
- name: multipart-post
47
+ name: activesupport
40
48
  prerelease: false
41
49
  requirement: &id002 !ruby/object:Gem::Requirement
42
50
  none: false
43
51
  requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ hash: 7
55
+ segments:
56
+ - 3
57
+ - 0
58
+ - 0
59
+ version: 3.0.0
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 7
63
+ segments:
64
+ - 3
65
+ - 0
66
+ - 0
67
+ version: 3.0.0
68
+ type: :runtime
69
+ version_requirements: *id002
70
+ - !ruby/object:Gem::Dependency
71
+ name: multipart-post
72
+ prerelease: false
73
+ requirement: &id003 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ hash: 21
79
+ segments:
80
+ - 1
81
+ - 0
82
+ - 1
83
+ version: 1.0.1
44
84
  - - ">="
45
85
  - !ruby/object:Gem::Version
46
86
  hash: 21
@@ -50,11 +90,11 @@ dependencies:
50
90
  - 1
51
91
  version: 1.0.1
52
92
  type: :runtime
53
- version_requirements: *id002
93
+ version_requirements: *id003
54
94
  - !ruby/object:Gem::Dependency
55
95
  name: highline
56
96
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
97
+ requirement: &id004 !ruby/object:Gem::Requirement
58
98
  none: false
59
99
  requirements:
60
100
  - - ">="
@@ -65,7 +105,23 @@ dependencies:
65
105
  - 5
66
106
  version: "1.5"
67
107
  type: :development
68
- version_requirements: *id003
108
+ version_requirements: *id004
109
+ - !ruby/object:Gem::Dependency
110
+ name: mocha
111
+ prerelease: false
112
+ requirement: &id005 !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - "="
116
+ - !ruby/object:Gem::Version
117
+ hash: 43
118
+ segments:
119
+ - 0
120
+ - 9
121
+ - 8
122
+ version: 0.9.8
123
+ type: :development
124
+ version_requirements: *id005
69
125
  description: LiquidPlanner API client, using ActiveResource
70
126
  email: api@liquidplanner.com
71
127
  executables: []
@@ -114,6 +170,8 @@ files:
114
170
  - lib/liquidplanner/resources/task.rb
115
171
  - lib/liquidplanner/resources/tasklist.rb
116
172
  - lib/liquidplanner/resources/workspace.rb
173
+ - test/liquidplanner_resource_test.rb
174
+ - test/workspace_test.rb
117
175
  has_rdoc: true
118
176
  homepage: http://github.com/liquidplanner/liquidplanner
119
177
  licenses: []
@@ -149,7 +207,5 @@ signing_key:
149
207
  specification_version: 3
150
208
  summary: LiquidPlanner API client
151
209
  test_files:
152
- - examples/create_task.rb
153
- - examples/list_tasks.rb
154
- - examples/support/helper.rb
155
- - examples/track_time.rb
210
+ - test/liquidplanner_resource_test.rb
211
+ - test/workspace_test.rb