troo 0.0.9 → 0.0.10
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/.gitignore +2 -2
- data/Gemfile.lock +40 -32
- data/Guardfile +9 -1
- data/README.md +15 -10
- data/bin/troo +22 -2
- data/config/en.yml +11 -1
- data/config/help +16 -0
- data/{.trooconf.example → config/trooconf.yml} +4 -2
- data/features/add/card.feature +1 -1
- data/features/add/comment.feature +1 -1
- data/features/add/list.feature +1 -1
- data/features/default/board.feature +1 -1
- data/features/default/card.feature +1 -1
- data/features/default/list.feature +1 -1
- data/features/move/card.feature +5 -5
- data/features/refresh/board.feature +1 -1
- data/features/refresh/card.feature +1 -1
- data/features/refresh/list.feature +1 -1
- data/features/show/board.feature +11 -3
- data/features/show/boards.feature +1 -0
- data/features/show/card.feature +7 -7
- data/features/show/comment.feature +15 -6
- data/features/show/list.feature +3 -1
- data/features/status.feature +2 -2
- data/features/step_definitions/fabrication_steps.rb +11 -11
- data/features/step_definitions/troo_steps.rb +1 -1
- data/features/support/cassettes/200_board_by_id.yml +56 -0
- data/features/support/cassettes/200_card_by_id.yml +77 -0
- data/features/support/cassettes/200_create_board.yml +186 -0
- data/features/support/cassettes/200_create_card.yml +86 -0
- data/features/support/cassettes/200_create_comment.yml +73 -0
- data/features/support/cassettes/200_create_list.yml +53 -0
- data/{test/cassettes/list_by_id.yml → features/support/cassettes/200_list_by_id.yml} +6 -6
- data/features/support/cassettes/200_move_card_200_board.yml +86 -0
- data/features/support/cassettes/200_move_card_200_list.yml +86 -0
- data/features/support/cassettes/200_move_card_400_list.yml +46 -0
- data/{test/cassettes/lists_by_board_id.yml → features/support/cassettes/400_board_by_id.yml} +10 -10
- data/features/support/cassettes/400_card_by_id.yml +46 -0
- data/features/support/cassettes/400_create_card.yml +46 -0
- data/features/support/cassettes/400_create_comment.yml +46 -0
- data/features/support/cassettes/400_create_list.yml +46 -0
- data/features/support/cassettes/400_list_by_id.yml +46 -0
- data/features/support/cassettes/400_move_card_200_list.yml +46 -0
- data/features/support/cassettes/400_move_card_400_board.yml +46 -0
- data/features/support/cassettes/boards_all.yml +286 -0
- data/features/support/env.rb +1 -2
- data/lib/troo/cli/commands/refresh/all.rb +2 -0
- data/lib/troo/cli/main.rb +2 -23
- data/lib/troo/configuration.rb +5 -0
- data/lib/troo/database.rb +29 -0
- data/lib/troo/decorators/resource.rb +24 -10
- data/lib/troo/helpers/model_helpers.rb +3 -2
- data/lib/troo/models/board.rb +1 -1
- data/lib/troo/models/card.rb +1 -1
- data/lib/troo/models/comment.rb +0 -4
- data/lib/troo/models/list.rb +1 -1
- data/lib/troo/presentation/formatter.rb +99 -4
- data/lib/troo/presentation/template.rb +8 -9
- data/lib/troo/presenters/board.rb +24 -26
- data/lib/troo/presenters/card.rb +3 -1
- data/lib/troo/presenters/list.rb +30 -17
- data/lib/troo/presenters/resource.rb +90 -0
- data/lib/troo/retrieval/local.rb +5 -1
- data/lib/troo/troo.rb +2 -0
- data/lib/troo/version.rb +1 -1
- data/lib/troo.rb +7 -4
- data/test/cassettes/create_board.yml +15 -9
- data/test/cassettes/create_card.yml +10 -10
- data/test/cassettes/create_comment.yml +9 -9
- data/test/cassettes/create_list.yml +5 -5
- data/test/cassettes/move_card_board.yml +11 -11
- data/test/cassettes/move_card_list.yml +11 -11
- data/test/lib/troo/api/endpoints_test.rb +2 -2
- data/test/lib/troo/cli/commands/add_test.rb +2 -2
- data/test/lib/troo/cli/commands/refresh/all_test.rb +4 -9
- data/test/lib/troo/cli/main_test.rb +0 -25
- data/test/lib/troo/configuration_test.rb +18 -13
- data/test/lib/troo/decorators/member_test.rb +0 -27
- data/test/lib/troo/decorators/resource_test.rb +0 -32
- data/test/lib/troo/helpers/model_helpers_test.rb +15 -3
- data/test/lib/troo/models/board_test.rb +45 -1
- data/test/lib/troo/models/card_test.rb +60 -6
- data/test/lib/troo/models/comment_test.rb +44 -4
- data/test/lib/troo/models/database_test.rb +19 -0
- data/test/lib/troo/models/list_test.rb +46 -2
- data/test/lib/troo/models/member_test.rb +51 -1
- data/test/lib/troo/presentation/formatter_test.rb +54 -2
- data/test/lib/troo/presentation/template_test.rb +4 -4
- data/test/lib/troo/presenters/board_test.rb +4 -3
- data/test/lib/troo/presenters/list_test.rb +3 -3
- data/test/lib/troo/presenters/member_test.rb +1 -1
- data/test/lib/troo/presenters/resource_test.rb +79 -0
- data/test/lib/troo/remote/board_test.rb +5 -8
- data/test/lib/troo/remote/card_test.rb +7 -11
- data/test/lib/troo/remote/comment_test.rb +10 -14
- data/test/lib/troo/remote/list_test.rb +5 -9
- data/test/lib/troo/remote/member_test.rb +5 -9
- data/test/lib/troo/remote/persistence/card_test.rb +1 -1
- data/test/lib/troo/remote/persistence/comment_test.rb +1 -1
- data/test/lib/troo/remote/persistence/list_test.rb +1 -1
- data/test/lib/troo/remote/persistence/move_card_test.rb +3 -3
- data/test/lib/troo/retrieval/local_test.rb +13 -1
- data/test/lib/troo/retrieval/remote_test.rb +1 -1
- data/test/support/fabrication.rb +12 -12
- data/test/support/fake_trello/fake_response.rb +18 -1
- data/test/support/fake_trello/server.rb +2 -0
- data/test/support/remotes/all_boards.json +103 -4
- data/test/support/remotes/{board.json → all_boards_200.json} +13 -13
- data/test/support/remotes/board_200.json +140 -0
- data/test/support/remotes/board_by_id.json +9 -9
- data/test/support/remotes/board_by_id_200.json +75 -0
- data/test/support/remotes/card.json +4 -4
- data/test/support/remotes/card_200.json +40 -0
- data/test/support/remotes/card_by_card_id.json +64 -64
- data/test/support/remotes/card_by_card_id_200.json +302 -0
- data/test/support/remotes/comment.json +6 -6
- data/test/support/remotes/comment_200.json +27 -0
- data/test/support/remotes/create_board.json +1 -1
- data/test/support/remotes/create_board_200.json +38 -0
- data/test/support/remotes/list.json +2 -2
- data/test/support/remotes/list_200.json +7 -0
- data/test/support/remotes/member.json +4 -4
- data/test/support/remotes/member_200.json +50 -0
- data/test/test_helper.rb +9 -2
- data/troo.gemspec +4 -3
- metadata +92 -41
- data/test/cassettes/board_by_id.yml +0 -50
- data/test/cassettes/boards_all.yml +0 -50
- data/test/cassettes/card_by_id.yml +0 -49
- data/test/cassettes/cards_by_board_id.yml +0 -49
- data/test/cassettes/cards_by_list_id.yml +0 -49
- data/test/cassettes/comments_by_board_id.yml +0 -49
- data/test/cassettes/comments_by_card_id.yml +0 -49
- data/test/cassettes/member_by_id.yml +0 -48
- data/test/cassettes/members_by_board_id.yml +0 -48
- data/test/lib/troo/decorators/card_test.rb +0 -113
@@ -3,11 +3,11 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Troo
|
4
4
|
describe Template do
|
5
5
|
let(:described_class) { Template }
|
6
|
-
let(:object)
|
7
|
-
let(:
|
6
|
+
let(:object) { stub(value: 'Hello from variable!') }
|
7
|
+
let(:path) { '/../../../test/support/template.erb' }
|
8
8
|
|
9
9
|
describe '#parse' do
|
10
|
-
subject { described_class.new(object,
|
10
|
+
subject { described_class.new(object, path).parse }
|
11
11
|
|
12
12
|
context 'when the template file can be found' do
|
13
13
|
it 'parses the template' do
|
@@ -17,7 +17,7 @@ module Troo
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'when the template file cannot be found' do
|
20
|
-
let(:
|
20
|
+
let(:path) { '/some/wrong/path/template.erb' }
|
21
21
|
|
22
22
|
it 'raises an exception' do
|
23
23
|
proc { subject }.must_raise(Errno::ENOENT)
|
@@ -4,12 +4,13 @@ module Troo
|
|
4
4
|
module Presenters
|
5
5
|
describe Board do
|
6
6
|
let(:described_class) { Board }
|
7
|
-
let(:board) { Fabricate(:board)
|
7
|
+
let(:board) { Fabricate(:board) }
|
8
8
|
let(:options) { {} }
|
9
|
+
|
9
10
|
let(:lists) { [] }
|
10
|
-
let(:list) { Fabricate(:list)
|
11
|
+
let(:list) { Fabricate(:list) }
|
11
12
|
let(:cards) { [] }
|
12
|
-
let(:card) { Fabricate(:card)
|
13
|
+
let(:card) { Fabricate(:card) }
|
13
14
|
|
14
15
|
before do
|
15
16
|
board.stubs(:lists).returns(lists)
|
@@ -4,11 +4,11 @@ module Troo
|
|
4
4
|
module Presenters
|
5
5
|
describe List do
|
6
6
|
let(:described_class) { List }
|
7
|
-
let(:list) { Fabricate(:list)
|
7
|
+
let(:list) { Fabricate(:list) }
|
8
8
|
let(:options) { {} }
|
9
9
|
|
10
|
-
let(:board) { Fabricate(:board)
|
11
|
-
let(:card) { Fabricate(:card)
|
10
|
+
let(:board) { Fabricate(:board) }
|
11
|
+
let(:card) { Fabricate(:card) }
|
12
12
|
let(:cards) { [] }
|
13
13
|
|
14
14
|
before do
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
module Presenters
|
5
|
+
describe Resource do
|
6
|
+
let(:described_class) { Resource }
|
7
|
+
let(:klass) do
|
8
|
+
stub('klass', id: '27',
|
9
|
+
short_id: '66',
|
10
|
+
name: 'My Resource',
|
11
|
+
type: type,
|
12
|
+
default?: default)
|
13
|
+
end
|
14
|
+
let(:options) { {} }
|
15
|
+
let(:default) { false }
|
16
|
+
|
17
|
+
describe '.list_view' do
|
18
|
+
subject { described_class.list_view(klass, options) }
|
19
|
+
|
20
|
+
context 'when the klass is a board' do
|
21
|
+
let(:type) { :board }
|
22
|
+
|
23
|
+
context 'and the resource is the default' do
|
24
|
+
let(:default) { true }
|
25
|
+
|
26
|
+
it 'returns a formatted string' do
|
27
|
+
subject
|
28
|
+
.must_equal("(27) \e[34m\e[4mMy Resource\e[0m *\n")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'but the resource is not the default' do
|
33
|
+
it 'returns a formatted string' do
|
34
|
+
subject.must_equal("(27) \e[34m\e[4mMy Resource\e[0m\n")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when the klass is a card' do
|
40
|
+
let(:type) { :card }
|
41
|
+
|
42
|
+
context 'and the resource is the default' do
|
43
|
+
let(:default) { true }
|
44
|
+
|
45
|
+
it 'returns a formatted string' do
|
46
|
+
subject
|
47
|
+
.must_equal("(\e[35m\e[4m66\e[0m) My Resource *\n")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'but the resource is not the default' do
|
52
|
+
it 'returns a formatted string' do
|
53
|
+
subject.must_equal("(\e[35m\e[4m66\e[0m) My Resource\n")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when the klass is a list' do
|
59
|
+
let(:type) { :list }
|
60
|
+
|
61
|
+
context 'and the resource is the default' do
|
62
|
+
let(:default) { true }
|
63
|
+
|
64
|
+
it 'returns a formatted string' do
|
65
|
+
subject
|
66
|
+
.must_equal("(27) \e[32m\e[4mMy Resource\e[0m *\n")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'but the resource is not the default' do
|
71
|
+
it 'returns a formatted string' do
|
72
|
+
subject.must_equal("(27) \e[32m\e[4mMy Resource\e[0m\n")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -3,14 +3,11 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Troo
|
4
4
|
module Remote
|
5
5
|
describe Board do
|
6
|
-
def load_mock_trello_response
|
7
|
-
json = File.read('./test/support/remotes/board.json')
|
8
|
-
hash = Yajl::Parser.parse(json)
|
9
|
-
Troo::Remote::Board.new(hash)
|
10
|
-
end
|
11
|
-
|
12
6
|
let(:described_class) { Board }
|
13
|
-
let(:resource)
|
7
|
+
let(:resource) do
|
8
|
+
mock_trello_response('board_200.json',
|
9
|
+
Troo::Remote::Board)
|
10
|
+
end
|
14
11
|
let(:described_instance) { described_class.new(resource) }
|
15
12
|
|
16
13
|
describe '.remote_options' do
|
@@ -54,7 +51,7 @@ module Troo
|
|
54
51
|
|
55
52
|
it 'returns an adapted resource for local persistence' do
|
56
53
|
subject.must_equal(
|
57
|
-
external_id: '
|
54
|
+
external_id: '20010',
|
58
55
|
name: 'My Test Board',
|
59
56
|
description: 'A very brief description...',
|
60
57
|
closed: false
|
@@ -4,14 +4,10 @@ module Troo
|
|
4
4
|
module Remote
|
5
5
|
describe Card do
|
6
6
|
let(:described_class) { Card }
|
7
|
-
let(:resource)
|
8
|
-
|
9
|
-
|
10
|
-
def load_mock_trello_response
|
11
|
-
json = File.read('./test/support/remotes/card.json')
|
12
|
-
hash = Yajl::Parser.parse(json)
|
13
|
-
Troo::Remote::Card.new(hash)
|
7
|
+
let(:resource) do
|
8
|
+
mock_trello_response('card.json', Troo::Remote::Card)
|
14
9
|
end
|
10
|
+
let(:described_instance) { described_class.new(resource) }
|
15
11
|
|
16
12
|
describe '.remote_options' do
|
17
13
|
subject { described_class.remote_options }
|
@@ -62,10 +58,10 @@ module Troo
|
|
62
58
|
|
63
59
|
it 'returns an adapted resource for local persistence' do
|
64
60
|
subject.must_equal(
|
65
|
-
external_board_id: '
|
66
|
-
external_list_id: '
|
67
|
-
external_id: '
|
68
|
-
external_member_ids: ['
|
61
|
+
external_board_id: '20010',
|
62
|
+
external_list_id: '20040',
|
63
|
+
external_id: '20020',
|
64
|
+
external_member_ids: ['20050'],
|
69
65
|
short_id: 67,
|
70
66
|
name: 'My Test Card',
|
71
67
|
desc: 'some description',
|
@@ -3,14 +3,10 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Troo
|
4
4
|
module Remote
|
5
5
|
describe Comment do
|
6
|
-
def load_mock_trello_response
|
7
|
-
json = File.read('./test/support/remotes/comment.json')
|
8
|
-
hash = Yajl::Parser.parse(json)
|
9
|
-
Troo::Remote::Comment.new(hash)
|
10
|
-
end
|
11
|
-
|
12
6
|
let(:described_class) { Comment }
|
13
|
-
let(:resource)
|
7
|
+
let(:resource) do
|
8
|
+
mock_trello_response('comment.json', Troo::Remote::Comment)
|
9
|
+
end
|
14
10
|
let(:described_instance) { described_class.new(resource) }
|
15
11
|
|
16
12
|
describe '.remote_options' do
|
@@ -41,7 +37,7 @@ module Troo
|
|
41
37
|
subject { described_instance.external_board_id }
|
42
38
|
|
43
39
|
it 'delegates to the CommentData model' do
|
44
|
-
subject.must_equal('
|
40
|
+
subject.must_equal('20010')
|
45
41
|
end
|
46
42
|
end
|
47
43
|
|
@@ -49,7 +45,7 @@ module Troo
|
|
49
45
|
subject { described_instance.external_card_id }
|
50
46
|
|
51
47
|
it 'delegates to the CommentData model' do
|
52
|
-
subject.must_equal('
|
48
|
+
subject.must_equal('20020')
|
53
49
|
end
|
54
50
|
end
|
55
51
|
|
@@ -57,7 +53,7 @@ module Troo
|
|
57
53
|
subject { described_instance.external_comment_id }
|
58
54
|
|
59
55
|
it 'returns the value of the id attribute' do
|
60
|
-
subject.must_equal('
|
56
|
+
subject.must_equal('20030')
|
61
57
|
end
|
62
58
|
end
|
63
59
|
|
@@ -86,10 +82,10 @@ module Troo
|
|
86
82
|
|
87
83
|
it 'returns an adapted resource for local persistence' do
|
88
84
|
subject.must_equal(
|
89
|
-
external_id: '
|
90
|
-
external_board_id: '
|
91
|
-
external_card_id: '
|
92
|
-
external_member_id: '
|
85
|
+
external_id: '20030',
|
86
|
+
external_board_id: '20010',
|
87
|
+
external_card_id: '20020',
|
88
|
+
external_member_id: '20050',
|
93
89
|
date: '2014-02-07T18:02:24.297Z',
|
94
90
|
text: 'My Test Comment'
|
95
91
|
)
|
@@ -3,14 +3,10 @@ require_relative '../../../test_helper'
|
|
3
3
|
module Troo
|
4
4
|
module Remote
|
5
5
|
describe List do
|
6
|
-
def load_mock_trello_response
|
7
|
-
json = File.read('./test/support/remotes/list.json')
|
8
|
-
hash = Yajl::Parser.parse(json)
|
9
|
-
Troo::Remote::List.new(hash)
|
10
|
-
end
|
11
|
-
|
12
6
|
let(:described_class) { List }
|
13
|
-
let(:resource)
|
7
|
+
let(:resource) do
|
8
|
+
mock_trello_response('list.json', Troo::Remote::List)
|
9
|
+
end
|
14
10
|
let(:described_instance) { described_class.new(resource) }
|
15
11
|
|
16
12
|
describe '.remote_options' do
|
@@ -54,8 +50,8 @@ module Troo
|
|
54
50
|
|
55
51
|
it 'returns an adapted resource for local persistence' do
|
56
52
|
subject.must_equal(
|
57
|
-
external_board_id: '
|
58
|
-
external_id: '
|
53
|
+
external_board_id: '20010',
|
54
|
+
external_id: '20040',
|
59
55
|
name: 'My Test List',
|
60
56
|
position: 32_768,
|
61
57
|
closed: false
|
@@ -4,14 +4,10 @@ module Troo
|
|
4
4
|
module Remote
|
5
5
|
describe Member do
|
6
6
|
let(:described_class) { Member }
|
7
|
-
let(:resource)
|
8
|
-
|
9
|
-
|
10
|
-
def load_mock_trello_response
|
11
|
-
json = File.read('./test/support/remotes/member.json')
|
12
|
-
hash = Yajl::Parser.parse(json)
|
13
|
-
Troo::Remote::Member.new(hash)
|
7
|
+
let(:resource) do
|
8
|
+
mock_trello_response('member.json', Troo::Remote::Member)
|
14
9
|
end
|
10
|
+
let(:described_instance) { described_class.new(resource) }
|
15
11
|
|
16
12
|
describe '.remote_options' do
|
17
13
|
subject { described_class.remote_options }
|
@@ -54,12 +50,12 @@ module Troo
|
|
54
50
|
|
55
51
|
it 'returns an adapted resource for local persistence' do
|
56
52
|
subject.must_equal(
|
57
|
-
external_id: '
|
53
|
+
external_id: '20050',
|
58
54
|
username: 'gavinlaking1',
|
59
55
|
email: 'gavinlaking@gmail.com',
|
60
56
|
full_name: 'Gavin Laking',
|
61
57
|
initials: 'GL',
|
62
|
-
avatar_id: '
|
58
|
+
avatar_id: '20001',
|
63
59
|
bio: 'some bio',
|
64
60
|
url: '<Trello URL>'
|
65
61
|
)
|
@@ -5,7 +5,7 @@ module Troo
|
|
5
5
|
module Persistence
|
6
6
|
describe Card do
|
7
7
|
let(:described_class) { Card }
|
8
|
-
let(:external_list_id) { '
|
8
|
+
let(:external_list_id) { '20040' }
|
9
9
|
let(:resource_name) { 'My New Card' }
|
10
10
|
let(:description) { 'A description to get us started.' }
|
11
11
|
let(:card) do
|
@@ -5,7 +5,7 @@ module Troo
|
|
5
5
|
module Persistence
|
6
6
|
describe Comment do
|
7
7
|
let(:described_class) { Comment }
|
8
|
-
let(:external_card_id) { '
|
8
|
+
let(:external_card_id) { '20020' }
|
9
9
|
let(:text) { 'Some much needed feedback...' }
|
10
10
|
let(:comment) do
|
11
11
|
[Fabricate.build(:comment, text: text)]
|
@@ -5,7 +5,7 @@ module Troo
|
|
5
5
|
module Persistence
|
6
6
|
describe List do
|
7
7
|
let(:described_class) { List }
|
8
|
-
let(:external_board_id) { '
|
8
|
+
let(:external_board_id) { '20010' }
|
9
9
|
let(:resource_name) { 'My New List' }
|
10
10
|
let(:list) do
|
11
11
|
[Fabricate.build(:list, name: resource_name)]
|
@@ -5,9 +5,9 @@ module Troo
|
|
5
5
|
module Persistence
|
6
6
|
describe MoveCard do
|
7
7
|
let(:described_class) { MoveCard }
|
8
|
-
let(:external_board_id) { '
|
9
|
-
let(:external_card_id) { '
|
10
|
-
let(:external_list_id) { '
|
8
|
+
let(:external_board_id) { '20010' }
|
9
|
+
let(:external_card_id) { '20020' }
|
10
|
+
let(:external_list_id) { '20040' }
|
11
11
|
let(:card) { [Fabricate.build(:card)] }
|
12
12
|
|
13
13
|
before do
|
@@ -12,6 +12,7 @@ module Troo
|
|
12
12
|
let(:local_resource) {}
|
13
13
|
let(:remote_resource) { [] }
|
14
14
|
let(:default_resource) {}
|
15
|
+
let(:count) { 2 }
|
15
16
|
|
16
17
|
before do
|
17
18
|
Troo::Board.stubs(:default).returns(default_board)
|
@@ -21,6 +22,7 @@ module Troo
|
|
21
22
|
klass.stubs(:[]).returns(local_resource)
|
22
23
|
klass.stubs(:by_external_id).returns(local_resource)
|
23
24
|
Retrieval::Remote.stubs(:fetch).returns(remote_resource)
|
25
|
+
klass.stubs(:count).returns(count)
|
24
26
|
end
|
25
27
|
|
26
28
|
describe '.all' do
|
@@ -102,7 +104,17 @@ module Troo
|
|
102
104
|
context 'and a default board exists' do
|
103
105
|
let(:default_board) { stub(external_id: 27) }
|
104
106
|
|
105
|
-
context 'and
|
107
|
+
context 'and more than 1 with this short_id' do
|
108
|
+
let(:local_resource) { stub }
|
109
|
+
|
110
|
+
it 'use the default board to return the correct ' \
|
111
|
+
'resource' do
|
112
|
+
subject.must_equal(local_resource)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'and 0 or 1 of this resource exists' do
|
117
|
+
let(:count) { 1 }
|
106
118
|
let(:local_resource) { stub }
|
107
119
|
|
108
120
|
it 'returns the resource' do
|
data/test/support/fabrication.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Fabricator(:board, from: Troo::Board) do
|
2
|
-
external_id
|
2
|
+
external_id '20010'
|
3
3
|
name 'My Test Board'
|
4
4
|
description 'A very brief description...'
|
5
5
|
default false
|
@@ -7,8 +7,8 @@ Fabricator(:board, from: Troo::Board) do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Fabricator(:list, from: Troo::List) do
|
10
|
-
external_board_id '
|
11
|
-
external_id '
|
10
|
+
external_board_id '20010'
|
11
|
+
external_id '20040'
|
12
12
|
name 'My Test List'
|
13
13
|
position 32_768
|
14
14
|
default false
|
@@ -16,10 +16,10 @@ Fabricator(:list, from: Troo::List) do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
Fabricator(:card, from: Troo::Card) do
|
19
|
-
external_board_id '
|
20
|
-
external_list_id '
|
21
|
-
external_id '
|
22
|
-
external_member_ids ['
|
19
|
+
external_board_id '20010'
|
20
|
+
external_list_id '20040'
|
21
|
+
external_id '20020'
|
22
|
+
external_member_ids ['20050']
|
23
23
|
short_id '67'
|
24
24
|
name 'My Test Card'
|
25
25
|
desc 'some description'
|
@@ -31,16 +31,16 @@ Fabricator(:card, from: Troo::Card) do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
Fabricator(:comment, from: Troo::Comment) do
|
34
|
-
external_board_id '
|
35
|
-
external_card_id '
|
36
|
-
external_id '
|
37
|
-
external_member_id '
|
34
|
+
external_board_id '20010'
|
35
|
+
external_card_id '20020'
|
36
|
+
external_id '20030'
|
37
|
+
external_member_id '20050'
|
38
38
|
text 'My Test Comment'
|
39
39
|
date '2013-12-17 22:01:13 UTC'
|
40
40
|
end
|
41
41
|
|
42
42
|
Fabricator(:member, from: Troo::Member) do
|
43
|
-
external_id '
|
43
|
+
external_id '20050'
|
44
44
|
username 'gavinlaking1'
|
45
45
|
email 'gavinlaking@gmail.com'
|
46
46
|
full_name 'Gavin Laking'
|
@@ -33,6 +33,23 @@ class FakeResponse
|
|
33
33
|
|
34
34
|
def raw
|
35
35
|
@raw ||= File
|
36
|
-
.read(File.dirname(__FILE__) +
|
36
|
+
.read(File.dirname(__FILE__) + '/../remotes/' + filename)
|
37
|
+
end
|
38
|
+
|
39
|
+
def filename
|
40
|
+
testing || reality
|
41
|
+
end
|
42
|
+
|
43
|
+
def testing
|
44
|
+
resource + '_200.json' if testing?
|
45
|
+
end
|
46
|
+
|
47
|
+
def testing?
|
48
|
+
id =~ /^200/
|
49
|
+
end
|
50
|
+
|
51
|
+
def reality
|
52
|
+
return [resource, '_', id, '.json'].join if id
|
53
|
+
[resource, '.json'].join
|
37
54
|
end
|
38
55
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"id": "
|
2
|
+
"id": "20010",
|
3
3
|
"name": "My Test Board",
|
4
4
|
"desc": "A very brief description...",
|
5
5
|
"descData": null,
|
@@ -35,7 +35,106 @@
|
|
35
35
|
"green": "Ready to Pull",
|
36
36
|
"blue": ""
|
37
37
|
},
|
38
|
-
"cards": [
|
39
|
-
|
40
|
-
|
38
|
+
"cards": [
|
39
|
+
{
|
40
|
+
"id": "20020",
|
41
|
+
"checkItemStates": [],
|
42
|
+
"closed": true,
|
43
|
+
"dateLastActivity": "2013-10-27T22:10:19.584Z",
|
44
|
+
"desc": "",
|
45
|
+
"descData": null,
|
46
|
+
"idBoard": "20010",
|
47
|
+
"idList": "20040",
|
48
|
+
"idMembersVoted": [],
|
49
|
+
"idShort": 1,
|
50
|
+
"idAttachmentCover": null,
|
51
|
+
"manualCoverAttachment": false,
|
52
|
+
"name": "Command: config",
|
53
|
+
"pos": 327679,
|
54
|
+
"shortLink": "1G0cGaRV",
|
55
|
+
"badges": {
|
56
|
+
"votes": 0,
|
57
|
+
"viewingMemberVoted": false,
|
58
|
+
"subscribed": false,
|
59
|
+
"fogbugz": "",
|
60
|
+
"checkItems": 0,
|
61
|
+
"checkItemsChecked": 0,
|
62
|
+
"comments": 0,
|
63
|
+
"attachments": 0,
|
64
|
+
"description": false,
|
65
|
+
"due": null
|
66
|
+
},
|
67
|
+
"due": null,
|
68
|
+
"idChecklists": [],
|
69
|
+
"idMembers": [],
|
70
|
+
"labels": [],
|
71
|
+
"shortUrl": "<Trello URL>",
|
72
|
+
"subscribed": false,
|
73
|
+
"url": "<Trello URL>"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"id": "20021",
|
77
|
+
"checkItemStates": [],
|
78
|
+
"closed": false,
|
79
|
+
"dateLastActivity": "2014-02-07T19:39:15.075Z",
|
80
|
+
"desc": "A description to get us started.",
|
81
|
+
"descData": null,
|
82
|
+
"idBoard": "20010",
|
83
|
+
"idList": "20040",
|
84
|
+
"idMembersVoted": [],
|
85
|
+
"idShort": 27,
|
86
|
+
"idAttachmentCover": null,
|
87
|
+
"manualCoverAttachment": false,
|
88
|
+
"name": "My New Card",
|
89
|
+
"pos": 606207,
|
90
|
+
"shortLink": "OMnSslgP",
|
91
|
+
"badges": {
|
92
|
+
"votes": 0,
|
93
|
+
"viewingMemberVoted": false,
|
94
|
+
"subscribed": false,
|
95
|
+
"fogbugz": "",
|
96
|
+
"checkItems": 0,
|
97
|
+
"checkItemsChecked": 0,
|
98
|
+
"comments": 1,
|
99
|
+
"attachments": 0,
|
100
|
+
"description": true,
|
101
|
+
"due": null
|
102
|
+
},
|
103
|
+
"due": null,
|
104
|
+
"idChecklists": [],
|
105
|
+
"idMembers": [],
|
106
|
+
"labels": [],
|
107
|
+
"shortUrl": "<Trello URL>",
|
108
|
+
"subscribed": false,
|
109
|
+
"url": "<Trello URL>"
|
110
|
+
}
|
111
|
+
],
|
112
|
+
"members": [
|
113
|
+
{
|
114
|
+
"id": "20050",
|
115
|
+
"avatarHash": "20001",
|
116
|
+
"initials": "GL",
|
117
|
+
"fullName": "Gavin Laking",
|
118
|
+
"username": "gavinlaking1",
|
119
|
+
"confirmed": true
|
120
|
+
}
|
121
|
+
],
|
122
|
+
"lists": [
|
123
|
+
{
|
124
|
+
"id": "20040",
|
125
|
+
"name": "My New List",
|
126
|
+
"closed": true,
|
127
|
+
"idBoard": "20010",
|
128
|
+
"pos": 256,
|
129
|
+
"subscribed": false
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"id": "20041",
|
133
|
+
"name": "My New List",
|
134
|
+
"closed": true,
|
135
|
+
"idBoard": "20010",
|
136
|
+
"pos": 512,
|
137
|
+
"subscribed": false
|
138
|
+
}
|
139
|
+
]
|
41
140
|
}
|