tinybucket 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -5
  3. data/README.md +100 -24
  4. data/lib/tinybucket.rb +1 -0
  5. data/lib/tinybucket/api.rb +1 -0
  6. data/lib/tinybucket/api/build_status_api.rb +55 -0
  7. data/lib/tinybucket/api/helper.rb +1 -0
  8. data/lib/tinybucket/api/helper/build_status_helper.rb +35 -0
  9. data/lib/tinybucket/client.rb +28 -45
  10. data/lib/tinybucket/enumerator.rb +4 -3
  11. data/lib/tinybucket/model.rb +2 -1
  12. data/lib/tinybucket/model/base.rb +1 -17
  13. data/lib/tinybucket/model/build_status.rb +55 -0
  14. data/lib/tinybucket/model/commit.rb +32 -15
  15. data/lib/tinybucket/model/concerns.rb +1 -0
  16. data/lib/tinybucket/model/concerns/api_callable.rb +19 -0
  17. data/lib/tinybucket/model/profile.rb +9 -26
  18. data/lib/tinybucket/model/pull_request.rb +18 -28
  19. data/lib/tinybucket/model/repository.rb +29 -76
  20. data/lib/tinybucket/model/team.rb +9 -34
  21. data/lib/tinybucket/parser.rb +1 -0
  22. data/lib/tinybucket/parser/build_status_parser.rb +9 -0
  23. data/lib/tinybucket/resource.rb +70 -0
  24. data/lib/tinybucket/resource/base.rb +29 -0
  25. data/lib/tinybucket/resource/branch_restrictions.rb +45 -0
  26. data/lib/tinybucket/resource/commit/base.rb +12 -0
  27. data/lib/tinybucket/resource/commit/build_statuses.rb +47 -0
  28. data/lib/tinybucket/resource/commit/comments.rb +32 -0
  29. data/lib/tinybucket/resource/commits.rb +33 -0
  30. data/lib/tinybucket/resource/forks.rb +22 -0
  31. data/lib/tinybucket/resource/pull_request/base.rb +18 -0
  32. data/lib/tinybucket/resource/pull_request/comments.rb +30 -0
  33. data/lib/tinybucket/resource/pull_request/commits.rb +17 -0
  34. data/lib/tinybucket/resource/pull_requests.rb +48 -0
  35. data/lib/tinybucket/resource/repos.rb +38 -0
  36. data/lib/tinybucket/resource/team/base.rb +22 -0
  37. data/lib/tinybucket/resource/team/followers.rb +13 -0
  38. data/lib/tinybucket/resource/team/following.rb +13 -0
  39. data/lib/tinybucket/resource/team/members.rb +13 -0
  40. data/lib/tinybucket/resource/team/repos.rb +13 -0
  41. data/lib/tinybucket/resource/user/base.rb +24 -0
  42. data/lib/tinybucket/resource/user/followers.rb +13 -0
  43. data/lib/tinybucket/resource/user/following.rb +13 -0
  44. data/lib/tinybucket/resource/user/repos.rb +13 -0
  45. data/lib/tinybucket/resource/watchers.rb +22 -0
  46. data/lib/tinybucket/version.rb +1 -1
  47. data/spec/fixtures/build_status.json +16 -0
  48. data/spec/fixtures/repositories/test_owner/get.json +1 -1
  49. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/post.json +16 -0
  50. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/get.json +16 -0
  51. data/spec/fixtures/repositories/test_owner/test_repo/commit/1/statuses/build/test_status/put.json +16 -0
  52. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/comments/get.json +1 -1
  53. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/1/commits/get.json +1 -1
  54. data/spec/fixtures/repositories/test_owner/test_repo/pullrequests/get.json +1 -1
  55. data/spec/fixtures/repositories/test_owner/test_repo/watchers/get.json +1 -1
  56. data/spec/lib/tinybucket/api/build_status_api_spec.rb +65 -0
  57. data/spec/lib/tinybucket/client_spec.rb +8 -4
  58. data/spec/lib/tinybucket/model/build_status_spec.rb +66 -0
  59. data/spec/lib/tinybucket/model/commit_spec.rb +19 -1
  60. data/spec/lib/tinybucket/model/profile_spec.rb +3 -3
  61. data/spec/lib/tinybucket/model/pull_request_spec.rb +3 -15
  62. data/spec/lib/tinybucket/model/repository_spec.rb +14 -20
  63. data/spec/lib/tinybucket/model/team_spec.rb +16 -4
  64. data/spec/lib/tinybucket/resource/branch_restrictions_spec.rb +60 -0
  65. data/spec/lib/tinybucket/resource/commit/build_statuses_spec.rb +50 -0
  66. data/spec/lib/tinybucket/resource/commit/comments_spec.rb +49 -0
  67. data/spec/lib/tinybucket/resource/commits_spec.rb +43 -0
  68. data/spec/lib/tinybucket/resource/forks_spec.rb +36 -0
  69. data/spec/lib/tinybucket/resource/pull_request/comments_spec.rb +41 -0
  70. data/spec/lib/tinybucket/resource/pull_request/commits_spec.rb +41 -0
  71. data/spec/lib/tinybucket/resource/pull_requests_spec.rb +59 -0
  72. data/spec/lib/tinybucket/resource/repos_spec.rb +76 -0
  73. data/spec/lib/tinybucket/resource/team/followers_spec.rb +27 -0
  74. data/spec/lib/tinybucket/resource/team/following_spec.rb +27 -0
  75. data/spec/lib/tinybucket/resource/team/members_spec.rb +27 -0
  76. data/spec/lib/tinybucket/resource/team/repos_spec.rb +27 -0
  77. data/spec/lib/tinybucket/resource/user/followers_spec.rb +27 -0
  78. data/spec/lib/tinybucket/resource/user/following_spec.rb +27 -0
  79. data/spec/lib/tinybucket/resource/user/repos_spec.rb +27 -0
  80. data/spec/lib/tinybucket/resource/watchers_spec.rb +38 -0
  81. data/spec/support/api_response_macros.rb +45 -1
  82. metadata +77 -3
