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,131 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::Repository do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('repository') }
|
8
|
-
|
9
|
-
let(:request_path) { nil }
|
10
|
-
let(:stub_options) { {} }
|
11
|
-
|
12
|
-
let(:owner) { 'test_owner' }
|
13
|
-
let(:slug) { 'test_repo' }
|
14
|
-
|
15
|
-
let(:model) do
|
16
|
-
m = Tinybucket::Model::Repository.new(model_json)
|
17
|
-
m.repo_owner = owner
|
18
|
-
m.repo_slug = slug
|
19
|
-
|
20
|
-
m
|
21
|
-
end
|
22
|
-
|
23
|
-
before { stub_apiresponse(:get, request_path, stub_options) if request_path }
|
24
|
-
|
25
|
-
it_behaves_like 'model has acceptable_attributes',
|
26
|
-
Tinybucket::Model::Repository,
|
27
|
-
load_json_fixture('repository')
|
28
|
-
|
29
|
-
describe 'model can reloadable' do
|
30
|
-
let(:repo) do
|
31
|
-
m = Tinybucket::Model::Repository.new({})
|
32
|
-
m.repo_owner = owner
|
33
|
-
m.repo_slug = slug
|
34
|
-
m
|
35
|
-
end
|
36
|
-
before { @model = repo }
|
37
|
-
it_behaves_like 'the model is reloadable'
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#create' do
|
41
|
-
pending 'TODO implement method'
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#destroy' do
|
45
|
-
pending 'TODO implement method'
|
46
|
-
end
|
47
|
-
|
48
|
-
describe '#pull_requests' do
|
49
|
-
let(:request_path) do
|
50
|
-
"/repositories/#{owner}/#{slug}/pullrequests"
|
51
|
-
end
|
52
|
-
|
53
|
-
subject { model.pull_requests() }
|
54
|
-
|
55
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::PullRequests) }
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#pull_request' do
|
59
|
-
let(:prid) { 1 }
|
60
|
-
|
61
|
-
subject { model.pull_request(prid) }
|
62
|
-
let(:request_path) do
|
63
|
-
"/repositories/#{owner}/#{slug}/pullrequests/#{prid}"
|
64
|
-
end
|
65
|
-
it 'return the specific pull_request model' do
|
66
|
-
expect(subject).to be_an_instance_of(Tinybucket::Model::PullRequest)
|
67
|
-
expect(subject.id).to eq(prid)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe '#watchers' do
|
72
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/watchers" }
|
73
|
-
subject { model.watchers }
|
74
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Watchers) }
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '#forks' do
|
78
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/forks" }
|
79
|
-
subject { model.forks }
|
80
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Forks) }
|
81
|
-
end
|
82
|
-
|
83
|
-
describe '#commits' do
|
84
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/commits" }
|
85
|
-
subject { model.commits }
|
86
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Commits) }
|
87
|
-
end
|
88
|
-
|
89
|
-
describe '#commit' do
|
90
|
-
let(:revision) { '1' }
|
91
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/commit/#{revision}" }
|
92
|
-
subject { model.commit(revision) }
|
93
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::Commit) }
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '#branch_restrictions' do
|
97
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/branch-restrictions" }
|
98
|
-
subject { model.branch_restrictions }
|
99
|
-
it 'return resource model' do
|
100
|
-
expect(subject).to be_an_instance_of(
|
101
|
-
Tinybucket::Resource::BranchRestrictions)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe '#branch_restriction' do
|
106
|
-
let(:restriction_id) { '1' }
|
107
|
-
let(:request_path) do
|
108
|
-
"/repositories/#{owner}/#{slug}/branch-restrictions/#{restriction_id}"
|
109
|
-
end
|
110
|
-
subject { model.branch_restriction(restriction_id) }
|
111
|
-
it 'return BranchRestriction model' do
|
112
|
-
expect(subject).to be_an_instance_of(Tinybucket::Model::BranchRestriction)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe '#diff' do
|
117
|
-
let(:diff_spec) { '1' }
|
118
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/diff/#{diff_spec}" }
|
119
|
-
let(:stub_options) { { content_type: 'text/plain' } }
|
120
|
-
subject { model.diff(diff_spec) }
|
121
|
-
it { expect(subject).to be_an_instance_of(String) }
|
122
|
-
end
|
123
|
-
|
124
|
-
describe '#patch' do
|
125
|
-
let(:patch_spec) { '1' }
|
126
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/patch/#{patch_spec}" }
|
127
|
-
let(:stub_options) { { content_type: 'text/plain' } }
|
128
|
-
subject { model.patch(patch_spec) }
|
129
|
-
it { expect(subject).to be_an_instance_of(String) }
|
130
|
-
end
|
131
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Model::Team do
|
4
|
-
include ApiResponseMacros
|
5
|
-
include ModelMacros
|
6
|
-
|
7
|
-
let(:model_json) { load_json_fixture('team') }
|
8
|
-
|
9
|
-
let(:request_path) { nil }
|
10
|
-
|
11
|
-
let(:teamname) { 'test_team' }
|
12
|
-
|
13
|
-
let(:model) do
|
14
|
-
m = Tinybucket::Model::Team.new(model_json)
|
15
|
-
m.username = teamname
|
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::Team,
|
23
|
-
load_json_fixture('team')
|
24
|
-
|
25
|
-
describe 'model can reloadable' do
|
26
|
-
let(:team) do
|
27
|
-
m = Tinybucket::Model::Team.new({})
|
28
|
-
m.username = teamname
|
29
|
-
m
|
30
|
-
end
|
31
|
-
before { @model = team }
|
32
|
-
it_behaves_like 'the model is reloadable'
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#members' do
|
36
|
-
let(:request_path) { "/teams/#{teamname}/members" }
|
37
|
-
subject { model.members }
|
38
|
-
it 'return resource' do
|
39
|
-
expect(subject).to be_an_instance_of(
|
40
|
-
Tinybucket::Resource::Team::Members)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#followers' do
|
45
|
-
let(:request_path) { "/teams/#{teamname}/followers" }
|
46
|
-
subject { model.followers() }
|
47
|
-
it 'return resource' do
|
48
|
-
expect(subject).to be_an_instance_of(
|
49
|
-
Tinybucket::Resource::Team::Followers)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#following' do
|
54
|
-
let(:request_path) { "/teams/#{teamname}/following" }
|
55
|
-
subject { model.following }
|
56
|
-
it 'return resource' do
|
57
|
-
expect(subject).to be_an_instance_of(
|
58
|
-
Tinybucket::Resource::Team::Following)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '#repos' do
|
63
|
-
let(:request_path) { "/teams/#{teamname}/repositories" }
|
64
|
-
subject { model.repos }
|
65
|
-
it 'return resource' do
|
66
|
-
expect(subject).to be_an_instance_of(
|
67
|
-
Tinybucket::Resource::Team::Repos)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::NullLogger do
|
4
|
-
subject { Tinybucket::NullLogger.new }
|
5
|
-
|
6
|
-
describe '#level' do
|
7
|
-
it { expect(subject).to respond_to(:level) }
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#level=' do
|
11
|
-
it { expect(subject).to respond_to(:level=) }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#fatal' do
|
15
|
-
it { expect(subject).to respond_to(:fatal) }
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#fatal?' do
|
19
|
-
it { expect(subject.fatal?).to be_falsey }
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#error' do
|
23
|
-
it { expect(subject).to respond_to(:error) }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#error?' do
|
27
|
-
it { expect(subject.error?).to be_falsey }
|
28
|
-
end
|
29
|
-
|
30
|
-
describe '#warn' do
|
31
|
-
it { expect(subject).to respond_to(:warn) }
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#warn?' do
|
35
|
-
it { expect(subject.warn?).to be_falsey }
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '#info' do
|
39
|
-
it { expect(subject).to respond_to(:info) }
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#info?' do
|
43
|
-
it { expect(subject.info?).to be_falsey }
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#debug' do
|
47
|
-
it { expect(subject).to respond_to(:debug) }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#debug?' do
|
51
|
-
it { expect(subject.debug?).to be_falsey }
|
52
|
-
end
|
53
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Resource::BranchRestrictions do
|
4
|
-
include ApiResponseMacros
|
5
|
-
|
6
|
-
let(:owner) { 'test_owner' }
|
7
|
-
let(:slug) { 'test_repo' }
|
8
|
-
let(:repo) do
|
9
|
-
Tinybucket::Model::Repository.new({}).tap do |m|
|
10
|
-
m.repo_owner = owner
|
11
|
-
m.repo_slug = slug
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:options) { {} }
|
16
|
-
let(:resource) { Tinybucket::Resource::BranchRestrictions.new(repo, options) }
|
17
|
-
|
18
|
-
describe 'constructor' do
|
19
|
-
subject { resource }
|
20
|
-
it 'create new instance' do
|
21
|
-
expect(subject).to be_an_instance_of(
|
22
|
-
Tinybucket::Resource::BranchRestrictions)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#create' do
|
27
|
-
subject { resource.create({}) }
|
28
|
-
it { expect { subject.create }.to raise_error(NotImplementedError) }
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#find' do
|
32
|
-
let(:restriction_id) { '1' }
|
33
|
-
let(:request_path) do
|
34
|
-
"/repositories/#{owner}/#{slug}/branch-restrictions/#{restriction_id}"
|
35
|
-
end
|
36
|
-
subject { resource.find(restriction_id, {}) }
|
37
|
-
before { stub_apiresponse(:get, request_path, {}) }
|
38
|
-
it 'return model' do
|
39
|
-
expect(subject).to be_an_instance_of(Tinybucket::Model::BranchRestriction)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe 'Enumerable Methods' do
|
44
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/branch-restrictions" }
|
45
|
-
before { stub_enum_response(:get, request_path) }
|
46
|
-
|
47
|
-
describe '#take(1)' do
|
48
|
-
subject { resource.take(1) }
|
49
|
-
it { expect(subject).to be_an_instance_of(Array) }
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '#each' do
|
53
|
-
it 'iterate models' do
|
54
|
-
resource.each do |m|
|
55
|
-
expect(m).to be_an_instance_of(Tinybucket::Model::BranchRestriction)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Resource::Commit::BuildStatuses do
|
4
|
-
include ApiResponseMacros
|
5
|
-
|
6
|
-
let(:owner) { 'test_owner' }
|
7
|
-
let(:slug) { 'test_repo' }
|
8
|
-
let(:revision) { '1' }
|
9
|
-
let(:commit) do
|
10
|
-
Tinybucket::Model::Commit.new({}).tap do |m|
|
11
|
-
m.hash = revision
|
12
|
-
m.repo_owner = owner
|
13
|
-
m.repo_slug = slug
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:options) { {} }
|
18
|
-
let(:resource) do
|
19
|
-
Tinybucket::Resource::Commit::BuildStatuses.new(commit, options)
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:status_key) { 'test_status' }
|
23
|
-
|
24
|
-
describe '#find' do
|
25
|
-
let(:request_path) do
|
26
|
-
"/repositories/#{owner}/#{slug}/commit/#{revision}/statuses/build/#{status_key}"
|
27
|
-
end
|
28
|
-
subject { resource.find(status_key) }
|
29
|
-
before { stub_apiresponse(:get, request_path) }
|
30
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::BuildStatus) }
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#create' do
|
34
|
-
let(:request_path) do
|
35
|
-
"/repositories/#{owner}/#{slug}/commit/#{revision}/statuses/build"
|
36
|
-
end
|
37
|
-
let(:params) do
|
38
|
-
{
|
39
|
-
state: 'INPROGRESS',
|
40
|
-
name: 'test_repo test #10',
|
41
|
-
url: 'https://example.com/path/to/build/info',
|
42
|
-
description: 'Changes by test_owner'
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
before { stub_apiresponse(:post, request_path) }
|
47
|
-
subject { resource.create(status_key, params) }
|
48
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::BuildStatus) }
|
49
|
-
end
|
50
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Resource::Commit::Comments do
|
4
|
-
include ApiResponseMacros
|
5
|
-
|
6
|
-
let(:owner) { 'test_owner' }
|
7
|
-
let(:slug) { 'test_repo' }
|
8
|
-
let(:revision) { '1' }
|
9
|
-
let(:commit) do
|
10
|
-
Tinybucket::Model::Commit.new({}).tap do |m|
|
11
|
-
m.hash = revision
|
12
|
-
m.repo_owner = owner
|
13
|
-
m.repo_slug = slug
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:options) { {} }
|
18
|
-
let(:resource) { Tinybucket::Resource::Commit::Comments.new(commit, options) }
|
19
|
-
|
20
|
-
describe '#find' do
|
21
|
-
let(:comment_id) { '1' }
|
22
|
-
let(:request_path) do
|
23
|
-
"/repositories/#{owner}/#{slug}/commit/#{revision}/comments/#{comment_id}"
|
24
|
-
end
|
25
|
-
subject { resource.find(comment_id) }
|
26
|
-
before { stub_apiresponse(:get, request_path) }
|
27
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::Comment) }
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'Enumerable Methods' do
|
31
|
-
let(:request_path) do
|
32
|
-
"/repositories/#{owner}/#{slug}/commit/#{revision}/comments"
|
33
|
-
end
|
34
|
-
before { stub_enum_response(:get, request_path) }
|
35
|
-
|
36
|
-
describe '#take(1)' do
|
37
|
-
subject { resource.take(1) }
|
38
|
-
it { expect(subject).to be_an_instance_of(Array) }
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#each' do
|
42
|
-
it 'iterate models' do
|
43
|
-
resource.each do |m|
|
44
|
-
expect(m).to be_an_instance_of(Tinybucket::Model::Comment)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Tinybucket::Resource::Commits do
|
4
|
-
include ApiResponseMacros
|
5
|
-
|
6
|
-
let(:owner) { 'test_owner' }
|
7
|
-
let(:slug) { 'test_repo' }
|
8
|
-
let(:repo) do
|
9
|
-
Tinybucket::Model::Repository.new({}).tap do |m|
|
10
|
-
m.repo_owner = owner
|
11
|
-
m.repo_slug = slug
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:options) { {} }
|
16
|
-
let(:resource) { Tinybucket::Resource::Commits.new(repo, options) }
|
17
|
-
|
18
|
-
describe '#find' do
|
19
|
-
let(:revision) { '1' }
|
20
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/commit/#{revision}" }
|
21
|
-
before { stub_apiresponse(:get, request_path) }
|
22
|
-
subject { resource.find(revision) }
|
23
|
-
it { expect(subject).to be_an_instance_of(Tinybucket::Model::Commit) }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'Enumerable Methods' do
|
27
|
-
let(:request_path) { "/repositories/#{owner}/#{slug}/commits" }
|
28
|
-
before { stub_enum_response(:get, request_path) }
|
29
|
-
|
30
|
-
describe '#take(1)' do
|
31
|
-
subject { resource.take(1) }
|
32
|
-
it { expect(subject).to be_an_instance_of(Array) }
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#each' do
|
36
|
-
it 'iterate models' do
|
37
|
-
resource.each do |m|
|
38
|
-
expect(m).to be_an_instance_of(Tinybucket::Model::Commit)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|