jiralicious 0.4.3 → 0.5.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.
- data/.document +5 -5
- data/.gitignore +11 -11
- data/.rspec +1 -1
- data/.ruby-gemset +1 -1
- data/.travis.yml +10 -10
- data/Gemfile +4 -4
- data/LICENSE +22 -22
- data/README.md +99 -94
- data/Rakefile +16 -16
- data/gemfiles/newest.gemfile +3 -3
- data/gemfiles/oldest.gemfile +6 -6
- data/jiralicious.gemspec +37 -37
- data/lib/jiralicious.rb +2 -0
- data/lib/jiralicious/base.rb +226 -226
- data/lib/jiralicious/component.rb +103 -0
- data/lib/jiralicious/custom_field_option.rb +45 -45
- data/lib/jiralicious/errors.rb +27 -27
- data/lib/jiralicious/field.rb +58 -58
- data/lib/jiralicious/issue/fields.rb +197 -197
- data/lib/jiralicious/issue/watchers.rb +92 -92
- data/lib/jiralicious/project.rb +116 -64
- data/lib/jiralicious/session.rb +61 -61
- data/lib/jiralicious/version.rb +4 -4
- data/lib/jiralicious/versions.rb +150 -0
- data/spec/components_spec.rb +74 -0
- data/spec/configuration_spec.rb +41 -41
- data/spec/field_parser_spec.rb +73 -73
- data/spec/fixtures/avatar.json +6 -6
- data/spec/fixtures/avatar_custom.json +15 -15
- data/spec/fixtures/avatar_list.json +15 -15
- data/spec/fixtures/avatar_temp.json +6 -6
- data/spec/fixtures/comment_single.json +28 -28
- data/spec/fixtures/component.json +39 -0
- data/spec/fixtures/component_ric.json +4 -0
- data/spec/fixtures/component_updated.json +39 -0
- data/spec/fixtures/jira.yml +7 -7
- data/spec/fixtures/project_componets.json +80 -0
- data/spec/fixtures/project_versions.json +22 -0
- data/spec/fixtures/test.json +23 -23
- data/spec/fixtures/version.json +11 -0
- data/spec/fixtures/version_ric.json +5 -0
- data/spec/fixtures/version_uic.json +4 -0
- data/spec/fixtures/version_updated.json +11 -0
- data/spec/issue_spec.rb +385 -385
- data/spec/jiralicious_spec.rb +16 -16
- data/spec/project_spec.rb +25 -2
- data/spec/search_result_spec.rb +54 -54
- data/spec/support/configuration.rb +11 -11
- data/spec/support/http.rb +147 -111
- data/spec/versions_spec.rb +84 -0
- metadata +189 -170
- checksums.yaml +0 -7
data/spec/jiralicious_spec.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Jiralicious do
|
5
|
-
it "creates a session on load" do
|
6
|
-
Jiralicious.session.should_not be_nil
|
7
|
-
end
|
8
|
-
|
9
|
-
it "creates a rest path" do
|
10
|
-
Jiralicious.configure do |config|
|
11
|
-
config.uri = "http://localhost:8080"
|
12
|
-
config.api_version = "2.0"
|
13
|
-
end
|
14
|
-
Jiralicious.rest_path.should == 'http://localhost:8080/rest/api/2.0'
|
15
|
-
end
|
16
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Jiralicious do
|
5
|
+
it "creates a session on load" do
|
6
|
+
Jiralicious.session.should_not be_nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it "creates a rest path" do
|
10
|
+
Jiralicious.configure do |config|
|
11
|
+
config.uri = "http://localhost:8080"
|
12
|
+
config.api_version = "2.0"
|
13
|
+
end
|
14
|
+
Jiralicious.rest_path.should == 'http://localhost:8080/rest/api/2.0'
|
15
|
+
end
|
16
|
+
end
|
data/spec/project_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "spec_helper"
|
3
3
|
|
4
|
-
describe Jiralicious, "
|
4
|
+
describe Jiralicious, "Project Management Class: " do
|
5
5
|
|
6
6
|
before :each do
|
7
7
|
Jiralicious.configure do |config|
|
@@ -20,6 +20,14 @@ describe Jiralicious, "search" do
|
|
20
20
|
"#{Jiralicious.rest_path}/project/EX",
|
21
21
|
:status => "200",
|
22
22
|
:body => project_json)
|
23
|
+
FakeWeb.register_uri(:get,
|
24
|
+
"#{Jiralicious.rest_path}/project/EX/components",
|
25
|
+
:status => "200",
|
26
|
+
:body => project_componets_json)
|
27
|
+
FakeWeb.register_uri(:get,
|
28
|
+
"#{Jiralicious.rest_path}/project/EX/versions",
|
29
|
+
:status => "200",
|
30
|
+
:body => project_versions_json)
|
23
31
|
FakeWeb.register_uri(:get,
|
24
32
|
"#{Jiralicious.rest_path}/project/ABC",
|
25
33
|
:status => "200",
|
@@ -52,4 +60,19 @@ describe Jiralicious, "search" do
|
|
52
60
|
issues.EX_1['id'].should == "10000"
|
53
61
|
end
|
54
62
|
|
55
|
-
|
63
|
+
it "finds project componets" do
|
64
|
+
components = Jiralicious::Project.components("EX")
|
65
|
+
components.count.should == 2
|
66
|
+
components.id_10000.name.should == "Component 1"
|
67
|
+
components.id_10050.name.should == "PXA"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "finds project versions" do
|
71
|
+
versions = Jiralicious::Project.versions("EX")
|
72
|
+
versions.count.should == 2
|
73
|
+
versions.id_10000.name.should == "New Version 1"
|
74
|
+
versions.id_10000.overdue.should == true
|
75
|
+
versions.id_10010.name.should == "Next Version"
|
76
|
+
versions.id_10010.overdue.should == false
|
77
|
+
end
|
78
|
+
end
|
data/spec/search_result_spec.rb
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require "spec_helper"
|
3
|
-
|
4
|
-
describe Jiralicious::SearchResult do
|
5
|
-
before :each do
|
6
|
-
FakeWeb.register_uri(:get,
|
7
|
-
"#{Jiralicious.rest_path}/issue/EX-1",
|
8
|
-
:status => "200",
|
9
|
-
:body => issue_json)
|
10
|
-
FakeWeb.register_uri(:get,
|
11
|
-
"#{Jiralicious.rest_path}/issue/EX-1/comment/",
|
12
|
-
:status => "200",
|
13
|
-
:body => comment_json)
|
14
|
-
FakeWeb.register_uri(:get,
|
15
|
-
"#{Jiralicious.rest_path}/issue/EX-1/watchers/",
|
16
|
-
:status => "200",
|
17
|
-
:body => watchers_json)
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:search_data) {
|
21
|
-
{
|
22
|
-
"startAt" => 0,
|
23
|
-
"maxResults" => 50,
|
24
|
-
"total" => 1,
|
25
|
-
"issues" => [{
|
26
|
-
"self" => "http://www.example.com/jira/rest/api/2.0/jira/rest/api/2.0/issue/EX-1",
|
27
|
-
"key" => "EX-1"
|
28
|
-
}]
|
29
|
-
}
|
30
|
-
}
|
31
|
-
let(:search_result) { Jiralicious::SearchResult.new(search_data) }
|
32
|
-
|
33
|
-
it "assigns an array to back the search results" do
|
34
|
-
search_result.instance_variable_get('@issues').
|
35
|
-
should == [ {"self" => "http://www.example.com/jira/rest/api/2.0/jira/rest/api/2.0/issue/EX-1",
|
36
|
-
"key" => "EX-1"} ]
|
37
|
-
end
|
38
|
-
|
39
|
-
it "knows it's offset" do
|
40
|
-
search_result.offset.should == 0
|
41
|
-
end
|
42
|
-
|
43
|
-
it "knows how many results are returned from the web service" do
|
44
|
-
search_result.num_results.should == 1
|
45
|
-
end
|
46
|
-
|
47
|
-
it "fetches issues" do
|
48
|
-
search_result.issues.first.should be_instance_of(Jiralicious::Issue)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "checks the issues raw result" do
|
52
|
-
search_result.issues_raw.class.should == Array
|
53
|
-
end
|
54
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe Jiralicious::SearchResult do
|
5
|
+
before :each do
|
6
|
+
FakeWeb.register_uri(:get,
|
7
|
+
"#{Jiralicious.rest_path}/issue/EX-1",
|
8
|
+
:status => "200",
|
9
|
+
:body => issue_json)
|
10
|
+
FakeWeb.register_uri(:get,
|
11
|
+
"#{Jiralicious.rest_path}/issue/EX-1/comment/",
|
12
|
+
:status => "200",
|
13
|
+
:body => comment_json)
|
14
|
+
FakeWeb.register_uri(:get,
|
15
|
+
"#{Jiralicious.rest_path}/issue/EX-1/watchers/",
|
16
|
+
:status => "200",
|
17
|
+
:body => watchers_json)
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:search_data) {
|
21
|
+
{
|
22
|
+
"startAt" => 0,
|
23
|
+
"maxResults" => 50,
|
24
|
+
"total" => 1,
|
25
|
+
"issues" => [{
|
26
|
+
"self" => "http://www.example.com/jira/rest/api/2.0/jira/rest/api/2.0/issue/EX-1",
|
27
|
+
"key" => "EX-1"
|
28
|
+
}]
|
29
|
+
}
|
30
|
+
}
|
31
|
+
let(:search_result) { Jiralicious::SearchResult.new(search_data) }
|
32
|
+
|
33
|
+
it "assigns an array to back the search results" do
|
34
|
+
search_result.instance_variable_get('@issues').
|
35
|
+
should == [ {"self" => "http://www.example.com/jira/rest/api/2.0/jira/rest/api/2.0/issue/EX-1",
|
36
|
+
"key" => "EX-1"} ]
|
37
|
+
end
|
38
|
+
|
39
|
+
it "knows it's offset" do
|
40
|
+
search_result.offset.should == 0
|
41
|
+
end
|
42
|
+
|
43
|
+
it "knows how many results are returned from the web service" do
|
44
|
+
search_result.num_results.should == 1
|
45
|
+
end
|
46
|
+
|
47
|
+
it "fetches issues" do
|
48
|
+
search_result.issues.first.should be_instance_of(Jiralicious::Issue)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "checks the issues raw result" do
|
52
|
+
search_result.issues_raw.class.should == Array
|
53
|
+
end
|
54
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module ConfigurationHelper
|
2
|
-
def configure_jiralicious
|
3
|
-
Jiralicious.configure do |config|
|
4
|
-
config.username = "jstewart"
|
5
|
-
config.password = "topsecret"
|
6
|
-
config.uri = "http://localhost"
|
7
|
-
config.api_version = "latest"
|
8
|
-
config.auth_type = :cookie
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module ConfigurationHelper
|
2
|
+
def configure_jiralicious
|
3
|
+
Jiralicious.configure do |config|
|
4
|
+
config.username = "jstewart"
|
5
|
+
config.password = "topsecret"
|
6
|
+
config.uri = "http://localhost"
|
7
|
+
config.api_version = "latest"
|
8
|
+
config.auth_type = :cookie
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/spec/support/http.rb
CHANGED
@@ -1,111 +1,147 @@
|
|
1
|
-
module LoginHelper
|
2
|
-
def register_login
|
3
|
-
response = %Q|
|
4
|
-
{
|
5
|
-
"session": {
|
6
|
-
"name": "JSESSIONID",
|
7
|
-
"value": "12345678901234567890"
|
8
|
-
},
|
9
|
-
"loginInfo": {
|
10
|
-
"failedLoginCount": 10,
|
11
|
-
"loginCount": 127,
|
12
|
-
"lastFailedLoginTime": "2011-07-25T06:31:07.556-0500",
|
13
|
-
"previousLoginTime": "2011-07-25T06:31:07.556-0500"
|
14
|
-
}
|
15
|
-
}|
|
16
|
-
FakeWeb.register_uri(:post,
|
17
|
-
Jiralicious.uri + '/rest/auth/latest/session',
|
18
|
-
:body => response)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module JsonResponse
|
23
|
-
def issue_json
|
24
|
-
File.new(File.expand_path('issue.json', File.dirname(__FILE__) + '/../fixtures')).read
|
25
|
-
end
|
26
|
-
|
27
|
-
def issue_update_json
|
28
|
-
File.new(File.expand_path('issue_update.json', File.dirname(__FILE__) + '/../fixtures')).read
|
29
|
-
end
|
30
|
-
|
31
|
-
def issue_2_json
|
32
|
-
File.new(File.expand_path('issue_2.json', File.dirname(__FILE__) + '/../fixtures')).read
|
33
|
-
end
|
34
|
-
|
35
|
-
def issue_3_json
|
36
|
-
File.new(File.expand_path('issue_update.json', File.dirname(__FILE__) + '/../fixtures')).read
|
37
|
-
end
|
38
|
-
|
39
|
-
def issue_create_json
|
40
|
-
File.new(File.expand_path('issue_create.json', File.dirname(__FILE__) + '/../fixtures')).read
|
41
|
-
end
|
42
|
-
|
43
|
-
def issue_createmeta_json
|
44
|
-
File.new(File.expand_path('issue_createmeta.json', File.dirname(__FILE__) + '/../fixtures')).read
|
45
|
-
end
|
46
|
-
|
47
|
-
def issue_editmeta_json
|
48
|
-
File.new(File.expand_path('issue_editmeta.json', File.dirname(__FILE__) + '/../fixtures')).read
|
49
|
-
end
|
50
|
-
|
51
|
-
def search_json
|
52
|
-
File.new(File.expand_path('search.json', File.dirname(__FILE__) + '/../fixtures')).read
|
53
|
-
end
|
54
|
-
|
55
|
-
def transitions_json
|
56
|
-
File.new(File.expand_path('transitions.json', File.dirname(__FILE__) + '/../fixtures')).read
|
57
|
-
end
|
58
|
-
|
59
|
-
def comment_json
|
60
|
-
File.new(File.expand_path('comment.json', File.dirname(__FILE__) + '/../fixtures')).read
|
61
|
-
end
|
62
|
-
|
63
|
-
def comment_single_json
|
64
|
-
File.new(File.expand_path('comment_single.json', File.dirname(__FILE__) + '/../fixtures')).read
|
65
|
-
end
|
66
|
-
|
67
|
-
def projects_json
|
68
|
-
File.expand_path('projects.json', File.dirname(__FILE__) + '/../fixtures')
|
69
|
-
end
|
70
|
-
|
71
|
-
def project_json
|
72
|
-
File.expand_path('project.json', File.dirname(__FILE__) + '/../fixtures')
|
73
|
-
end
|
74
|
-
|
75
|
-
def
|
76
|
-
File.expand_path('
|
77
|
-
end
|
78
|
-
|
79
|
-
def
|
80
|
-
File.
|
81
|
-
end
|
82
|
-
|
83
|
-
def
|
84
|
-
File.expand_path('
|
85
|
-
end
|
86
|
-
|
87
|
-
def
|
88
|
-
File.expand_path('
|
89
|
-
end
|
90
|
-
|
91
|
-
def
|
92
|
-
File.expand_path('
|
93
|
-
end
|
94
|
-
|
95
|
-
def
|
96
|
-
File.expand_path('
|
97
|
-
end
|
98
|
-
|
99
|
-
def
|
100
|
-
File.expand_path('
|
101
|
-
end
|
102
|
-
|
103
|
-
def
|
104
|
-
File.expand_path('
|
105
|
-
end
|
106
|
-
|
107
|
-
def
|
108
|
-
File.expand_path('
|
109
|
-
end
|
110
|
-
|
111
|
-
|
1
|
+
module LoginHelper
|
2
|
+
def register_login
|
3
|
+
response = %Q|
|
4
|
+
{
|
5
|
+
"session": {
|
6
|
+
"name": "JSESSIONID",
|
7
|
+
"value": "12345678901234567890"
|
8
|
+
},
|
9
|
+
"loginInfo": {
|
10
|
+
"failedLoginCount": 10,
|
11
|
+
"loginCount": 127,
|
12
|
+
"lastFailedLoginTime": "2011-07-25T06:31:07.556-0500",
|
13
|
+
"previousLoginTime": "2011-07-25T06:31:07.556-0500"
|
14
|
+
}
|
15
|
+
}|
|
16
|
+
FakeWeb.register_uri(:post,
|
17
|
+
Jiralicious.uri + '/rest/auth/latest/session',
|
18
|
+
:body => response)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module JsonResponse
|
23
|
+
def issue_json
|
24
|
+
File.new(File.expand_path('issue.json', File.dirname(__FILE__) + '/../fixtures')).read
|
25
|
+
end
|
26
|
+
|
27
|
+
def issue_update_json
|
28
|
+
File.new(File.expand_path('issue_update.json', File.dirname(__FILE__) + '/../fixtures')).read
|
29
|
+
end
|
30
|
+
|
31
|
+
def issue_2_json
|
32
|
+
File.new(File.expand_path('issue_2.json', File.dirname(__FILE__) + '/../fixtures')).read
|
33
|
+
end
|
34
|
+
|
35
|
+
def issue_3_json
|
36
|
+
File.new(File.expand_path('issue_update.json', File.dirname(__FILE__) + '/../fixtures')).read
|
37
|
+
end
|
38
|
+
|
39
|
+
def issue_create_json
|
40
|
+
File.new(File.expand_path('issue_create.json', File.dirname(__FILE__) + '/../fixtures')).read
|
41
|
+
end
|
42
|
+
|
43
|
+
def issue_createmeta_json
|
44
|
+
File.new(File.expand_path('issue_createmeta.json', File.dirname(__FILE__) + '/../fixtures')).read
|
45
|
+
end
|
46
|
+
|
47
|
+
def issue_editmeta_json
|
48
|
+
File.new(File.expand_path('issue_editmeta.json', File.dirname(__FILE__) + '/../fixtures')).read
|
49
|
+
end
|
50
|
+
|
51
|
+
def search_json
|
52
|
+
File.new(File.expand_path('search.json', File.dirname(__FILE__) + '/../fixtures')).read
|
53
|
+
end
|
54
|
+
|
55
|
+
def transitions_json
|
56
|
+
File.new(File.expand_path('transitions.json', File.dirname(__FILE__) + '/../fixtures')).read
|
57
|
+
end
|
58
|
+
|
59
|
+
def comment_json
|
60
|
+
File.new(File.expand_path('comment.json', File.dirname(__FILE__) + '/../fixtures')).read
|
61
|
+
end
|
62
|
+
|
63
|
+
def comment_single_json
|
64
|
+
File.new(File.expand_path('comment_single.json', File.dirname(__FILE__) + '/../fixtures')).read
|
65
|
+
end
|
66
|
+
|
67
|
+
def projects_json
|
68
|
+
File.expand_path('projects.json', File.dirname(__FILE__) + '/../fixtures')
|
69
|
+
end
|
70
|
+
|
71
|
+
def project_json
|
72
|
+
File.expand_path('project.json', File.dirname(__FILE__) + '/../fixtures')
|
73
|
+
end
|
74
|
+
|
75
|
+
def project_componets_json
|
76
|
+
File.expand_path('project_componets.json', File.dirname(__FILE__) + '/../fixtures')
|
77
|
+
end
|
78
|
+
|
79
|
+
def project_versions_json
|
80
|
+
File.expand_path('project_versions.json', File.dirname(__FILE__) + '/../fixtures')
|
81
|
+
end
|
82
|
+
|
83
|
+
def project_issue_list_json
|
84
|
+
File.expand_path('project_issue_list.json', File.dirname(__FILE__) + '/../fixtures')
|
85
|
+
end
|
86
|
+
|
87
|
+
def watchers_json
|
88
|
+
File.new(File.expand_path('watchers.json', File.dirname(__FILE__) + '/../fixtures')).read
|
89
|
+
end
|
90
|
+
|
91
|
+
def jira_yml
|
92
|
+
File.expand_path('jira.yml', File.dirname(__FILE__) + '/../fixtures')
|
93
|
+
end
|
94
|
+
|
95
|
+
def user_json
|
96
|
+
File.expand_path('user.json', File.dirname(__FILE__) + '/../fixtures')
|
97
|
+
end
|
98
|
+
|
99
|
+
def user_array_json
|
100
|
+
File.expand_path('user_array.json', File.dirname(__FILE__) + '/../fixtures')
|
101
|
+
end
|
102
|
+
|
103
|
+
def user_picker_json
|
104
|
+
File.expand_path('user_picker.json', File.dirname(__FILE__) + '/../fixtures')
|
105
|
+
end
|
106
|
+
|
107
|
+
def avatar_list_json
|
108
|
+
File.expand_path('avatar_list.json', File.dirname(__FILE__) + '/../fixtures')
|
109
|
+
end
|
110
|
+
|
111
|
+
def avatar_custom_json
|
112
|
+
File.expand_path('avatar_custom.json', File.dirname(__FILE__) + '/../fixtures')
|
113
|
+
end
|
114
|
+
|
115
|
+
def avatar_temp_json
|
116
|
+
File.expand_path('avatar_temp.json', File.dirname(__FILE__) + '/../fixtures')
|
117
|
+
end
|
118
|
+
|
119
|
+
def component_json
|
120
|
+
File.expand_path('component.json', File.dirname(__FILE__) + '/../fixtures')
|
121
|
+
end
|
122
|
+
|
123
|
+
def component_updated_json
|
124
|
+
File.expand_path('component_updated.json', File.dirname(__FILE__) + '/../fixtures')
|
125
|
+
end
|
126
|
+
|
127
|
+
def component_ric_json
|
128
|
+
File.expand_path('component_ric.json', File.dirname(__FILE__) + '/../fixtures')
|
129
|
+
end
|
130
|
+
|
131
|
+
def version_json
|
132
|
+
File.expand_path('version.json', File.dirname(__FILE__) + '/../fixtures')
|
133
|
+
end
|
134
|
+
|
135
|
+
def version_updated_json
|
136
|
+
File.expand_path('version_updated.json', File.dirname(__FILE__) + '/../fixtures')
|
137
|
+
end
|
138
|
+
|
139
|
+
def version_ric_json
|
140
|
+
File.expand_path('version_ric.json', File.dirname(__FILE__) + '/../fixtures')
|
141
|
+
end
|
142
|
+
|
143
|
+
def version_uic_json
|
144
|
+
File.expand_path('version_uic.json', File.dirname(__FILE__) + '/../fixtures')
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|