@@ -16,12 +16,14 @@ RSpec.describe Tinybucket::Client do
16
16
 
17
17
  context 'without options' do
18
18
  subject { client.repos }
19
- it { expect(subject).to be_instance_of(Tinybucket::Enumerator) }
19
+ it { expect(subject).to be_instance_of(Tinybucket::Resource::Repos) }
20
+ it { expect(subject.instance_variable_get(:@owner)).to be_nil }
20
21
  end
21
22
  context 'with options' do
22
23
  subject { client.repos(options) }
23
24
  let(:options) { {} }
24
- it { expect(subject).to be_instance_of(Tinybucket::Enumerator) }
25
+ it { expect(subject).to be_instance_of(Tinybucket::Resource::Repos) }
26
+ it { expect(subject.instance_variable_get(:@owner)).to be_nil }
25
27
  end
26
28
  end
27
29
 
@@ -32,13 +34,15 @@ RSpec.describe Tinybucket::Client do
32
34
  context 'without options' do
33
35
  let(:request_path) { "/repositories/#{owner}" }
34
36
  subject { client.repos(owner) }
35
- it { expect(subject).to be_instance_of(Tinybucket::Enumerator) }
37
+ it { expect(subject).to be_instance_of(Tinybucket::Resource::Repos) }
38
+ it { expect(subject.instance_variable_get(:@owner)).to eq(owner) }
36
39
  end
37
40
  context 'with options' do
38
41
  let(:request_path) { "/repositories/#{owner}" }
39
42
  subject { client.repos(owner, options) }
40
43
  let(:options) { {} }
41
- it { expect(subject).to be_instance_of(Tinybucket::Enumerator) }
44
+ it { expect(subject).to be_instance_of(Tinybucket::Resource::Repos) }
45
+ it { expect(subject.instance_variable_get(:@owner)).to eq(owner) }
42
46
  end
43
47
  end
44
48
 
@@ -0,0 +1,66 @@
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
@@ -51,7 +51,9 @@ RSpec.describe Tinybucket::Model::Commit do
51
51
  "/repositories/#{owner}/#{slug}/commit/1/comments"
52
52
  end
53
53
  subject { model.comments }
54
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
54
+ it 'return resource' do
55
+ expect(subject).to be_an_instance_of(Tinybucket::Resource::Commit::Comments)
56
+ end
55
57
  end
56
58
 
57
59
  describe '#comment' do
@@ -87,4 +89,20 @@ RSpec.describe Tinybucket::Model::Commit do
87
89
 
88
90
  it { expect(subject).to be_truthy }
89
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
90
108
  end
@@ -35,18 +35,18 @@ RSpec.describe Tinybucket::Model::Profile do
35
35
  describe 'followers' do
36
36
  let(:request_path) { "/users/#{username}/followers" }
37
37
  subject { model.followers() }
38
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
38
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::User::Followers) }
39
39
  end
40
40
 
41
41
  describe 'following' do
42
42
  let(:request_path) { "/users/#{username}/following" }
43
43
  subject { model.following }
44
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
44
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::User::Following) }
45
45
  end
46
46
 
47
47
  describe 'repos' do
48
48
  let(:request_path) { "/repositories/#{username}" }
49
49
  subject { model.repos }
50
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
50
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::User::Repos) }
51
51
  end
52
52
  end
@@ -94,7 +94,7 @@ RSpec.describe Tinybucket::Model::PullRequest do
94
94
 
95
95
  subject { model.commits() }
96
96
 
97
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
97
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::PullRequest::Commits) }
98
98
  end
99
99
 
100
100
  describe 'comments' do
@@ -103,19 +103,7 @@ RSpec.describe Tinybucket::Model::PullRequest do
103
103
  end
104
104
 
105
105
  subject { model.comments }
