troo 0.0.7 → 0.0.8
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 -0
- data/.rubocop.yml +2 -0
- data/Guardfile +3 -1
- data/Rakefile +7 -0
- data/bin/troo +3 -8
- data/config/.gitkeep +0 -0
- data/config/cucumber.yml +8 -0
- data/features/add/board.feature +26 -0
- data/features/add/card.feature +34 -0
- data/features/add/comment.feature +21 -0
- data/features/add/list.feature +24 -0
- data/features/cleanup.feature +13 -0
- data/features/default/board.feature +21 -0
- data/features/default/card.feature +21 -0
- data/features/default/list.feature +21 -0
- data/features/refresh/all.feature +7 -0
- data/features/refresh/board.feature +26 -0
- data/features/refresh/card.feature +27 -0
- data/features/refresh/list.feature +27 -0
- data/features/show/board.feature +32 -0
- data/features/show/card.feature +62 -0
- data/features/show/comment.feature +39 -0
- data/features/show/list.feature +37 -0
- data/features/status.feature +46 -1
- data/features/step_definitions/fabrication_steps.rb +34 -0
- data/features/step_definitions/troo_steps.rb +16 -0
- data/features/support/env.rb +22 -24
- data/features/troo.feature +31 -1
- data/lib/troo/actions/create_board.rb +10 -7
- data/lib/troo/actions/create_card.rb +5 -4
- data/lib/troo/actions/create_comment.rb +15 -13
- data/lib/troo/actions/create_list.rb +5 -4
- data/lib/troo/actions/move_card.rb +4 -3
- data/lib/troo/{external/board_adaptor.rb → adaptors/board.rb} +3 -14
- data/lib/troo/{external/card_adaptor.rb → adaptors/card.rb} +4 -15
- data/lib/troo/{external/comment_adaptor.rb → adaptors/comment.rb} +6 -17
- data/lib/troo/{external/list_adaptor.rb → adaptors/list.rb} +3 -14
- data/lib/troo/{external/member_adaptor.rb → adaptors/member.rb} +3 -14
- data/lib/troo/adaptors/resource.rb +17 -0
- data/lib/troo/cli/add.rb +53 -0
- data/lib/troo/cli/default.rb +25 -0
- data/lib/troo/cli/main.rb +46 -0
- data/lib/troo/cli/refresh.rb +31 -0
- data/lib/troo/cli/show.rb +41 -0
- data/lib/troo/cli/thor_fixes.rb +13 -0
- data/lib/troo/commands/add/board.rb +26 -0
- data/lib/troo/commands/add/card.rb +33 -0
- data/lib/troo/commands/add/comment.rb +33 -0
- data/lib/troo/commands/add/list.rb +33 -0
- data/lib/troo/commands/add/resource.rb +21 -0
- data/lib/troo/commands/commands.rb +28 -0
- data/lib/troo/commands/default/board.rb +25 -0
- data/lib/troo/commands/default/card.rb +25 -0
- data/lib/troo/commands/default/list.rb +25 -0
- data/lib/troo/commands/default/resource.rb +26 -0
- data/lib/troo/commands/refresh/all.rb +41 -0
- data/lib/troo/commands/refresh/board.rb +28 -0
- data/lib/troo/commands/refresh/card.rb +29 -0
- data/lib/troo/commands/refresh/list.rb +29 -0
- data/lib/troo/commands/refresh/resource.rb +42 -0
- data/lib/troo/commands/show/board.rb +13 -0
- data/lib/troo/commands/show/boards.rb +35 -0
- data/lib/troo/commands/show/card.rb +13 -0
- data/lib/troo/commands/show/comments.rb +21 -0
- data/lib/troo/commands/show/list.rb +13 -0
- data/lib/troo/commands/show/resource.rb +41 -0
- data/lib/troo/commands/status/board.rb +30 -0
- data/lib/troo/commands/status/card.rb +30 -0
- data/lib/troo/commands/status/list.rb +30 -0
- data/lib/troo/commands/status/resource.rb +34 -0
- data/lib/troo/decorators/board.rb +66 -0
- data/lib/troo/decorators/card.rb +105 -0
- data/lib/troo/decorators/comment.rb +36 -0
- data/lib/troo/decorators/list.rb +60 -0
- data/lib/troo/decorators/member.rb +28 -0
- data/lib/troo/external/board.rb +14 -26
- data/lib/troo/external/card.rb +2 -19
- data/lib/troo/external/comment.rb +5 -23
- data/lib/troo/external/list.rb +2 -20
- data/lib/troo/external/member.rb +2 -20
- data/lib/troo/external/resource.rb +21 -6
- data/lib/troo/helpers/command_helpers.rb +37 -0
- data/lib/troo/{display → helpers}/decorator_helpers.rb +23 -17
- data/lib/troo/{models → helpers}/model_helpers.rb +1 -1
- data/lib/troo/models/behaviours/set_default.rb +49 -0
- data/lib/troo/models/board.rb +10 -7
- data/lib/troo/models/card.rb +33 -15
- data/lib/troo/models/comment.rb +8 -5
- data/lib/troo/models/list.rb +10 -6
- data/lib/troo/models/member.rb +7 -4
- data/lib/troo/models/persistence/board.rb +19 -0
- data/lib/troo/models/persistence/card.rb +19 -0
- data/lib/troo/models/persistence/comment.rb +19 -0
- data/lib/troo/models/persistence/list.rb +19 -0
- data/lib/troo/models/persistence/member.rb +19 -0
- data/lib/troo/models/persistence/resource.rb +50 -0
- data/lib/troo/models/refresh.rb +1 -1
- data/lib/troo/models/remote/comment.rb +21 -0
- data/lib/troo/models/remote/resource.rb +25 -0
- data/lib/troo/models/retrieval/board.rb +29 -0
- data/lib/troo/models/retrieval/card.rb +33 -0
- data/lib/troo/models/retrieval/comment.rb +25 -0
- data/lib/troo/models/retrieval/list.rb +29 -0
- data/lib/troo/models/retrieval/member.rb +25 -0
- data/lib/troo/models/retrieval/resource.rb +36 -0
- data/lib/troo/presentation/sentence.rb +57 -0
- data/lib/troo/presentation/template.rb +4 -3
- data/lib/troo/presenters/board.rb +81 -0
- data/lib/troo/presenters/card.rb +30 -0
- data/lib/troo/presenters/comment.rb +38 -0
- data/lib/troo/presenters/list.rb +44 -0
- data/lib/troo/presenters/member.rb +32 -0
- data/lib/troo/troo.rb +79 -65
- data/lib/troo/version.rb +1 -2
- data/lib/troo.rb +36 -8
- data/test/lib/troo/actions/create_board_test.rb +34 -15
- data/test/lib/troo/actions/create_card_test.rb +35 -18
- data/test/lib/troo/actions/create_comment_test.rb +38 -16
- data/test/lib/troo/actions/create_list_test.rb +31 -15
- data/test/lib/troo/actions/move_card_test.rb +23 -15
- data/test/lib/troo/adaptors/board_test.rb +38 -0
- data/test/lib/troo/adaptors/card_test.rb +49 -0
- data/test/lib/troo/adaptors/comment_test.rb +41 -0
- data/test/lib/troo/adaptors/list_test.rb +38 -0
- data/test/lib/troo/adaptors/member_test.rb +44 -0
- data/test/lib/troo/commands/add/board_test.rb +43 -0
- data/test/lib/troo/commands/add/card_test.rb +44 -0
- data/test/lib/troo/commands/add/comment_test.rb +44 -0
- data/test/lib/troo/commands/add/list_test.rb +44 -0
- data/test/lib/troo/commands/add/resource_test.rb +25 -0
- data/test/lib/troo/commands/default/board_test.rb +37 -0
- data/test/lib/troo/commands/default/card_test.rb +37 -0
- data/test/lib/troo/commands/default/list_test.rb +37 -0
- data/test/lib/troo/commands/default/resource_test.rb +20 -0
- data/test/lib/troo/commands/refresh/all_test.rb +39 -0
- data/test/lib/troo/commands/refresh/board_test.rb +62 -0
- data/test/lib/troo/commands/refresh/card_test.rb +62 -0
- data/test/lib/troo/commands/refresh/list_test.rb +62 -0
- data/test/lib/troo/commands/refresh/resource_test.rb +20 -0
- data/test/lib/troo/commands/show/board_test.rb +65 -0
- data/test/lib/troo/commands/show/boards_test.rb +36 -0
- data/test/lib/troo/commands/show/card_test.rb +64 -0
- data/test/lib/troo/commands/show/comments_test.rb +64 -0
- data/test/lib/troo/commands/show/list_test.rb +64 -0
- data/test/lib/troo/commands/show/resource_test.rb +25 -0
- data/test/lib/troo/commands/status/board_test.rb +43 -0
- data/test/lib/troo/commands/status/card_test.rb +43 -0
- data/test/lib/troo/commands/status/list_test.rb +43 -0
- data/test/lib/troo/commands/status/resource_test.rb +19 -0
- data/test/lib/troo/decorators/board_test.rb +129 -0
- data/test/lib/troo/decorators/card_test.rb +237 -0
- data/test/lib/troo/decorators/comment_test.rb +74 -0
- data/test/lib/troo/decorators/list_test.rb +102 -0
- data/test/lib/troo/decorators/member_test.rb +50 -0
- data/test/lib/troo/external/board_test.rb +74 -41
- data/test/lib/troo/external/card_test.rb +49 -37
- data/test/lib/troo/external/comment_test.rb +43 -33
- data/test/lib/troo/external/list_test.rb +37 -30
- data/test/lib/troo/external/member_test.rb +37 -30
- data/test/lib/troo/external/resource_test.rb +18 -1
- data/test/lib/troo/helpers/command_helpers_test.rb +82 -0
- data/test/lib/troo/{display → helpers}/decorator_helpers_test.rb +6 -6
- data/test/lib/troo/helpers/model_helpers_test.rb +103 -0
- data/test/lib/troo/models/behaviours/set_default_test.rb +54 -0
- data/test/lib/troo/models/board_test.rb +13 -14
- data/test/lib/troo/models/card_test.rb +64 -33
- data/test/lib/troo/models/comment_test.rb +18 -19
- data/test/lib/troo/models/list_test.rb +15 -15
- data/test/lib/troo/models/member_test.rb +18 -18
- data/test/lib/troo/models/persistence/board_test.rb +62 -0
- data/test/lib/troo/models/persistence/card_test.rb +61 -0
- data/test/lib/troo/models/persistence/comment_test.rb +69 -0
- data/test/lib/troo/models/persistence/list_test.rb +60 -0
- data/test/lib/troo/models/persistence/member_test.rb +60 -0
- data/test/lib/troo/models/refresh_test.rb +12 -11
- data/test/lib/troo/models/remote/comment_test.rb +56 -0
- data/test/lib/troo/models/remote/resource_test.rb +26 -0
- data/test/lib/troo/models/retrieval/board_test.rb +93 -0
- data/test/lib/troo/models/retrieval/card_test.rb +101 -0
- data/test/lib/troo/models/retrieval/comment_test.rb +46 -0
- data/test/lib/troo/models/retrieval/list_test.rb +93 -0
- data/test/lib/troo/models/retrieval/member_test.rb +58 -0
- data/test/lib/troo/presentation/sentence_test.rb +57 -0
- data/test/lib/troo/presentation/template_test.rb +17 -16
- data/test/lib/troo/presenters/board_test.rb +79 -0
- data/test/lib/troo/presenters/card_test.rb +41 -0
- data/test/lib/troo/presenters/comment_test.rb +49 -0
- data/test/lib/troo/presenters/list_test.rb +50 -0
- data/test/lib/troo/presenters/member_test.rb +40 -0
- data/test/support/fabrication.rb +31 -32
- data/test/support/vcr_setup.rb +7 -9
- data/test/system_test.sh +55 -0
- data/test/test_helper.rb +10 -10
- data/troo.gemspec +1 -0
- metadata +232 -134
- data/features/add_board.feature +0 -1
- data/features/add_card.feature +0 -1
- data/features/add_comment.feature +0 -1
- data/features/add_list.feature +0 -1
- data/features/move_card_to_list.feature +0 -1
- data/features/refresh.feature +0 -1
- data/features/set_default.feature +0 -7
- data/features/show_board.feature +0 -1
- data/features/show_boards.feature +0 -1
- data/features/show_card.feature +0 -1
- data/features/show_comments.feature +0 -1
- data/features/show_list.feature +0 -1
- data/features/version.feature +0 -8
- data/lib/troo/actions/refresh_all.rb +0 -79
- data/lib/troo/actions/set_default.rb +0 -46
- data/lib/troo/cli/add_cli.rb +0 -83
- data/lib/troo/cli/cli_helpers.rb +0 -34
- data/lib/troo/cli/default_cli.rb +0 -32
- data/lib/troo/cli/main_cli.rb +0 -132
- data/lib/troo/cli/show_cli.rb +0 -64
- data/lib/troo/display/board_decorator.rb +0 -62
- data/lib/troo/display/board_presenter.rb +0 -71
- data/lib/troo/display/card_decorator.rb +0 -100
- data/lib/troo/display/card_presenter.rb +0 -27
- data/lib/troo/display/comment_decorator.rb +0 -33
- data/lib/troo/display/comment_presenter.rb +0 -31
- data/lib/troo/display/list_decorator.rb +0 -57
- data/lib/troo/display/list_presenter.rb +0 -41
- data/lib/troo/display/member_decorator.rb +0 -25
- data/lib/troo/display/member_presenter.rb +0 -59
- data/lib/troo/models/board_persistence.rb +0 -25
- data/lib/troo/models/board_retrieval.rb +0 -45
- data/lib/troo/models/card_persistence.rb +0 -25
- data/lib/troo/models/card_retrieval.rb +0 -49
- data/lib/troo/models/comment_persistence.rb +0 -25
- data/lib/troo/models/comment_retrieval.rb +0 -32
- data/lib/troo/models/list_persistence.rb +0 -25
- data/lib/troo/models/list_retrieval.rb +0 -45
- data/lib/troo/models/member_persistence.rb +0 -25
- data/lib/troo/models/member_retrieval.rb +0 -36
- data/lib/troo/models/persistence.rb +0 -39
- data/test/lib/troo/actions/refresh_all_test.rb +0 -68
- data/test/lib/troo/actions/set_default_test.rb +0 -44
- data/test/lib/troo/cli/add_cli_test.rb +0 -216
- data/test/lib/troo/cli/cli_helpers_test.rb +0 -24
- data/test/lib/troo/cli/default_cli_test.rb +0 -85
- data/test/lib/troo/cli/main_cli_test.rb +0 -234
- data/test/lib/troo/cli/show_cli_test.rb +0 -251
- data/test/lib/troo/display/board_decorator_test.rb +0 -126
- data/test/lib/troo/display/board_presenter_test.rb +0 -77
- data/test/lib/troo/display/card_decorator_test.rb +0 -213
- data/test/lib/troo/display/card_presenter_test.rb +0 -38
- data/test/lib/troo/display/comment_decorator_test.rb +0 -70
- data/test/lib/troo/display/comment_presenter_test.rb +0 -47
- data/test/lib/troo/display/list_decorator_test.rb +0 -98
- data/test/lib/troo/display/list_presenter_test.rb +0 -48
- data/test/lib/troo/display/member_decorator_test.rb +0 -47
- data/test/lib/troo/display/member_presenter_test.rb +0 -70
- data/test/lib/troo/external/board_adaptor_test.rb +0 -36
- data/test/lib/troo/external/card_adaptor_test.rb +0 -50
- data/test/lib/troo/external/comment_adaptor_test.rb +0 -41
- data/test/lib/troo/external/list_adaptor_test.rb +0 -38
- data/test/lib/troo/external/member_adaptor_test.rb +0 -44
- data/test/lib/troo/models/board_persistence_test.rb +0 -61
- data/test/lib/troo/models/board_retrieval_test.rb +0 -93
- data/test/lib/troo/models/card_persistence_test.rb +0 -60
- data/test/lib/troo/models/card_retrieval_test.rb +0 -101
- data/test/lib/troo/models/comment_persistence_test.rb +0 -65
- data/test/lib/troo/models/comment_retrieval_test.rb +0 -46
- data/test/lib/troo/models/list_persistence_test.rb +0 -60
- data/test/lib/troo/models/list_retrieval_test.rb +0 -93
- data/test/lib/troo/models/member_persistence_test.rb +0 -59
- data/test/lib/troo/models/member_retrieval_test.rb +0 -58
- data/test/lib/troo/models/model_helpers_test.rb +0 -103
- data/test/lib/troo/models/persistence_test.rb +0 -6
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Troo
|
4
4
|
describe Card do
|
@@ -7,57 +7,89 @@ module Troo
|
|
7
7
|
|
8
8
|
subject { described_instance }
|
9
9
|
|
10
|
-
context
|
11
|
-
it
|
12
|
-
subject.short_id.must_equal
|
10
|
+
context 'attributes' do
|
11
|
+
it 'should have a short_id attribute' do
|
12
|
+
subject.short_id.must_equal '67'
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
subject.name.must_equal
|
15
|
+
it 'should have a name attribute' do
|
16
|
+
subject.name.must_equal 'My Test Card'
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
subject.desc.must_equal
|
19
|
+
it 'should have a desc attribute' do
|
20
|
+
subject.desc.must_equal 'some description'
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
subject.url.must_equal
|
23
|
+
it 'should have a url attribute' do
|
24
|
+
subject.url.must_equal 'some trello url'
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
describe '#external_member_ids' do
|
28
|
+
context 'when the attribute is set' do
|
29
|
+
context 'and the attribute is an array' do
|
30
|
+
it 'returns the attribute' do
|
31
|
+
subject.external_member_ids
|
32
|
+
.must_equal(['5195fdb5a8c01a2318004f5d'])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'and the attribute is a string' do
|
37
|
+
let(:member_ids) { "[\"5195fdb5a8c01a2318004f5d\"]" }
|
38
|
+
let(:described_instance) do
|
39
|
+
Fabricate.build(:card,
|
40
|
+
external_member_ids: member_ids)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'converts to an array and returns the attribute' do
|
44
|
+
subject.external_member_ids
|
45
|
+
.must_equal(['5195fdb5a8c01a2318004f5d'])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'when the attribute is not set' do
|
51
|
+
let(:described_instance) do
|
52
|
+
Fabricate.build(:card, external_member_ids: nil)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'returns an empty collection' do
|
56
|
+
subject.external_member_ids.must_equal([])
|
57
|
+
end
|
58
|
+
end
|
29
59
|
end
|
30
60
|
|
31
|
-
it
|
61
|
+
it 'should have a position attribute' do
|
32
62
|
subject.position.must_equal 16
|
33
63
|
end
|
34
64
|
|
35
|
-
it
|
36
|
-
subject.last_activity_date
|
65
|
+
it 'should have a last_activity_date attribute' do
|
66
|
+
subject.last_activity_date
|
67
|
+
.must_equal '2013-12-17 21:48:09 UTC'
|
37
68
|
end
|
38
69
|
|
39
|
-
it
|
70
|
+
it 'should have a default attribute' do
|
40
71
|
subject.default.must_equal false
|
41
72
|
end
|
42
73
|
|
43
|
-
it
|
74
|
+
it 'should have a closed attribute' do
|
44
75
|
subject.closed.must_equal false
|
45
76
|
end
|
46
77
|
|
47
|
-
it
|
48
|
-
subject.external_board_id
|
78
|
+
it 'should have an external_board_id attribute' do
|
79
|
+
subject.external_board_id
|
80
|
+
.must_equal '526d8e130a14a9d846001d96'
|
49
81
|
end
|
50
82
|
|
51
|
-
it
|
52
|
-
subject.external_list_id.must_equal
|
83
|
+
it 'should have an external_list_id attribute' do
|
84
|
+
subject.external_list_id.must_equal '526d8e130a14a9d846001d97'
|
53
85
|
end
|
54
86
|
|
55
|
-
it
|
56
|
-
subject.external_card_id.must_equal
|
87
|
+
it 'should have an external_card_id attribute' do
|
88
|
+
subject.external_card_id.must_equal '526d8f19ddb279532e005259'
|
57
89
|
end
|
58
90
|
end
|
59
91
|
|
60
|
-
context
|
92
|
+
context 'associations' do
|
61
93
|
before do
|
62
94
|
@board = Fabricate(:board)
|
63
95
|
@list = Fabricate(:list)
|
@@ -67,36 +99,35 @@ module Troo
|
|
67
99
|
|
68
100
|
after { database_cleanup }
|
69
101
|
|
70
|
-
it
|
102
|
+
it 'belongs to a board' do
|
71
103
|
subject.board.must_equal @board
|
72
104
|
end
|
73
105
|
|
74
|
-
it
|
106
|
+
it 'belongs to a list' do
|
75
107
|
subject.list.must_equal @list
|
76
108
|
end
|
77
109
|
|
78
|
-
it
|
110
|
+
it 'can have many comments' do
|
79
111
|
subject.comments.size.must_equal 1
|
80
112
|
end
|
81
113
|
|
82
|
-
it
|
114
|
+
it 'can have many comments' do
|
83
115
|
subject.recent_comments.size.must_equal 1
|
84
116
|
end
|
85
117
|
|
86
|
-
context
|
87
|
-
it
|
118
|
+
context 'when the card has members' do
|
119
|
+
it 'returns the collection of members' do
|
88
120
|
subject.members.size.must_equal 1
|
89
121
|
end
|
90
122
|
end
|
91
123
|
|
92
|
-
context
|
124
|
+
context 'when the card has no members' do
|
93
125
|
before { subject.stubs(:external_member_ids).returns([]) }
|
94
126
|
|
95
|
-
it
|
127
|
+
it 'returns an empty collection' do
|
96
128
|
subject.members.size.must_equal 0
|
97
129
|
end
|
98
130
|
end
|
99
131
|
end
|
100
132
|
end
|
101
133
|
end
|
102
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Troo
|
4
4
|
describe Comment do
|
@@ -7,33 +7,33 @@ module Troo
|
|
7
7
|
|
8
8
|
subject { described_instance }
|
9
9
|
|
10
|
-
context
|
11
|
-
it
|
12
|
-
subject.text.must_equal
|
10
|
+
context 'attributes' do
|
11
|
+
it 'should have a text attribute' do
|
12
|
+
subject.text.must_equal 'My Test Comment'
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
subject.date.must_equal
|
15
|
+
it 'should have a date attribute' do
|
16
|
+
subject.date.must_equal '2013-12-17 22:01:13 UTC'
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
subject.external_board_id.must_equal
|
19
|
+
it 'should have an external_board_id attribute' do
|
20
|
+
subject.external_board_id.must_equal '526d8e130a14a9d846001d96'
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
subject.external_card_id.must_equal
|
23
|
+
it 'should have an external_card_id attribute' do
|
24
|
+
subject.external_card_id.must_equal '526d8f19ddb279532e005259'
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
subject.external_comment_id.must_equal
|
27
|
+
it 'should have an external_comment_id attribute' do
|
28
|
+
subject.external_comment_id.must_equal '51f9277b2822b8654f0023af'
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
subject.external_member_id.must_equal
|
31
|
+
it 'should have a external_member_id attribute' do
|
32
|
+
subject.external_member_id.must_equal '5195fdb5a8c01a2318004f5d'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
context
|
36
|
+
context 'associations' do
|
37
37
|
before do
|
38
38
|
@board = Fabricate(:board)
|
39
39
|
@card = Fabricate(:card)
|
@@ -42,18 +42,17 @@ module Troo
|
|
42
42
|
|
43
43
|
after { database_cleanup }
|
44
44
|
|
45
|
-
it
|
45
|
+
it 'belongs to a board' do
|
46
46
|
subject.board.must_equal @board
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
49
|
+
it 'belongs to a card' do
|
50
50
|
subject.card.must_equal @card
|
51
51
|
end
|
52
52
|
|
53
|
-
it
|
53
|
+
it 'belongs to a member' do
|
54
54
|
subject.member.must_equal @member
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Troo
|
4
4
|
describe List do
|
@@ -7,33 +7,33 @@ module Troo
|
|
7
7
|
|
8
8
|
subject { described_instance }
|
9
9
|
|
10
|
-
context
|
11
|
-
it
|
12
|
-
subject.name.must_equal
|
10
|
+
context 'attributes' do
|
11
|
+
it 'should have a name attribute' do
|
12
|
+
subject.name.must_equal 'My Test List'
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
subject.position.must_equal
|
15
|
+
it 'should have a position attribute' do
|
16
|
+
subject.position.must_equal 32_768
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'should have a default attribute' do
|
20
20
|
subject.default.must_equal false
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it 'should have a closed attribute' do
|
24
24
|
subject.closed.must_equal false
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
subject.external_board_id.must_equal
|
27
|
+
it 'should have a external_board_id attribute' do
|
28
|
+
subject.external_board_id.must_equal '526d8e130a14a9d846001d96'
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
subject.external_list_id.must_equal
|
31
|
+
it 'should have an external_list_id attribute' do
|
32
|
+
subject.external_list_id.must_equal '526d8e130a14a9d846001d97'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
context
|
36
|
+
context 'associations' do
|
37
37
|
before do
|
38
38
|
@board = Fabricate(:board)
|
39
39
|
@card = Fabricate(:card)
|
@@ -41,11 +41,11 @@ module Troo
|
|
41
41
|
|
42
42
|
after { database_cleanup }
|
43
43
|
|
44
|
-
it
|
44
|
+
it 'belongs to a board' do
|
45
45
|
subject.board.must_equal @board
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it 'can have many cards' do
|
49
49
|
subject.cards.size.must_equal 1
|
50
50
|
end
|
51
51
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative '../../../test_helper'
|
2
2
|
|
3
3
|
module Troo
|
4
4
|
describe Member do
|
@@ -7,37 +7,37 @@ module Troo
|
|
7
7
|
|
8
8
|
subject { described_instance }
|
9
9
|
|
10
|
-
context
|
11
|
-
it
|
12
|
-
subject.username.must_equal
|
10
|
+
context 'attributes' do
|
11
|
+
it 'should have a username attribute' do
|
12
|
+
subject.username.must_equal 'gavinlaking1'
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
subject.email.must_equal
|
15
|
+
it 'should have an email attribute' do
|
16
|
+
subject.email.must_equal 'gavinlaking@gmail.com'
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
subject.full_name.must_equal
|
19
|
+
it 'should have a full_name attribute' do
|
20
|
+
subject.full_name.must_equal 'Gavin Laking'
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
subject.initials.must_equal
|
23
|
+
it 'should have an initials attribute' do
|
24
|
+
subject.initials.must_equal 'GL'
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
subject.avatar_id.must_equal
|
27
|
+
it 'should have an avatar_id attribute' do
|
28
|
+
subject.avatar_id.must_equal 'some_avatar_id'
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
subject.bio.must_equal
|
31
|
+
it 'should have a bio attribute' do
|
32
|
+
subject.bio.must_equal 'some bio'
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
subject.url.must_equal
|
35
|
+
it 'should have a url attribute' do
|
36
|
+
subject.url.must_equal 'http://www.gavinlaking.name/'
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
subject.external_member_id.must_equal
|
39
|
+
it 'should have an external_member_id attribute' do
|
40
|
+
subject.external_member_id.must_equal '5195fdb5a8c01a2318004f5d'
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require_relative '../../../../test_helper'
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe Persistence::Board do
|
5
|
+
let(:described_class) { Persistence::Board }
|
6
|
+
let(:resource) do
|
7
|
+
OpenStruct.new(
|
8
|
+
id: '526d8e130a14a9d846001d96',
|
9
|
+
name: resource_name,
|
10
|
+
description: 'A very brief description...',
|
11
|
+
closed: false)
|
12
|
+
end
|
13
|
+
let(:resource_name) { 'My Test Board' }
|
14
|
+
let(:options) { {} }
|
15
|
+
|
16
|
+
before { @board = Fabricate(:board) }
|
17
|
+
after { database_cleanup }
|
18
|
+
|
19
|
+
describe '.initialize' do
|
20
|
+
subject { described_class.new(resource, options) }
|
21
|
+
|
22
|
+
it 'assigns the resource to an instance variable' do
|
23
|
+
subject.instance_variable_get('@resource')
|
24
|
+
.must_equal(resource)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'assigns the options to an instance variable' do
|
28
|
+
subject.instance_variable_get('@options').must_equal(options)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#persist' do
|
33
|
+
subject { described_class.for(resource, options) }
|
34
|
+
|
35
|
+
context 'when there is already a local copy' do
|
36
|
+
context 'and the local copy is identical' do
|
37
|
+
it 'returns the local copy' do
|
38
|
+
subject.must_equal(@board)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'and the local copy is out of date' do
|
43
|
+
let(:resource_name) { 'My Renamed Board' }
|
44
|
+
|
45
|
+
it 'updates and returns the new local copy' do
|
46
|
+
subject.name.must_equal(resource_name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when there is not already a local copy' do
|
52
|
+
let(:resource_name) { 'My New Test Board' }
|
53
|
+
|
54
|
+
before { database_cleanup }
|
55
|
+
|
56
|
+
it 'creates and returns the new local copy' do
|
57
|
+
subject.name.must_equal(resource_name)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative '../../../../test_helper'
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe Persistence::Card do
|
5
|
+
let(:described_class) { Persistence::Card }
|
6
|
+
let(:resource) do
|
7
|
+
OpenStruct.new(
|
8
|
+
id: '526d8f19ddb279532e005259',
|
9
|
+
name: resource_name,
|
10
|
+
closed: false)
|
11
|
+
end
|
12
|
+
let(:resource_name) { 'My Test Card' }
|
13
|
+
let(:options) { {} }
|
14
|
+
|
15
|
+
before { @card = Fabricate(:card) }
|
16
|
+
after { database_cleanup }
|
17
|
+
|
18
|
+
describe '.initialize' do
|
19
|
+
subject { described_class.new(resource, options) }
|
20
|
+
|
21
|
+
it 'assigns the resource to an instance variable' do
|
22
|
+
subject.instance_variable_get('@resource')
|
23
|
+
.must_equal(resource)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'assigns the options to an instance variable' do
|
27
|
+
subject.instance_variable_get('@options').must_equal(options)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#persist' do
|
32
|
+
subject { described_class.for(resource, options) }
|
33
|
+
|
34
|
+
context 'when there is already a local copy' do
|
35
|
+
context 'and the local copy is identical' do
|
36
|
+
it 'returns the local copy' do
|
37
|
+
subject.must_equal(@card)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'and the local copy is out of date' do
|
42
|
+
let(:resource_name) { 'My Renamed Card' }
|
43
|
+
|
44
|
+
it 'updates and returns the new local copy' do
|
45
|
+
subject.name.must_equal(resource_name)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'when there is not already a local copy' do
|
51
|
+
let(:resource_name) { 'My New Test Card' }
|
52
|
+
|
53
|
+
before { database_cleanup }
|
54
|
+
|
55
|
+
it 'creates and returns the new local copy' do
|
56
|
+
subject.name.must_equal(resource_name)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative '../../../../test_helper'
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe Persistence::Comment do
|
5
|
+
let(:described_class) { Persistence::Comment }
|
6
|
+
let(:resource) do
|
7
|
+
OpenStruct.new(
|
8
|
+
id: '51f9277b2822b8654f0023af',
|
9
|
+
date: '2013-12-17 22:01:13 UTC',
|
10
|
+
data: {
|
11
|
+
'text' => resource_text,
|
12
|
+
'board' => {
|
13
|
+
'id' => '526d8e130a14a9d846001d96'
|
14
|
+
},
|
15
|
+
'card' => {
|
16
|
+
'id' => '526d8f19ddb279532e005259'
|
17
|
+
}
|
18
|
+
})
|
19
|
+
end
|
20
|
+
let(:resource_text) { 'My Test Comment' }
|
21
|
+
let(:options) { {} }
|
22
|
+
|
23
|
+
before { @comment = Fabricate(:comment) }
|
24
|
+
after { database_cleanup }
|
25
|
+
|
26
|
+
describe '.initialize' do
|
27
|
+
subject { described_class.new(resource, options) }
|
28
|
+
|
29
|
+
it 'assigns the resource to an instance variable' do
|
30
|
+
subject.instance_variable_get('@resource')
|
31
|
+
.must_equal(resource)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'assigns the options to an instance variable' do
|
35
|
+
subject.instance_variable_get('@options').must_equal(options)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#persist' do
|
40
|
+
subject { described_class.for(resource, options) }
|
41
|
+
|
42
|
+
context 'when there is already a local copy' do
|
43
|
+
context 'and the local copy is identical' do
|
44
|
+
it 'returns the local copy' do
|
45
|
+
subject.must_equal(@comment)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'and the local copy is out of date' do
|
50
|
+
let(:resource_text) { 'My Renamed Comment' }
|
51
|
+
|
52
|
+
it 'updates and returns the new local copy' do
|
53
|
+
subject.text.must_equal(resource_text)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when there is not already a local copy' do
|
59
|
+
let(:resource_text) { 'My New Test Comment' }
|
60
|
+
|
61
|
+
before { database_cleanup }
|
62
|
+
|
63
|
+
it 'creates and returns the new local copy' do
|
64
|
+
subject.text.must_equal(resource_text)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative '../../../../test_helper'
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe Persistence::List do
|
5
|
+
let(:described_class) { Persistence::List }
|
6
|
+
let(:resource) do
|
7
|
+
OpenStruct.new(
|
8
|
+
id: '526d8e130a14a9d846001d97',
|
9
|
+
name: resource_name,
|
10
|
+
closed: false)
|
11
|
+
end
|
12
|
+
let(:resource_name) { 'My Test List' }
|
13
|
+
let(:options) { {} }
|
14
|
+
|
15
|
+
before { @list = Fabricate(:list) }
|
16
|
+
after { database_cleanup }
|
17
|
+
|
18
|
+
describe '.initialize' do
|
19
|
+
subject { described_class.new(resource, options) }
|
20
|
+
|
21
|
+
it 'assigns the resource to an instance variable' do
|
22
|
+
subject.instance_variable_get('@resource').must_equal(resource)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'assigns the options to an instance variable' do
|
26
|
+
subject.instance_variable_get('@options').must_equal(options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#persist' do
|
31
|
+
subject { described_class.for(resource, options) }
|
32
|
+
|
33
|
+
context 'when there is already a local copy' do
|
34
|
+
context 'and the local copy is identical' do
|
35
|
+
it 'returns the local copy' do
|
36
|
+
subject.must_equal(@list)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'and the local copy is out of date' do
|
41
|
+
let(:resource_name) { 'My Renamed List' }
|
42
|
+
|
43
|
+
it 'updates and returns the new local copy' do
|
44
|
+
subject.name.must_equal(resource_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when there is not already a local copy' do
|
50
|
+
let(:resource_name) { 'My New Test List' }
|
51
|
+
|
52
|
+
before { database_cleanup }
|
53
|
+
|
54
|
+
it 'creates and returns the new local copy' do
|
55
|
+
subject.name.must_equal(resource_name)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative '../../../../test_helper'
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe Persistence::Member do
|
5
|
+
let(:described_class) { Persistence::Member }
|
6
|
+
let(:resource) do
|
7
|
+
OpenStruct.new(
|
8
|
+
id: '5195fdb5a8c01a2318004f5d',
|
9
|
+
full_name: resource_full_name)
|
10
|
+
end
|
11
|
+
let(:resource_full_name) { 'My Test Member' }
|
12
|
+
let(:options) { {} }
|
13
|
+
|
14
|
+
before { @member = Fabricate(:member) }
|
15
|
+
after { database_cleanup }
|
16
|
+
|
17
|
+
describe '.initialize' do
|
18
|
+
subject { described_class.new(resource, options) }
|
19
|
+
|
20
|
+
it 'assigns the resource to an instance variable' do
|
21
|
+
subject.instance_variable_get('@resource')
|
22
|
+
.must_equal(resource)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'assigns the options to an instance variable' do
|
26
|
+
subject.instance_variable_get('@options').must_equal(options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#persist' do
|
31
|
+
subject { described_class.for(resource, options) }
|
32
|
+
|
33
|
+
context 'when there is already a local copy' do
|
34
|
+
context 'and the local copy is identical' do
|
35
|
+
it 'returns the local copy' do
|
36
|
+
subject.must_equal(@member)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'and the local copy is out of date' do
|
41
|
+
let(:resource_full_name) { 'My Renamed Member' }
|
42
|
+
|
43
|
+
it 'updates and returns the new local copy' do
|
44
|
+
subject.full_name.must_equal(resource_full_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when there is not already a local copy' do
|
50
|
+
let(:resource_full_name) { 'My New Test Member' }
|
51
|
+
|
52
|
+
before { database_cleanup }
|
53
|
+
|
54
|
+
it 'creates and returns the new local copy' do
|
55
|
+
subject.full_name.must_equal(resource_full_name)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|