place 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +11 -0
- data/LICENSE +207 -0
- data/README.markdown +96 -0
- data/Rakefile +9 -0
- data/Technical.markdown +29 -0
- data/examples/sample-1.rb +34 -0
- data/lib/place/comment.rb +76 -0
- data/lib/place/link.rb +20 -0
- data/lib/place/participation.rb +12 -0
- data/lib/place/project.rb +159 -0
- data/lib/place/time_point.rb +55 -0
- data/lib/place/user.rb +79 -0
- data/lib/place/work_item.rb +179 -0
- data/lib/place/work_record.rb +51 -0
- data/lib/place.rb +112 -0
- data/place.gemspec +19 -0
- data/test/helper.rb +9 -0
- data/test/test_comment.rb +35 -0
- data/test/test_place.rb +28 -0
- data/test/test_project.rb +100 -0
- data/test/test_time_point.rb +50 -0
- data/test/test_user.rb +51 -0
- data/test/test_workitem.rb +172 -0
- metadata +133 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
$: << File.join(File.dirname(__FILE__), '.')
|
3
|
+
require 'helper.rb'
|
4
|
+
|
5
|
+
class TimePointTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
base = File.expand_path(File.join(File.dirname(__FILE__), 'repo'))
|
9
|
+
Place.setup(base)
|
10
|
+
Place.gather!
|
11
|
+
@prj = Project.find_by_name('P')
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
Ohm.flush
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_environment
|
19
|
+
assert_not_nil @prj
|
20
|
+
assert_equal 2, @prj.timepoints.all.size
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_retrieving
|
24
|
+
@prj.timepoints.all.each do |tp|
|
25
|
+
assert_not_nil tp.url
|
26
|
+
assert_not_nil tp.tid
|
27
|
+
assert_not_nil tp.name
|
28
|
+
assert_not_nil tp.time
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_belongs_to_project
|
33
|
+
tp = @prj.timepoints.all.first
|
34
|
+
assert_not_nil tp
|
35
|
+
assert_not_nil tp.project
|
36
|
+
assert_equal @prj, tp.project
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_workitems
|
40
|
+
# TODO a timepoint has workitems
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_find_by_tid
|
44
|
+
tp = @prj.timepoints.all.first
|
45
|
+
assert_equal tp, TimePoint.find_by_tid(tp.tid)
|
46
|
+
|
47
|
+
assert_nil TimePoint.find_by_tid('fooz none')
|
48
|
+
assert_nil TimePoint.find_by_tid(nil)
|
49
|
+
end
|
50
|
+
end
|
data/test/test_user.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
$: << File.join(File.dirname(__FILE__), '.')
|
3
|
+
require 'helper.rb'
|
4
|
+
|
5
|
+
class UserTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
Place.setup(File.expand_path(File.join(File.dirname(__FILE__), 'repo')))
|
9
|
+
Place.gather!
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
Ohm.flush
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_collecting
|
17
|
+
assert_equal 2, User.all.size
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_find_by_name
|
21
|
+
assert_not_nil User.find_by_name('alice')
|
22
|
+
assert_nil User.find_by_name('foo')
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_watches
|
26
|
+
User.all.each{|u| u.retrieve_watches }
|
27
|
+
|
28
|
+
User.all.each do |u|
|
29
|
+
assert u.watches.size > 0
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_author_of
|
34
|
+
alice = User.find_by_name('alice')
|
35
|
+
assert_equal 5, alice.author_of.size
|
36
|
+
assert alice.author_of.map{|wi| wi.wid}.include?('P-1')
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_participations
|
40
|
+
alice = User.find_by_name('alice')
|
41
|
+
assert_not_nil alice.participations
|
42
|
+
assert_equal 1, alice.participations.size
|
43
|
+
|
44
|
+
prj = Project.find_by_name('P')
|
45
|
+
assert_not_nil prj
|
46
|
+
assert_equal prj, alice.participations.first.project
|
47
|
+
|
48
|
+
roles = alice.participations.first.roles
|
49
|
+
assert roles.include?('project_admin')
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
|
2
|
+
$: << File.join(File.dirname(__FILE__), '.')
|
3
|
+
require 'helper.rb'
|
4
|
+
|
5
|
+
class WorkItemTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
Place.setup(File.expand_path(File.join(File.dirname(__FILE__), 'repo')))
|
9
|
+
Place.gather!
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
Ohm.flush
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_environment
|
17
|
+
assert WorkItem.all.size > 0
|
18
|
+
WorkItem.all.each do |wi|
|
19
|
+
assert_not_nil wi.url
|
20
|
+
assert_not_nil wi.wid
|
21
|
+
assert_not_nil wi.type
|
22
|
+
assert_not_nil wi.fields
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def test_project
|
28
|
+
p = Project.find_by_prefix('P')
|
29
|
+
assert_not_nil p
|
30
|
+
|
31
|
+
wi = p.workitems.all.first
|
32
|
+
assert_not_nil wi
|
33
|
+
|
34
|
+
assert_equal p, wi.project
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def test_fields
|
39
|
+
p = Project.find_by_prefix('P')
|
40
|
+
assert_not_nil p
|
41
|
+
|
42
|
+
wi = p.workitems.all.first
|
43
|
+
assert_not_nil wi
|
44
|
+
assert_not_nil wi[:type]
|
45
|
+
assert_not_nil wi.type
|
46
|
+
|
47
|
+
assert_nil wi[:foo]
|
48
|
+
wi[:foo] = 'bar'
|
49
|
+
assert_equal 'bar', wi[:foo]
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_find_by_wid
|
53
|
+
wi = WorkItem.find_by_wid 'P-1'
|
54
|
+
assert_not_nil wi
|
55
|
+
assert_equal 'task', wi[:type]
|
56
|
+
assert_equal 'task', wi.type
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_find_by_type
|
60
|
+
assert_equal 7, WorkItem.find_by_type(:task).size
|
61
|
+
assert_equal 1, WorkItem.find_by_type(:pr).size
|
62
|
+
|
63
|
+
wi = WorkItem.find_by_type(:task).first
|
64
|
+
assert_equal 'task', wi.type
|
65
|
+
|
66
|
+
wi = WorkItem.find_by_type(:foo).first
|
67
|
+
assert_nil wi
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_author
|
71
|
+
u = User.find_by_name('alice')
|
72
|
+
assert_not_nil u
|
73
|
+
|
74
|
+
wi = WorkItem.find_by_wid('P-1')
|
75
|
+
assert_not_nil wi
|
76
|
+
|
77
|
+
assert_not_nil wi.author
|
78
|
+
assert_equal wi.author, u
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_assignees
|
82
|
+
# no assignee
|
83
|
+
wi = WorkItem.find_by_wid('P-4')
|
84
|
+
assert_equal 0, wi.assignees.size
|
85
|
+
|
86
|
+
# single assignee
|
87
|
+
wi = WorkItem.find_by_wid('P-1')
|
88
|
+
assert_equal 1, wi.assignees.size
|
89
|
+
|
90
|
+
# more than one assignee
|
91
|
+
wi = WorkItem.find_by_wid('P-3')
|
92
|
+
assert wi.assignees.size > 1
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_links
|
96
|
+
p3 = WorkItem.find_by_wid('P-3')
|
97
|
+
assert_not_nil p3
|
98
|
+
|
99
|
+
assert_equal 2, p3.links_in.size
|
100
|
+
|
101
|
+
p3.links_in.map{|l| l.from.wid}.each do |wid|
|
102
|
+
assert ['P-5', 'P-6'].include?(wid)
|
103
|
+
end
|
104
|
+
|
105
|
+
p3.links_out.map{|l| l.to.wid}.each do |wid|
|
106
|
+
assert ['P-1'].include?(wid)
|
107
|
+
end
|
108
|
+
|
109
|
+
p7 = WorkItem.find_by_wid('P-7')
|
110
|
+
assert_not_nil p7
|
111
|
+
assert_equal 0, p7.links_in.size
|
112
|
+
assert_equal 0, p7.links_out.size
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_watches
|
116
|
+
# no watches
|
117
|
+
wi = WorkItem.find_by_wid('P-4')
|
118
|
+
assert_equal 0, wi.watches.size
|
119
|
+
|
120
|
+
# one watches
|
121
|
+
wi = WorkItem.find_by_wid('P-2')
|
122
|
+
assert_equal 1, wi.watches.size
|
123
|
+
|
124
|
+
# more tha one watches
|
125
|
+
wi = WorkItem.find_by_wid('P-1')
|
126
|
+
assert wi.watches.size > 1
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_workrecords
|
130
|
+
# every workitems has (at least empty) workrecords
|
131
|
+
WorkItem.all.each do |wi|
|
132
|
+
assert_not_nil wi.workrecords
|
133
|
+
end
|
134
|
+
|
135
|
+
# one workrecord
|
136
|
+
p3 = WorkItem.find_by_wid('P-3')
|
137
|
+
assert_equal 1, p3.workrecords.size
|
138
|
+
|
139
|
+
# more workrecords
|
140
|
+
p6 = WorkItem.find_by_wid('P-6')
|
141
|
+
assert_equal 2, p6.workrecords.size
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_comments
|
145
|
+
# every workitems has (at least empty) comments
|
146
|
+
WorkItem.all.each do |wi|
|
147
|
+
assert_not_nil wi.comments
|
148
|
+
end
|
149
|
+
|
150
|
+
# no comments
|
151
|
+
p3 = WorkItem.find_by_wid('P-3')
|
152
|
+
assert_equal 0, p3.comments.size
|
153
|
+
|
154
|
+
# more comments
|
155
|
+
p6 = WorkItem.find_by_wid('P-6')
|
156
|
+
assert_equal 2, p6.comments.size
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_total_on_timeSpent
|
160
|
+
p1 = WorkItem.find_by_wid('P-1')
|
161
|
+
assert_equal 1, p1['timeSpent']
|
162
|
+
|
163
|
+
p3 = WorkItem.find_by_wid('P-3')
|
164
|
+
assert_equal 2, p3['timeSpent']
|
165
|
+
|
166
|
+
p6 = WorkItem.find_by_wid('P-6')
|
167
|
+
assert_equal 4, p6['timeSpent']
|
168
|
+
|
169
|
+
assert_equal 7, p1.total_on('timeSpent')
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: place
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Carlo Pecchia
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-21 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: json
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: ohm
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: nokogiri
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
63
|
+
description: " Extract information from Polarion and turns it into easy manageable ruby objects.\n\
|
64
|
+
\t\n\
|
65
|
+
\tThose objects are stored via Redis.\n"
|
66
|
+
email:
|
67
|
+
- info@carlopecchia.eu
|
68
|
+
executables: []
|
69
|
+
|
70
|
+
extensions: []
|
71
|
+
|
72
|
+
extra_rdoc_files: []
|
73
|
+
|
74
|
+
files:
|
75
|
+
- Changelog
|
76
|
+
- LICENSE
|
77
|
+
- README.markdown
|
78
|
+
- Technical.markdown
|
79
|
+
- Rakefile
|
80
|
+
- lib/place.rb
|
81
|
+
- lib/place/project.rb
|
82
|
+
- lib/place/link.rb
|
83
|
+
- lib/place/participation.rb
|
84
|
+
- lib/place/user.rb
|
85
|
+
- lib/place/time_point.rb
|
86
|
+
- lib/place/work_item.rb
|
87
|
+
- lib/place/work_record.rb
|
88
|
+
- lib/place/comment.rb
|
89
|
+
- place.gemspec
|
90
|
+
- test/test_project.rb
|
91
|
+
- test/helper.rb
|
92
|
+
- test/test_workitem.rb
|
93
|
+
- test/test_time_point.rb
|
94
|
+
- test/test_place.rb
|
95
|
+
- test/test_comment.rb
|
96
|
+
- test/test_user.rb
|
97
|
+
- examples/sample-1.rb
|
98
|
+
has_rdoc: true
|
99
|
+
homepage: http://github.com/carlopecchia/place
|
100
|
+
licenses: []
|
101
|
+
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
requirements: []
|
126
|
+
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.3.7
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: "Polarion LACE: Polarion items access in Ruby"
|
132
|
+
test_files: []
|
133
|
+
|