106
-
107
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
108
- it 'return comments which associate with this pull request' do
109
- # extract iterator from enumerator.
110
- iterator = subject.instance_variable_get(:@iterator)
111
- # extract values from iterator.
112
- values = iterator.instance_variable_get(:@values)
113
-
114
- values.each do |comment|
115
- expect(comment).to be_an_instance_of(Tinybucket::Model::Comment)
116
- expect(comment.commented_to).to eq(model)
117
- end
118
- end
106
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::PullRequest::Comments) }
119
107
  end
120
108
 
121
109
  describe 'comment' do
@@ -138,8 +126,8 @@ RSpec.describe Tinybucket::Model::PullRequest do
138
126
  "/repositories/#{owner}/#{slug}/pullrequests/1/diff"
139
127
  end
140
128
  it { expect(subject).to be_instance_of(String) }
141
-
142
129
  end
130
+
143
131
  describe 'merge' do
144
132
  let(:request_method) { :post }
145
133
  let(:request_path) do
@@ -52,47 +52,38 @@ RSpec.describe Tinybucket::Model::Repository do
52
52
 
53
53
  subject { model.pull_requests() }
54
54
 
55
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
55
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::PullRequests) }
56
56
  end
57
57
 
58
58
  describe '#pull_request' do
59
59
  let(:prid) { 1 }
60
60
 
61
- describe 'with pull_request_id' do
62
- subject { model.pull_request(prid) }
63
- let(:request_path) do
64
- "/repositories/#{owner}/#{slug}/pullrequests/#{prid}"
65
- end
66
- it 'return the specific pull_request model' do
67
- expect(subject).to be_an_instance_of(Tinybucket::Model::PullRequest)
68
- expect(subject.id).to eq(prid)
69
- end
61
+ subject { model.pull_request(prid) }
62
+ let(:request_path) do
63
+ "/repositories/#{owner}/#{slug}/pullrequests/#{prid}"
70
64
  end
71
- describe 'without pull_request_id' do
72
- subject { model.pull_request }
73
- it 'return new pull_request model' do
74
- expect(subject).to be_an_instance_of(Tinybucket::Model::PullRequest)
75
- expect(subject.id).to be_nil
76
- 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)
77
68
  end
78
69
  end
79
70
 
80
71
  describe '#watchers' do
81
72
  let(:request_path) { "/repositories/#{owner}/#{slug}/watchers" }
82
73
  subject { model.watchers }
83
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
74
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Watchers) }
84
75
  end
85
76
 
86
77
  describe '#forks' do
87
78
  let(:request_path) { "/repositories/#{owner}/#{slug}/forks" }
88
79
  subject { model.forks }
89
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
80
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Forks) }
90
81
  end
91
82
 
92
83
  describe '#commits' do
93
84
  let(:request_path) { "/repositories/#{owner}/#{slug}/commits" }
94
85
  subject { model.commits }
95
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
86
+ it { expect(subject).to be_an_instance_of(Tinybucket::Resource::Commits) }
96
87
  end
97
88
 
98
89
  describe '#commit' do
@@ -105,7 +96,10 @@ RSpec.describe Tinybucket::Model::Repository do
105
96
  describe '#branch_restrictions' do
106
97
  let(:request_path) { "/repositories/#{owner}/#{slug}/branch-restrictions" }
107
98
  subject { model.branch_restrictions }
108
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
99
+ it 'return resource model' do
100
+ expect(subject).to be_an_instance_of(
101
+ Tinybucket::Resource::BranchRestrictions)
102
+ end
109
103
  end
110
104
 
111
105
  describe '#branch_restriction' do
@@ -35,24 +35,36 @@ RSpec.describe Tinybucket::Model::Team do
35
35
  describe '#members' do
36
36
  let(:request_path) { "/teams/#{teamname}/members" }
37
37
  subject { model.members }
38
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
38
+ it 'return resource' do
39
+ expect(subject).to be_an_instance_of(
40
+ Tinybucket::Resource::Team::Members)
41
+ end
39
42
  end
40
43
 
41
44
  describe '#followers' do
42
45
  let(:request_path) { "/teams/#{teamname}/followers" }
43
46
  subject { model.followers() }
44
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
47
+ it 'return resource' do
48
+ expect(subject).to be_an_instance_of(
49
+ Tinybucket::Resource::Team::Followers)
50
+ end
45
51
  end
46
52
 
47
53
  describe '#following' do
48
54
  let(:request_path) { "/teams/#{teamname}/following" }
49
55
  subject { model.following }
50
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
56
+ it 'return resource' do
57
+ expect(subject).to be_an_instance_of(
58
+ Tinybucket::Resource::Team::Following)
59
+ end
51
60
  end
52
61
 
53
62
  describe '#repos' do
54
63
  let(:request_path) { "/teams/#{teamname}/repositories" }
55
64
  subject { model.repos }
56
- it { expect(subject).to be_an_instance_of(Tinybucket::Enumerator) }
65
+ it 'return resource' do
66
+ expect(subject).to be_an_instance_of(
67
+ Tinybucket::Resource::Team::Repos)
68
+ end
57
69
  end
58
70
  end
@@ -0,0 +1,60 @@
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
@@ -0,0 +1,50 @@
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
@@ -0,0 +1,49 @@
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