horn_of_plenty 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/LICENSE.txt +19 -0
  5. data/README.md +36 -0
  6. data/lib/horn_of_plenty.rb +22 -0
  7. data/lib/horn_of_plenty/adapters/github/client.rb +82 -0
  8. data/lib/horn_of_plenty/adapters/github/collections/card.rb +46 -0
  9. data/lib/horn_of_plenty/adapters/github/configuration.rb +38 -0
  10. data/lib/horn_of_plenty/adapters/github/error.rb +44 -0
  11. data/lib/horn_of_plenty/adapters/github/parsers/board.rb +52 -0
  12. data/lib/horn_of_plenty/adapters/github/parsers/card.rb +91 -0
  13. data/lib/horn_of_plenty/adapters/github/parsers/issue.rb +95 -0
  14. data/lib/horn_of_plenty/adapters/github/parsers/lane.rb +50 -0
  15. data/lib/horn_of_plenty/adapters/github/parsers/pull_request.rb +38 -0
  16. data/lib/horn_of_plenty/adapters/github/queries/list_boards.rb +18 -0
  17. data/lib/horn_of_plenty/adapters/github/queries/list_cards.rb +19 -0
  18. data/lib/horn_of_plenty/adapters/github/queries/list_issues.rb +22 -0
  19. data/lib/horn_of_plenty/adapters/github/queries/list_lanes.rb +19 -0
  20. data/lib/horn_of_plenty/adapters/github/queries/list_pull_requests.rb +22 -0
  21. data/lib/horn_of_plenty/adapters/github/repositories/board.rb +24 -0
  22. data/lib/horn_of_plenty/adapters/github/repositories/card.rb +24 -0
  23. data/lib/horn_of_plenty/adapters/github/repositories/issue.rb +24 -0
  24. data/lib/horn_of_plenty/adapters/github/repositories/lane.rb +24 -0
  25. data/lib/horn_of_plenty/adapters/github/repositories/pull_request.rb +24 -0
  26. data/lib/horn_of_plenty/adapters/github/requests/list_boards.rb +50 -0
  27. data/lib/horn_of_plenty/adapters/github/requests/list_cards.rb +52 -0
  28. data/lib/horn_of_plenty/adapters/github/requests/list_issues.rb +50 -0
  29. data/lib/horn_of_plenty/adapters/github/requests/list_lanes.rb +52 -0
  30. data/lib/horn_of_plenty/adapters/github/requests/list_pull_requests.rb +50 -0
  31. data/lib/horn_of_plenty/adapters/github/response.rb +16 -0
  32. data/lib/horn_of_plenty/adapters/github/responses/list_boards.rb +17 -0
  33. data/lib/horn_of_plenty/adapters/github/responses/list_cards.rb +23 -0
  34. data/lib/horn_of_plenty/adapters/github/responses/list_issues.rb +18 -0
  35. data/lib/horn_of_plenty/adapters/github/responses/list_lanes.rb +17 -0
  36. data/lib/horn_of_plenty/adapters/github/responses/list_pull_requests.rb +17 -0
  37. data/lib/horn_of_plenty/collection.rb +60 -0
  38. data/lib/horn_of_plenty/core_ext/string.rb +95 -0
  39. data/lib/horn_of_plenty/models/board.rb +32 -0
  40. data/lib/horn_of_plenty/models/card.rb +51 -0
  41. data/lib/horn_of_plenty/models/issue.rb +46 -0
  42. data/lib/horn_of_plenty/models/lane.rb +30 -0
  43. data/lib/horn_of_plenty/models/parsable.rb +44 -0
  44. data/lib/horn_of_plenty/models/pull_request.rb +12 -0
  45. data/lib/horn_of_plenty/null_objects/board.rb +10 -0
  46. data/lib/horn_of_plenty/null_objects/card.rb +10 -0
  47. data/lib/horn_of_plenty/null_objects/issue.rb +10 -0
  48. data/lib/horn_of_plenty/null_objects/lane.rb +10 -0
  49. data/lib/horn_of_plenty/null_objects/pull_request.rb +10 -0
  50. data/lib/horn_of_plenty/paginator.rb +109 -0
  51. data/lib/horn_of_plenty/parsers/hash.rb +95 -0
  52. data/lib/horn_of_plenty/queries/fetch.rb +36 -0
  53. data/lib/horn_of_plenty/repositories/board.rb +26 -0
  54. data/lib/horn_of_plenty/repositories/card.rb +26 -0
  55. data/lib/horn_of_plenty/repositories/issue.rb +26 -0
  56. data/lib/horn_of_plenty/repositories/lane.rb +26 -0
  57. data/lib/horn_of_plenty/repositories/pull_request.rb +26 -0
  58. data/lib/horn_of_plenty/repository.rb +29 -0
  59. data/lib/horn_of_plenty/request.rb +32 -0
  60. data/lib/horn_of_plenty/response.rb +44 -0
  61. data/lib/horn_of_plenty/version.rb +4 -0
  62. data/spec/fixtures/responses/board_github.json +29 -0
  63. data/spec/fixtures/responses/card_github.json +7 -0
  64. data/spec/fixtures/responses/issue_github.json +163 -0
  65. data/spec/fixtures/responses/lane_github.json +7 -0
  66. data/spec/fixtures/responses/pull_request_github.json +361 -0
  67. data/spec/lib/horn_of_plenty/adapters/github/client_spec.rb +12 -0
  68. data/spec/lib/horn_of_plenty/adapters/github/collections/card_spec.rb +14 -0
  69. data/spec/lib/horn_of_plenty/adapters/github/configuration_spec.rb +12 -0
  70. data/spec/lib/horn_of_plenty/adapters/github/error_spec.rb +35 -0
  71. data/spec/lib/horn_of_plenty/adapters/github/parsers/board_spec.rb +39 -0
  72. data/spec/lib/horn_of_plenty/adapters/github/parsers/card_spec.rb +64 -0
  73. data/spec/lib/horn_of_plenty/adapters/github/parsers/issue_spec.rb +47 -0
  74. data/spec/lib/horn_of_plenty/adapters/github/parsers/lane_spec.rb +38 -0
  75. data/spec/lib/horn_of_plenty/adapters/github/parsers/pull_request_spec.rb +50 -0
  76. data/spec/lib/horn_of_plenty/adapters/github/queries/list_boards_spec.rb +19 -0
  77. data/spec/lib/horn_of_plenty/adapters/github/queries/list_cards_spec.rb +19 -0
  78. data/spec/lib/horn_of_plenty/adapters/github/queries/list_issues_spec.rb +19 -0
  79. data/spec/lib/horn_of_plenty/adapters/github/queries/list_lanes_spec.rb +19 -0
  80. data/spec/lib/horn_of_plenty/adapters/github/queries/list_pull_requests_spec.rb +19 -0
  81. data/spec/lib/horn_of_plenty/adapters/github/repositories/board_spec.rb +22 -0
  82. data/spec/lib/horn_of_plenty/adapters/github/repositories/card_spec.rb +67 -0
  83. data/spec/lib/horn_of_plenty/adapters/github/repositories/issue_spec.rb +22 -0
  84. data/spec/lib/horn_of_plenty/adapters/github/repositories/lane_spec.rb +25 -0
  85. data/spec/lib/horn_of_plenty/adapters/github/repositories/pull_request_spec.rb +24 -0
  86. data/spec/lib/horn_of_plenty/adapters/github/requests/list_boards_spec.rb +42 -0
  87. data/spec/lib/horn_of_plenty/adapters/github/requests/list_cards_spec.rb +51 -0
  88. data/spec/lib/horn_of_plenty/adapters/github/requests/list_issues_spec.rb +42 -0
  89. data/spec/lib/horn_of_plenty/adapters/github/requests/list_lanes_spec.rb +51 -0
  90. data/spec/lib/horn_of_plenty/adapters/github/requests/list_pull_requests_spec.rb +42 -0
  91. data/spec/lib/horn_of_plenty/adapters/github/responses/list_boards_spec.rb +78 -0
  92. data/spec/lib/horn_of_plenty/adapters/github/responses/list_cards_spec.rb +86 -0
  93. data/spec/lib/horn_of_plenty/adapters/github/responses/list_issues_spec.rb +104 -0
  94. data/spec/lib/horn_of_plenty/adapters/github/responses/list_lanes_spec.rb +86 -0
  95. data/spec/lib/horn_of_plenty/adapters/github/responses/list_pull_requests_spec.rb +109 -0
  96. data/spec/lib/horn_of_plenty/models/board_spec.rb +10 -0
  97. data/spec/lib/horn_of_plenty/models/card_spec.rb +10 -0
  98. data/spec/lib/horn_of_plenty/models/issue_spec.rb +10 -0
  99. data/spec/lib/horn_of_plenty/models/lane_spec.rb +10 -0
  100. data/spec/lib/horn_of_plenty/models/pull_request_spec.rb +10 -0
  101. data/spec/lib/horn_of_plenty/null_objects/board_spec.rb +10 -0
  102. data/spec/lib/horn_of_plenty/null_objects/card_spec.rb +10 -0
  103. data/spec/lib/horn_of_plenty/null_objects/issue_spec.rb +10 -0
  104. data/spec/lib/horn_of_plenty/null_objects/lane_spec.rb +10 -0
  105. data/spec/lib/horn_of_plenty/null_objects/pull_request_spec.rb +10 -0
  106. data/spec/lib/horn_of_plenty/queries/fetch_spec.rb +15 -0
  107. data/spec/lib/horn_of_plenty/repositories/board_spec.rb +48 -0
  108. data/spec/lib/horn_of_plenty/repositories/card_spec.rb +51 -0
  109. data/spec/lib/horn_of_plenty/repositories/issue_spec.rb +48 -0
  110. data/spec/lib/horn_of_plenty/repositories/lane_spec.rb +51 -0
  111. data/spec/lib/horn_of_plenty/repositories/pull_request_spec.rb +50 -0
  112. data/spec/support/patterns.rb +1 -0
  113. metadata +396 -0
  114. metadata.gz.sig +0 -0
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+ require 'horn_of_plenty/adapters/github/parsers/card'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Parsers
10
+ describe Card do
11
+ let(:card_json_response_path) { 'spec/fixtures/responses/card_github.json' }
12
+ let(:card_json_response_file) { Pathname.pwd.join(card_json_response_path) }
13
+ let(:card_json_response_string) { card_json_response_file.read }
14
+ let(:card_json) { JSON.load(card_json_response_string) }
15
+
16
+ it 'can convert a Github JSON card response to a Card' do
17
+ card = Card.to_model(card_json)
18
+
19
+ expect(card).to be_a HornOfPlenty::Models::Card
20
+ expect(card.id).to eql '1478'
21
+ expect(card.lane_id).to eql '366'
22
+ expect(card.status).to eql nil
23
+ expect(card.repository).to eql 'api-playground/projects-test'
24
+ expect(card.content_type).to eql 'Note'
25
+ expect(card.content_id).to eql nil
26
+ expect(card.title).to eql 'Add payload for delete Project column'
27
+ expect(card.description).to eql "This is the description\nAnd more."
28
+ expect(card.labels).to eql []
29
+ expect(card.created_at).to eql Time.utc(2016, 9, 5, 14, 21, 6)
30
+ expect(card.updated_at).to eql Time.utc(2016, 9, 5, 14, 20, 22)
31
+ end
32
+
33
+ it 'can convert a Github JSON card response to a Card if the card content is an ' \
34
+ 'issue' do
35
+
36
+ card_json['note'] = nil
37
+ card_json['content_url'] = 'https://api.github.com/repos/api-playground/projects-test/issues/3'
38
+
39
+ card = Card.to_model(card_json)
40
+
41
+ expect(card).to be_a HornOfPlenty::Models::Card
42
+ expect(card.id).to eql '1478'
43
+ expect(card.lane_id).to eql '366'
44
+ expect(card.status).to eql nil
45
+ expect(card.repository).to eql 'api-playground/projects-test'
46
+ expect(card.content_type).to eql 'Issue'
47
+ expect(card.content_id).to eql '3'
48
+ expect(card.title).to eql nil
49
+ expect(card.description).to eql nil
50
+ expect(card.labels).to eql []
51
+ expect(card.created_at).to eql Time.utc(2016, 9, 5, 14, 21, 6)
52
+ expect(card.updated_at).to eql Time.utc(2016, 9, 5, 14, 20, 22)
53
+ end
54
+
55
+ it 'has access to all of the methods needed to generate the hash' do
56
+ card = Card.to_model(card_json)
57
+
58
+ expect { card.to_h }.not_to raise_error
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+ require 'horn_of_plenty/adapters/github/parsers/issue'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Parsers
10
+ describe Issue do
11
+ let(:issue_json_response_path) { 'spec/fixtures/responses/issue_github.json' }
12
+ let(:issue_json_response_file) { Pathname.pwd.join(issue_json_response_path) }
13
+ let(:issue_json_response_string) { issue_json_response_file.read }
14
+ let(:issue_json) { JSON.load(issue_json_response_string) }
15
+
16
+ it 'can convert a Github JSON issue response to a Issue' do
17
+ issue = Issue.to_model(issue_json)
18
+
19
+ # rubocop:disable Metrics/LineLength
20
+ expect(issue).to be_a HornOfPlenty::Models::Issue
21
+ expect(issue.id).to eql '1347'
22
+ expect(issue.author_id).to eql 'octocat'
23
+ expect(issue.assignee_ids).to eql %w{mswezey jfelchner}
24
+ expect(issue.closer_id).to eql 'mswezey'
25
+ expect(issue.repository).to eql 'octocat/Hello-World'
26
+ expect(issue.status).to eql 'open'
27
+ expect(issue.title).to eql 'Found a bug'
28
+ expect(issue.description).to eql "I'm having a problem with this."
29
+ expect(issue.labels).to eql %w{bug v1.0}
30
+ expect(issue.closed_at).to eql Time.utc(2013, 2, 12, 13, 22, 1)
31
+ expect(issue.created_at).to eql Time.utc(2011, 4, 22, 13, 33, 45)
32
+ expect(issue.updated_at).to eql Time.utc(2011, 4, 22, 13, 33, 48)
33
+
34
+ expect(issue).to have_pull_request
35
+ # rubocop:enable Metrics/LineLength
36
+ end
37
+
38
+ it 'has access to all of the methods needed to generate the hash' do
39
+ issue = Issue.to_model(issue_json)
40
+
41
+ expect { issue.to_h }.not_to raise_error
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+ require 'horn_of_plenty/adapters/github/parsers/lane'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Parsers
10
+ describe Lane do
11
+ let(:lane_json_response_path) { 'spec/fixtures/responses/lane_github.json' }
12
+ let(:lane_json_response_file) { Pathname.pwd.join(lane_json_response_path) }
13
+ let(:lane_json_response_string) { lane_json_response_file.read }
14
+ let(:lane_json) { JSON.load(lane_json_response_string) }
15
+
16
+ it 'can convert a Github JSON lane response to a Lane' do
17
+ lane = Lane.to_model(lane_json)
18
+
19
+ # rubocop:disable Metrics/LineLength
20
+ expect(lane).to be_a HornOfPlenty::Models::Lane
21
+ expect(lane.id).to eql '365'
22
+ expect(lane.board_id).to eql '2'
23
+ expect(lane.title).to eql 'To Do'
24
+ expect(lane.created_at).to eql Time.utc(2016, 9, 5, 14, 18, 44)
25
+ expect(lane.updated_at).to eql Time.utc(2016, 9, 5, 14, 22, 28)
26
+ # rubocop:enable Metrics/LineLength
27
+ end
28
+
29
+ it 'has access to all of the methods needed to generate the hash' do
30
+ lane = Lane.to_model(lane_json)
31
+
32
+ expect { lane.to_h }.not_to raise_error
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+ require 'horn_of_plenty/adapters/github/parsers/pull_request'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Parsers
10
+ describe PullRequest do
11
+ # rubocop:disable Metrics/LineLength
12
+ let(:pull_request_json_response_path) { 'spec/fixtures/responses/pull_request_github.json' }
13
+ let(:pull_request_json_response_file) { Pathname.pwd.join(pull_request_json_response_path) }
14
+ let(:pull_request_json_response_string) { pull_request_json_response_file.read }
15
+ let(:pull_request_json) { JSON.load(pull_request_json_response_string) }
16
+ # rubocop:enable Metrics/LineLength
17
+
18
+ it 'can convert a Github JSON pull request response to a PullRequest' do
19
+ pull_request = PullRequest.to_model(pull_request_json)
20
+
21
+ # rubocop:disable Metrics/LineLength
22
+ expect(pull_request).to be_a HornOfPlenty::Models::PullRequest
23
+ expect(pull_request.id).to eql '6'
24
+ expect(pull_request.author_id).to eql 'markmakes'
25
+ expect(pull_request.assignee_ids).to eql %w{jfelchner}
26
+ expect(pull_request.closer_id).to eql nil
27
+ expect(pull_request.merger_id).to eql 'mswezey'
28
+ expect(pull_request.repository).to eql 'RealSavvy/realsavvy'
29
+ expect(pull_request.status).to eql 'merged'
30
+ expect(pull_request.title).to eql 'GLUX updates!'
31
+ expect(pull_request.description).to eql "Footer is designed, but some of the items are placeholders till functionality is written.\n\nOtherwise loads of CSS edits for responsiveness, design, and colors."
32
+ expect(pull_request.labels).to eql []
33
+ expect(pull_request.closed_at).to eql Time.utc(2016, 5, 10, 20, 11, 54)
34
+ expect(pull_request.created_at).to eql Time.utc(2016, 5, 10, 4, 52, 19)
35
+ expect(pull_request.updated_at).to eql Time.utc(2016, 5, 10, 20, 11, 55)
36
+
37
+ expect(pull_request).not_to have_pull_request
38
+ # rubocop:enable Metrics/LineLength
39
+ end
40
+
41
+ it 'has access to all of the methods needed to generate the hash' do
42
+ pull_request = PullRequest.to_model(pull_request_json)
43
+
44
+ expect { pull_request.to_h }.not_to raise_error
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'rspeckled/spec_helpers/rspeckled'
3
+ require 'horn_of_plenty/adapters/github/queries/list_boards'
4
+
5
+ module HornOfPlenty
6
+ module Adapters
7
+ module Github
8
+ module Queries
9
+ describe ListBoards do
10
+ it 'returns the query unaltered by default' do
11
+ query = ListBoards.new(some: 'query')
12
+
13
+ expect(query.to_h).to eql(some: 'query')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'rspeckled/spec_helpers/rspeckled'
3
+ require 'horn_of_plenty/adapters/github/queries/list_cards'
4
+
5
+ module HornOfPlenty
6
+ module Adapters
7
+ module Github
8
+ module Queries
9
+ describe ListCards do
10
+ it 'returns the query unaltered by default' do
11
+ query = ListCards.new(some: 'query')
12
+
13
+ expect(query.to_h).to eql(some: 'query')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'rspeckled/spec_helpers/rspeckled'
3
+ require 'horn_of_plenty/adapters/github/queries/list_issues'
4
+
5
+ module HornOfPlenty
6
+ module Adapters
7
+ module Github
8
+ module Queries
9
+ describe ListIssues do
10
+ it 'returns the query unaltered by default' do
11
+ query = ListIssues.new(some: 'query')
12
+
13
+ expect(query.to_h).to eql(some: 'query')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'rspeckled/spec_helpers/rspeckled'
3
+ require 'horn_of_plenty/adapters/github/queries/list_lanes'
4
+
5
+ module HornOfPlenty
6
+ module Adapters
7
+ module Github
8
+ module Queries
9
+ describe ListLanes do
10
+ it 'returns the query unaltered by default' do
11
+ query = ListLanes.new(some: 'query')
12
+
13
+ expect(query.to_h).to eql(some: 'query')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'rspeckled/spec_helpers/rspeckled'
3
+ require 'horn_of_plenty/adapters/github/queries/list_pull_requests'
4
+
5
+ module HornOfPlenty
6
+ module Adapters
7
+ module Github
8
+ module Queries
9
+ describe ListPullRequests do
10
+ it 'returns the query unaltered by default' do
11
+ query = ListPullRequests.new(some: 'query')
12
+
13
+ expect(query.to_h).to eql(some: 'query')
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'chamber'
3
+ require 'horn_of_plenty/adapters/github/repositories/board'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Repositories
10
+ describe Board do
11
+ before(:each) { Adapters::Github.config.token = Chamber.env.adapters.github.token }
12
+
13
+ it 'can retrieve boards from an adapter' do
14
+ boards = Board.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump')
15
+
16
+ expect(boards.length).to eql 2
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+ require 'chamber'
3
+ require 'horn_of_plenty/adapters/github/repositories/card'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Repositories
10
+ describe Card do
11
+ before(:each) { Adapters::Github.config.token = Chamber.env.adapters.github.token }
12
+
13
+ it 'can retrieve cards for a lane' do
14
+ cards = Card.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump',
15
+ query: {
16
+ lane_id: '215863',
17
+ })
18
+
19
+ expect(cards.length).to eql 4
20
+ end
21
+
22
+ it 'can retrieve a note card' do
23
+ cards = Card.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump',
24
+ query: {
25
+ id: '451033',
26
+ })
27
+
28
+ card = cards.first
29
+
30
+ expect(card.content_type).to eql 'Note'
31
+ expect(card.title).to eql 'First Card'
32
+ end
33
+
34
+ it 'can retrieve an issue card' do
35
+ cards = Card.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump',
36
+ query: {
37
+ id: '473148',
38
+ })
39
+
40
+ card = cards.first
41
+
42
+ expect(card.content_type).to eql 'Issue'
43
+ expect(card.content_id).to eql '2'
44
+ expect(card.title).to eql 'Second Card'
45
+ expect(card.description).to eql 'Here is some text for the Hello issue'
46
+ expect(card.labels).to eql %w{invalid}
47
+ end
48
+
49
+ it 'can retrieve a pull request card' do
50
+ cards = Card.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump',
51
+ query: {
52
+ id: '475442',
53
+ })
54
+
55
+ card = cards.first
56
+
57
+ expect(card.content_type).to eql 'PullRequest'
58
+ expect(card.content_id).to eql '3'
59
+ expect(card.title).to eql 'My Bar Pull Request'
60
+ expect(card.description).to eql "Here's my PR description"
61
+ expect(card.labels).to eql %w{duplicate}
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'chamber'
3
+ require 'horn_of_plenty/adapters/github/repositories/issue'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Repositories
10
+ describe Issue do
11
+ before(:each) { Adapters::Github.config.token = Chamber.env.adapters.github.token }
12
+
13
+ it 'can retrieve issues from an adapter' do
14
+ issues = Issue.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump')
15
+
16
+ expect(issues.length).to eql 3
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ require 'chamber'
3
+ require 'horn_of_plenty/adapters/github/repositories/lane'
4
+ require 'rspeckled/spec_helpers/rspeckled'
5
+
6
+ module HornOfPlenty
7
+ module Adapters
8
+ module Github
9
+ module Repositories
10
+ describe Lane do
11
+ before(:each) { Adapters::Github.config.token = Chamber.env.adapters.github.token }
12
+
13
+ it 'can retrieve lanes from an adapter' do
14
+ lanes = Lane.fetch(repository: 'thekompanee/hustle-and-flow-issue-dump',
15
+ query: {
16
+ board_id: '1',
17
+ })
18
+
19
+ expect(lanes.length).to eql 9
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end