tinybucket 1.3.0 → 1.4.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/Gemfile +8 -7
- data/README.md +28 -5
- data/Rakefile +1 -0
- data/lib/faraday_middleware/follow_oauth_redirects.rb +5 -2
- data/lib/tinybucket.rb +2 -0
- data/lib/tinybucket/api.rb +3 -0
- data/lib/tinybucket/api/base_api.rb +2 -0
- data/lib/tinybucket/api/branch_restrictions_api.rb +6 -5
- data/lib/tinybucket/api/branches_api.rb +48 -0
- data/lib/tinybucket/api/build_status_api.rb +15 -1
- data/lib/tinybucket/api/comments_api.rb +7 -6
- data/lib/tinybucket/api/commits_api.rb +25 -4
- data/lib/tinybucket/api/diff_api.rb +4 -3
- data/lib/tinybucket/api/helper.rb +3 -0
- data/lib/tinybucket/api/helper/api_helper.rb +2 -0
- data/lib/tinybucket/api/helper/branch_restrictions_helper.rb +2 -0
- data/lib/tinybucket/api/helper/branches_helper.rb +29 -0
- data/lib/tinybucket/api/helper/build_status_helper.rb +11 -0
- data/lib/tinybucket/api/helper/comments_helper.rb +2 -0
- data/lib/tinybucket/api/helper/commits_helper.rb +8 -0
- data/lib/tinybucket/api/helper/diff_helper.rb +2 -0
- data/lib/tinybucket/api/helper/pull_requests_helper.rb +2 -0
- data/lib/tinybucket/api/helper/repo_helper.rb +2 -0
- data/lib/tinybucket/api/helper/repos_helper.rb +2 -0
- data/lib/tinybucket/api/helper/team_helper.rb +2 -0
- data/lib/tinybucket/api/helper/user_helper.rb +2 -0
- data/lib/tinybucket/api/pull_requests_api.rb +4 -3
- data/lib/tinybucket/api/repo_api.rb +4 -3
- data/lib/tinybucket/api/repos_api.rb +3 -1
- data/lib/tinybucket/api/team_api.rb +4 -2
- data/lib/tinybucket/api/user_api.rb +3 -1
- data/lib/tinybucket/api_factory.rb +2 -0
- data/lib/tinybucket/client.rb +3 -2
- data/lib/tinybucket/config.rb +5 -1
- data/lib/tinybucket/connection.rb +21 -8
- data/lib/tinybucket/constants.rb +2 -0
- data/lib/tinybucket/enumerator.rb +2 -0
- data/lib/tinybucket/error.rb +2 -0
- data/lib/tinybucket/error/base_error.rb +2 -0
- data/lib/tinybucket/error/conflict.rb +2 -0
- data/lib/tinybucket/error/not_found.rb +2 -0
- data/lib/tinybucket/error/service_error.rb +2 -0
- data/lib/tinybucket/iterator.rb +4 -2
- data/lib/tinybucket/model.rb +3 -0
- data/lib/tinybucket/model/base.rb +2 -2
- data/lib/tinybucket/model/branch.rb +48 -0
- data/lib/tinybucket/model/branch_restriction.rb +4 -2
- data/lib/tinybucket/model/build_status.rb +3 -1
- data/lib/tinybucket/model/comment.rb +4 -2
- data/lib/tinybucket/model/commit.rb +6 -2
- data/lib/tinybucket/model/concerns.rb +2 -0
- data/lib/tinybucket/model/concerns/acceptable_attributes.rb +2 -0
- data/lib/tinybucket/model/concerns/api_callable.rb +2 -0
- data/lib/tinybucket/model/concerns/enumerable.rb +2 -0
- data/lib/tinybucket/model/concerns/reloadable.rb +2 -0
- data/lib/tinybucket/model/concerns/repository_keys.rb +2 -0
- data/lib/tinybucket/model/error_response.rb +4 -2
- data/lib/tinybucket/model/page.rb +4 -2
- data/lib/tinybucket/model/profile.rb +4 -2
- data/lib/tinybucket/model/pull_request.rb +4 -2
- data/lib/tinybucket/model/repository.rb +31 -5
- data/lib/tinybucket/model/team.rb +4 -2
- data/lib/tinybucket/null_logger.rb +2 -0
- data/lib/tinybucket/parser.rb +5 -0
- data/lib/tinybucket/parser/base_parser.rb +3 -2
- data/lib/tinybucket/parser/branch_parser.rb +13 -0
- data/lib/tinybucket/parser/branch_restriction_parser.rb +2 -0
- data/lib/tinybucket/parser/branch_restrictions_parser.rb +2 -0
- data/lib/tinybucket/parser/branches_parser.rb +11 -0
- data/lib/tinybucket/parser/build_status_parser.rb +2 -0
- data/lib/tinybucket/parser/builds_parser.rb +11 -0
- data/lib/tinybucket/parser/comment_parser.rb +2 -0
- data/lib/tinybucket/parser/comments_parser.rb +2 -0
- data/lib/tinybucket/parser/commit_parser.rb +2 -0
- data/lib/tinybucket/parser/commits_parser.rb +2 -0
- data/lib/tinybucket/parser/profile_parser.rb +2 -0
- data/lib/tinybucket/parser/profiles_parser.rb +2 -0
- data/lib/tinybucket/parser/pull_request_parser.rb +2 -0
- data/lib/tinybucket/parser/pull_requests_parser.rb +2 -0
- data/lib/tinybucket/parser/repo_parser.rb +2 -0
- data/lib/tinybucket/parser/repos_parser.rb +2 -0
- data/lib/tinybucket/parser/team_parser.rb +2 -0
- data/lib/tinybucket/parser/teams_parser.rb +2 -0
- data/lib/tinybucket/request.rb +2 -0
- data/lib/tinybucket/resource.rb +3 -0
- data/lib/tinybucket/resource/base.rb +6 -0
- data/lib/tinybucket/resource/branch_restrictions.rb +2 -0
- data/lib/tinybucket/resource/branches.rb +35 -0
- data/lib/tinybucket/resource/commit/base.rb +2 -0
- data/lib/tinybucket/resource/commit/build_statuses.rb +6 -3
- data/lib/tinybucket/resource/commit/comments.rb +2 -0
- data/lib/tinybucket/resource/commits.rb +13 -0
- data/lib/tinybucket/resource/forks.rb +2 -0
- data/lib/tinybucket/resource/pull_request/base.rb +2 -0
- data/lib/tinybucket/resource/pull_request/comments.rb +2 -0
- data/lib/tinybucket/resource/pull_request/commits.rb +2 -0
- data/lib/tinybucket/resource/pull_requests.rb +2 -0
- data/lib/tinybucket/resource/repos.rb +2 -0
- data/lib/tinybucket/resource/team/base.rb +2 -0
- data/lib/tinybucket/resource/team/followers.rb +2 -0
- data/lib/tinybucket/resource/team/following.rb +2 -0
- data/lib/tinybucket/resource/team/members.rb +2 -0
- data/lib/tinybucket/resource/team/repos.rb +2 -0
- data/lib/tinybucket/resource/user/base.rb +2 -0
- data/lib/tinybucket/resource/user/followers.rb +2 -0
- data/lib/tinybucket/resource/user/following.rb +2 -0
- data/lib/tinybucket/resource/user/repos.rb +2 -0
- data/lib/tinybucket/resource/watchers.rb +2 -0
- data/lib/tinybucket/response.rb +2 -0
- data/lib/tinybucket/response/handler.rb +2 -0
- data/lib/tinybucket/version.rb +3 -1
- data/tinybucket.gemspec +1 -1
- metadata +11 -193
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -33
- data/.rspec +0 -1
- data/.travis.yml +0 -13
- data/Guardfile +0 -13
- data/spec/fixtures/branch_restriction.json +0 -17
- data/spec/fixtures/build_status.json +0 -16
- data/spec/fixtures/comment.json +0 -30
- data/spec/fixtures/commit.json +0 -83
- data/spec/fixtures/profile.json +0 -29
- data/spec/fixtures/pull_request.json +0 -106
- data/spec/fixtures/repositories/get.json +0 -78
- data/spec/fixtures/repositories/test_owner/get.json +0 -78
- data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/1/get.json +0 -17
- data/spec/fixtures/repositories/test_owner/test_repo/branch-restrictions/get.json +0 -101
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/approve/post.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/1/get.json +0 -38
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/comments/get.json +0 -40
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/get.json +0 -83
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/post.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/get.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/put.json +0 -16
- data/spec/fixtures/repositories/test_owner/test_repo/commits/get.json +0 -73
- data/spec/fixtures/repositories/test_owner/test_repo/diff/1/get.json +0 -21
- data/spec/fixtures/repositories/test_owner/test_repo/forks/get.json +0 -78
- data/spec/fixtures/repositories/test_owner/test_repo/get.json +0 -71
- data/spec/fixtures/repositories/test_owner/test_repo/patch/1/get.json +0 -29
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/delete.json +0 -3
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/approve/post.json +0 -3
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/1/get.json +0 -30
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json +0 -44
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json +0 -66
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/decline/post.json +0 -116
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/diff/get.txt +0 -13
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/get.json +0 -164
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/merge/post.json +0 -123
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_declined.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_merged.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get_state_open.json +0 -112
- data/spec/fixtures/repositories/test_owner/test_repo/watchers/get.json +0 -32
- data/spec/fixtures/repository.json +0 -72
- data/spec/fixtures/team.json +0 -32
- data/spec/fixtures/teams/test_team/followers/get.json +0 -36
- data/spec/fixtures/teams/test_team/following/get.json +0 -39
- data/spec/fixtures/teams/test_team/get.json +0 -32
- data/spec/fixtures/teams/test_team/members/get.json +0 -36
- data/spec/fixtures/teams/test_team/repositories/get.json +0 -125
- data/spec/fixtures/users/test_owner/followers/get.json +0 -65
- data/spec/fixtures/users/test_owner/following/get.json +0 -100
- data/spec/fixtures/users/test_owner/get.json +0 -29
- data/spec/lib/tinybucket/api/branch_restrictions_api_spec.rb +0 -77
- data/spec/lib/tinybucket/api/build_status_api_spec.rb +0 -65
- data/spec/lib/tinybucket/api/comments_api_spec.rb +0 -132
- data/spec/lib/tinybucket/api/commits_api_spec.rb +0 -152
- data/spec/lib/tinybucket/api/diff_api_spec.rb +0 -5
- data/spec/lib/tinybucket/api/pull_requests_api_spec.rb +0 -259
- data/spec/lib/tinybucket/api/repo_api_spec.rb +0 -99
- data/spec/lib/tinybucket/api/repos_api_spec.rb +0 -27
- data/spec/lib/tinybucket/api/team_api_spec.rb +0 -82
- data/spec/lib/tinybucket/api/user_api_spec.rb +0 -73
- data/spec/lib/tinybucket/api_factory_spec.rb +0 -18
- data/spec/lib/tinybucket/client_spec.rb +0 -100
- data/spec/lib/tinybucket/connection_spec.rb +0 -30
- data/spec/lib/tinybucket/error/service_error_spec.rb +0 -23
- data/spec/lib/tinybucket/model/branch_restriction_spec.rb +0 -35
- data/spec/lib/tinybucket/model/build_status_spec.rb +0 -66
- data/spec/lib/tinybucket/model/comment_spec.rb +0 -37
- data/spec/lib/tinybucket/model/commit_spec.rb +0 -108
- data/spec/lib/tinybucket/model/page_spec.rb +0 -28
- data/spec/lib/tinybucket/model/profile_spec.rb +0 -52
- data/spec/lib/tinybucket/model/pull_request_spec.rb +0 -141
- data/spec/lib/tinybucket/model/repository_spec.rb +0 -131
- data/spec/lib/tinybucket/model/team_spec.rb +0 -70
- data/spec/lib/tinybucket/null_logger_spec.rb +0 -53
- data/spec/lib/tinybucket/resource/branch_restrictions_spec.rb +0 -60
- data/spec/lib/tinybucket/resource/commit/build_statuses_spec.rb +0 -50
- data/spec/lib/tinybucket/resource/commit/comments_spec.rb +0 -49
- data/spec/lib/tinybucket/resource/commits_spec.rb +0 -43
- data/spec/lib/tinybucket/resource/forks_spec.rb +0 -36
- data/spec/lib/tinybucket/resource/pull_request/comments_spec.rb +0 -41
- data/spec/lib/tinybucket/resource/pull_request/commits_spec.rb +0 -41
- data/spec/lib/tinybucket/resource/pull_requests_spec.rb +0 -59
- data/spec/lib/tinybucket/resource/repos_spec.rb +0 -76
- data/spec/lib/tinybucket/resource/team/followers_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/team/following_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/team/members_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/team/repos_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/user/followers_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/user/following_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/user/repos_spec.rb +0 -27
- data/spec/lib/tinybucket/resource/watchers_spec.rb +0 -38
- data/spec/lib/tinybucket_spec.rb +0 -42
- data/spec/spec_helper.rb +0 -45
- data/spec/support/api_response_macros.rb +0 -74
- data/spec/support/fixture_macros.rb +0 -5
- data/spec/support/model_macros.rb +0 -103
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::BranchRestriction do
|
4
|
-
include ApiResponseMacros
|
5
|
-
|
6
|
-
let(:model_json) { load_json_fixture('branch_restriction') }
|
7
|
-
|
8
|
-
let(:request_method) { :get }
|
9
|
-
let(:request_path) { nil }
|
10
|
-
|
11
|
-
let(:owner) { 'test_owner' }
|
12
|
-
let(:slug) { 'test_repo' }
|
13
|
-
|
14
|
-
let(:model) do
|
15
|
-
m = Tinybucket::Model::BranchRestriction.new(model_json)
|
16
|
-
m.repo_owner = owner
|
17
|
-
m.repo_slug = slug
|
18
|
-
|
19
|
-
m
|
20
|
-
end
|
21
|
-
|
22
|
-
before { stub_apiresponse(:get, request_path, stub_options) if request_path }
|
23
|
-
|
24
|
-
it_behaves_like 'model has acceptable_attributes',
|
25
|
-
Tinybucket::Model::BranchRestriction,
|
26
|
-
load_json_fixture('branch_restriction')
|
27
|
-
|
28
|
-
describe '#update' do
|
29
|
-
pending 'TODO implement method'
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#destroy' do
|
33
|
-
pending 'TODO implement method'
|
34
|
-
end
|
35
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::BuildStatus do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('build_status') }
|
8
|
-
|
9
|
-
let(:request_method) { :get }
|
10
|
-
let(:request_path) { nil }
|
11
|
-
let(:stub_options) { nil }
|
12
|
-
|
13
|
-
let(:commit_hash) { '1' }
|
14
|
-
let(:owner) { 'test_owner' }
|
15
|
-
let(:slug) { 'test_repo' }
|
16
|
-
let(:model) do
|
17
|
-
Tinybucket::Model::BuildStatus.new(model_json).tap do |m|
|
18
|
-
m.repo_owner = owner
|
19
|
-
m.repo_slug = slug
|
20
|
-
m.revision = commit_hash
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
before do
|
25
|
-
if request_path
|
26
|
-
opts = stub_options.present? ? stub_options : {}
|
27
|
-
stub_apiresponse(request_method, request_path, opts)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it_behaves_like 'model has acceptable_attributes',
|
32
|
-
Tinybucket::Model::BuildStatus,
|
33
|
-
load_json_fixture('build_status')
|
34
|
-
|
35
|
-
describe 'model can reloadable' do
|
36
|
-
let(:build_status) do
|
37
|
-
Tinybucket::Model::BuildStatus.new({}).tap do |m|
|
38
|
-
m.repo_owner = owner
|
39
|
-
m.repo_slug = slug
|
40
|
-
m.revision = commit_hash
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
before { @model = build_status }
|
45
|
-
it_behaves_like 'the model is reloadable'
|
46
|
-
end
|
47
|
-
|
48
|
-
describe '#update' do
|
49
|
-
let(:status_key) { 'test_status' }
|
50
|
-
let(:request_path) do
|
51
|
-
"/repositories/#{owner}/#{slug}/commit/1/statuses/build/#{status_key}"
|
52
|
-
end
|
53
|
-
let(:params) do
|
54
|
-
{
|
55
|
-
state: 'SUCCESSFUL',
|
56
|
-
name: 'test_repo test #10',
|
57
|
-
url: 'https://example.com/path/to/build/info',
|
58
|
-
description: 'Changes by test_owner'
|
59
|
-
}
|
60
|
-
end
|
61
|
-
let(:request_method) { :put }
|
62
|
-
|
63
|
-
subject { model.update(params) }
|
64
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::BuildStatus) }
|
65
|
-
end
|
66
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::Comment do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('comment') }
|
8
|
-
|
9
|
-
let(:owner) { 'test_owner' }
|
10
|
-
let(:slug) { 'test_repo' }
|
11
|
-
|
12
|
-
let(:commit) do
|
13
|
-
m = Tinybucket::Model::Commit.new({})
|
14
|
-
m.repo_owner = owner
|
15
|
-
m.repo_slug = slug
|
16
|
-
m.hash = '1'
|
17
|
-
m
|
18
|
-
end
|
19
|
-
|
20
|
-
it_behaves_like 'model has acceptable_attributes',
|
21
|
-
Tinybucket::Model::Comment,
|
22
|
-
load_json_fixture('comment')
|
23
|
-
|
24
|
-
describe 'model can reloadable' do
|
25
|
-
let(:comment) do
|
26
|
-
m = Tinybucket::Model::Comment.new({})
|
27
|
-
m.repo_owner = owner
|
28
|
-
m.repo_slug = slug
|
29
|
-
m.commented_to = commit
|
30
|
-
m.id = '1'
|
31
|
-
m
|
32
|
-
end
|
33
|
-
|
34
|
-
before { @model = commit }
|
35
|
-
it_behaves_like 'the model is reloadable'
|
36
|
-
end
|
37
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::Commit do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('commit') }
|
8
|
-
|
9
|
-
let(:request_path) { nil }
|
10
|
-
|
11
|
-
let(:owner) { 'test_owner' }
|
12
|
-
let(:slug) { 'test_repo' }
|
13
|
-
|
14
|
-
let(:model) do
|
15
|
-
m = Tinybucket::Model::Commit.new(model_json)
|
16
|
-
m.repo_owner = owner
|
17
|
-
m.repo_slug = slug
|
18
|
-
m.hash = '1'
|
19
|
-
|
20
|
-
m
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:request_method) { :get }
|
24
|
-
let(:stub_options) { nil }
|
25
|
-
|
26
|
-
before do
|
27
|
-
if request_path
|
28
|
-
opts = stub_options.present? ? stub_options : {}
|
29
|
-
stub_apiresponse(request_method, request_path, opts)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it_behaves_like 'model has acceptable_attributes',
|
34
|
-
Tinybucket::Model::Commit,
|
35
|
-
load_json_fixture('commit')
|
36
|
-
|
37
|
-
describe 'model can reloadable' do
|
38
|
-
let(:commit) do
|
39
|
-
m = Tinybucket::Model::Commit.new({})
|
40
|
-
m.repo_owner = owner
|
41
|
-
m.repo_slug = slug
|
42
|
-
m.hash = '1'
|
43
|
-
m
|
44
|
-
end
|
45
|
-
before { @model = commit }
|
46
|
-
it_behaves_like 'the model is reloadable'
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '#comments' do
|
50
|
-
let(:request_path) do
|
51
|
-
"/repositories/#{owner}/#{slug}/commit/1/comments"
|
52
|
-
end
|
53
|
-
subject { model.comments }
|
54
|
-
it 'return resource' do
|
55
|
-
expect(subject).to be_an_instance_of(Tinybucket::Resource::Commit::Comments)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#comment' do
|
60
|
-
let(:comment_id) { '1' }
|
61
|
-
let(:request_path) do
|
62
|
-
"/repositories/#{owner}/#{slug}/commit/1/comments/#{comment_id}"
|
63
|
-
end
|
64
|
-
subject { model.comment(comment_id) }
|
65
|
-
it 'return Comment' do
|
66
|
-
expect(subject).to be_an_instance_of(Tinybucket::Model::Comment)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#approve' do
|
71
|
-
let(:request_method) { :post }
|
72
|
-
let(:request_path) do
|
73
|
-
"/repositories/#{owner}/#{slug}/commit/1/approve"
|
74
|
-
end
|
75
|
-
|
76
|
-
subject { model.approve }
|
77
|
-
|
78
|
-
it { expect(subject).to be_truthy }
|
79
|
-
end
|
80
|
-
|
81
|
-
describe '#unapprove' do
|
82
|
-
let(:request_method) { :delete }
|
83
|
-
let(:request_path) do
|
84
|
-
"/repositories/#{owner}/#{slug}/commit/1/approve"
|
85
|
-
end
|
86
|
-
let(:stub_options) { { status_code: 204, message: '' } }
|
87
|
-
|
88
|
-
subject { model.unapprove }
|
89
|
-
|
90
|
-
it { expect(subject).to be_truthy }
|
91
|
-
end
|
92
|
-
|
93
|
-
describe '#build_statuses' do
|
94
|
-
subject { model.build_statuses }
|
95
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Commit::BuildStatuses) }
|
96
|
-
end
|
97
|
-
|
98
|
-
describe '#build_status' do
|
99
|
-
let(:status_key) { 'test_status' }
|
100
|
-
let(:request_method) { :get }
|
101
|
-
let(:request_path) do
|
102
|
-
"/repositories/#{owner}/#{slug}/commit/1/statuses/build/#{status_key}"
|
103
|
-
end
|
104
|
-
|
105
|
-
subject { model.build_status(status_key) }
|
106
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::BuildStatus) }
|
107
|
-
end
|
108
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::Page do
|
4
|
-
|
5
|
-
let(:json) do
|
6
|
-
text = File.read('spec/fixtures/repositories/get.json')
|
7
|
-
JSON.parse(text)
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:klass) { Tinybucket::Model::Repository }
|
11
|
-
let(:model) { Tinybucket::Model::Page.new(json, klass) }
|
12
|
-
|
13
|
-
describe 'initialize' do
|
14
|
-
subject { model }
|
15
|
-
|
16
|
-
it 'create instance' do
|
17
|
-
expect(subject).to be_an_instance_of(Tinybucket::Model::Page)
|
18
|
-
|
19
|
-
expect(subject.attrs[:size]).to eq(json['size'])
|
20
|
-
expect(subject.attrs[:page]).to eq(json['page'])
|
21
|
-
expect(subject.attrs[:pagelen]).to eq(json['pagelen'])
|
22
|
-
expect(subject.attrs[:next]).to eq(json['next'])
|
23
|
-
expect(subject.attrs[:previous]).to eq(json['previous'])
|
24
|
-
|
25
|
-
expect(subject.items.size).to eq(json['values'].size)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::Profile do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('profile') }
|
8
|
-
|
9
|
-
let(:request_path) { nil }
|
10
|
-
|
11
|
-
let(:username) { 'test_owner' }
|
12
|
-
|
13
|
-
let(:model) do
|
14
|
-
m = Tinybucket::Model::Profile.new(model_json)
|
15
|
-
m.username = username
|
16
|
-
m
|
17
|
-
end
|
18
|
-
|
19
|
-
before { stub_apiresponse(:get, request_path) if request_path }
|
20
|
-
|
21
|
-
it_behaves_like 'model has acceptable_attributes',
|
22
|
-
Tinybucket::Model::Profile,
|
23
|
-
load_json_fixture('profile')
|
24
|
-
|
25
|
-
describe 'model can reloadable' do
|
26
|
-
let(:profile) do
|
27
|
-
m = Tinybucket::Model::Profile.new({})
|
28
|
-
m.username = username
|
29
|
-
m
|
30
|
-
end
|
31
|
-
before { @model = profile }
|
32
|
-
it_behaves_like 'the model is reloadable'
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'followers' do
|
36
|
-
let(:request_path) { "/users/#{username}/followers" }
|
37
|
-
subject { model.followers() }
|
38
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::User::Followers) }
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'following' do
|
42
|
-
let(:request_path) { "/users/#{username}/following" }
|
43
|
-
subject { model.following }
|
44
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::User::Following) }
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'repos' do
|
48
|
-
let(:request_path) { "/repositories/#{username}" }
|
49
|
-
subject { model.repos }
|
50
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::User::Repos) }
|
51
|
-
end
|
52
|
-
end
|
@@ -1,141 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::PullRequest do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('pull_request') }
|
8
|
-
|
9
|
-
let(:request_method) { :get }
|
10
|
-
let(:request_path) { nil }
|
11
|
-
|
12
|
-
let(:owner) { 'test_owner' }
|
13
|
-
let(:slug) { 'test_repo' }
|
14
|
-
|
15
|
-
let(:model) do
|
16
|
-
pr = Tinybucket::Model::PullRequest.new(model_json)
|
17
|
-
pr.repo_owner = owner
|
18
|
-
pr.repo_slug = slug
|
19
|
-
pr.id = 1
|
20
|
-
|
21
|
-
pr
|
22
|
-
end
|
23
|
-
|
24
|
-
let(:stub_options) { nil }
|
25
|
-
|
26
|
-
before do
|
27
|
-
if request_path
|
28
|
-
opts = stub_options.present? ? stub_options : {}
|
29
|
-
stub_apiresponse(request_method, request_path, opts)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it_behaves_like 'model has acceptable_attributes',
|
34
|
-
Tinybucket::Model::PullRequest,
|
35
|
-
load_json_fixture('pull_request')
|
36
|
-
|
37
|
-
describe 'model can reloadable' do
|
38
|
-
let(:pr) do
|
39
|
-
m = Tinybucket::Model::PullRequest.new({})
|
40
|
-
m.repo_owner = owner
|
41
|
-
m.repo_slug = slug
|
42
|
-
m.id = 1
|
43
|
-
m
|
44
|
-
end
|
45
|
-
before { @model = pr }
|
46
|
-
it_behaves_like 'the model is reloadable'
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '#create' do
|
50
|
-
pending 'TODO implement method'
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#update' do
|
54
|
-
pending 'TODO implement method'
|
55
|
-
end
|
56
|
-
|
57
|
-
describe 'approve' do
|
58
|
-
let(:request_method) { :post }
|
59
|
-
let(:request_path) do
|
60
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/approve"
|
61
|
-
end
|
62
|
-
|
63
|
-
subject { model.approve }
|
64
|
-
|
65
|
-
it { expect(subject).to be_truthy }
|
66
|
-
end
|
67
|
-
|
68
|
-
describe 'unapprove' do
|
69
|
-
let(:request_method) { :delete }
|
70
|
-
let(:request_path) do
|
71
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/approve"
|
72
|
-
end
|
73
|
-
|
74
|
-
subject { model.unapprove }
|
75
|
-
|
76
|
-
it { expect(subject).to be_truthy }
|
77
|
-
end
|
78
|
-
|
79
|
-
describe 'decline' do
|
80
|
-
let(:request_method) { :post }
|
81
|
-
let(:request_path) do
|
82
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/decline"
|
83
|
-
end
|
84
|
-
|
85
|
-
subject { model.decline }
|
86
|
-
|
87
|
-
it { expect(subject).to be_truthy }
|
88
|
-
end
|
89
|
-
|
90
|
-
describe 'commits' do
|
91
|
-
let(:request_path) do
|
92
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/commits"
|
93
|
-
end
|
94
|
-
|
95
|
-
subject { model.commits() }
|
96
|
-
|
97
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::PullRequest::Commits) }
|
98
|
-
end
|
99
|
-
|
100
|
-
describe 'comments' do
|
101
|
-
let(:request_path) do
|
102
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/comments"
|
103
|
-
end
|
104
|
-
|
105
|
-
subject { model.comments }
|
106
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::PullRequest::Comments) }
|
107
|
-
end
|
108
|
-
|
109
|
-
describe 'comment' do
|
110
|
-
let(:comment_id) { '1' }
|
111
|
-
let(:request_path) do
|
112
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/comments/#{comment_id}"
|
113
|
-
end
|
114
|
-
subject { model.comment(comment_id) }
|
115
|
-
|
116
|
-
it 'return the comment' do
|
117
|
-
expect(subject).to be_an_instance_of(Tinybucket::Model::Comment)
|
118
|
-
expect(subject.commented_to).to eq(model)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe 'diff' do
|
123
|
-
let(:stub_options) { { content_type: 'plain/text' } }
|
124
|
-
subject { model.diff }
|
125
|
-
let(:request_path) do
|
126
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/diff"
|
127
|
-
end
|
128
|
-
it { expect(subject).to be_instance_of(String) }
|
129
|
-
end
|
130
|
-
|
131
|
-
describe 'merge' do
|
132
|
-
let(:request_method) { :post }
|
133
|
-
let(:request_path) do
|
134
|
-
"/repositories/#{owner}/#{slug}/pullrequests/1/merge"
|
135
|
-
end
|
136
|
-
|
137
|
-
subject { model.merge }
|
138
|
-
|
139
|
-
it { expect(subject).to be_truthy }
|
140
|
-
end
|
141
|
-
end
|