troo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.ruby-version +1 -0
- data/Gemfile +0 -1
- data/Guardfile +6 -0
- data/LICENSE.txt +1 -0
- data/README.md +46 -3
- data/Rakefile +11 -0
- data/bin/troo +12 -0
- data/configuration.yml.example +7 -0
- data/features/add_board.feature +1 -0
- data/features/add_card.feature +1 -0
- data/features/add_comment.feature +1 -0
- data/features/add_list.feature +1 -0
- data/features/cleanup.feature +0 -0
- data/features/move_card_to_list.feature +1 -0
- data/features/refresh.feature +1 -0
- data/features/set_default.feature +7 -0
- data/features/show_board.feature +1 -0
- data/features/show_boards.feature +1 -0
- data/features/show_card.feature +1 -0
- data/features/show_comments.feature +1 -0
- data/features/show_list.feature +1 -0
- data/features/status.feature +1 -0
- data/features/step_definitions/troo_steps.rb +0 -0
- data/features/support/env.rb +31 -0
- data/features/troo.feature +1 -0
- data/features/version.feature +8 -0
- data/lib/troo.rb +24 -2
- data/lib/troo/actions/create_board.rb +43 -0
- data/lib/troo/actions/create_card.rb +43 -0
- data/lib/troo/actions/create_comment.rb +44 -0
- data/lib/troo/actions/create_list.rb +41 -0
- data/lib/troo/actions/move_card.rb +36 -0
- data/lib/troo/actions/refresh_all.rb +79 -0
- data/lib/troo/actions/set_default.rb +35 -0
- data/lib/troo/cli/add_cli.rb +83 -0
- data/lib/troo/cli/default_cli.rb +37 -0
- data/lib/troo/cli/main_cli.rb +130 -0
- data/lib/troo/cli/show_cli.rb +83 -0
- data/lib/troo/cli/thor_fixes.rb +9 -0
- data/lib/troo/display/board_decorator.rb +58 -0
- data/lib/troo/display/board_presenter.rb +65 -0
- data/lib/troo/display/card_decorator.rb +105 -0
- data/lib/troo/display/card_presenter.rb +27 -0
- data/lib/troo/display/comment_decorator.rb +32 -0
- data/lib/troo/display/comment_presenter.rb +35 -0
- data/lib/troo/display/decorator_helpers.rb +76 -0
- data/lib/troo/display/list_decorator.rb +53 -0
- data/lib/troo/display/list_presenter.rb +43 -0
- data/lib/troo/display/member_decorator.rb +24 -0
- data/lib/troo/display/member_presenter.rb +59 -0
- data/lib/troo/external/board.rb +49 -0
- data/lib/troo/external/board_adaptor.rb +43 -0
- data/lib/troo/external/card.rb +70 -0
- data/lib/troo/external/card_adaptor.rb +78 -0
- data/lib/troo/external/comment.rb +64 -0
- data/lib/troo/external/comment_adaptor.rb +53 -0
- data/lib/troo/external/list.rb +58 -0
- data/lib/troo/external/list_adaptor.rb +48 -0
- data/lib/troo/external/member.rb +52 -0
- data/lib/troo/external/member_adaptor.rb +63 -0
- data/lib/troo/models/board.rb +26 -0
- data/lib/troo/models/board_persistence.rb +53 -0
- data/lib/troo/models/board_retrieval.rb +45 -0
- data/lib/troo/models/card.rb +54 -0
- data/lib/troo/models/card_persistence.rb +53 -0
- data/lib/troo/models/card_retrieval.rb +49 -0
- data/lib/troo/models/comment.rb +32 -0
- data/lib/troo/models/comment_persistence.rb +53 -0
- data/lib/troo/models/comment_retrieval.rb +32 -0
- data/lib/troo/models/list.rb +27 -0
- data/lib/troo/models/list_persistence.rb +53 -0
- data/lib/troo/models/list_retrieval.rb +45 -0
- data/lib/troo/models/member.rb +18 -0
- data/lib/troo/models/member_persistence.rb +53 -0
- data/lib/troo/models/member_retrieval.rb +36 -0
- data/lib/troo/models/model_helpers.rb +32 -0
- data/lib/troo/models/refresh.rb +23 -0
- data/lib/troo/presentation/template.rb +31 -0
- data/lib/troo/troo.rb +69 -0
- data/lib/troo/version.rb +2 -1
- data/lib/troo/views/card.erb +17 -0
- data/lib/troo/views/comment.erb +3 -0
- data/logs/.gitkeep +0 -0
- data/test/cassettes/board_by_id.yml +59 -0
- data/test/cassettes/boards_all.yml +118 -0
- data/test/cassettes/card_by_card_id.yml +58 -0
- data/test/cassettes/cards_by_board_id.yml +117 -0
- data/test/cassettes/cards_by_list_id.yml +114 -0
- data/test/cassettes/comments_by_board_id.yml +122 -0
- data/test/cassettes/comments_by_card_id.yml +114 -0
- data/test/cassettes/comments_by_list_id.yml +109 -0
- data/test/cassettes/create_board.yml +62 -0
- data/test/cassettes/create_card.yml +63 -0
- data/test/cassettes/create_comment.yml +67 -0
- data/test/cassettes/create_list.yml +60 -0
- data/test/cassettes/list_by_list_id.yml +56 -0
- data/test/cassettes/lists_by_board_id.yml +118 -0
- data/test/cassettes/member_by_member_id.yml +60 -0
- data/test/cassettes/members_by_board_id.yml +109 -0
- data/test/cassettes/move_card.yml +61 -0
- data/test/lib/troo/actions/create_board_test.rb +47 -0
- data/test/lib/troo/actions/create_card_test.rb +54 -0
- data/test/lib/troo/actions/create_comment_test.rb +49 -0
- data/test/lib/troo/actions/create_list_test.rb +49 -0
- data/test/lib/troo/actions/move_card_test.rb +46 -0
- data/test/lib/troo/actions/refresh_all_test.rb +68 -0
- data/test/lib/troo/actions/set_default_test.rb +44 -0
- data/test/lib/troo/cli/add_cli_test.rb +216 -0
- data/test/lib/troo/cli/default_cli_test.rb +79 -0
- data/test/lib/troo/cli/main_cli_test.rb +232 -0
- data/test/lib/troo/cli/show_cli_test.rb +221 -0
- data/test/lib/troo/cli/thor_fixes_test.rb +21 -0
- data/test/lib/troo/display/board_decorator_test.rb +126 -0
- data/test/lib/troo/display/board_presenter_test.rb +77 -0
- data/test/lib/troo/display/card_decorator_test.rb +221 -0
- data/test/lib/troo/display/card_presenter_test.rb +38 -0
- data/test/lib/troo/display/comment_decorator_test.rb +65 -0
- data/test/lib/troo/display/comment_presenter_test.rb +47 -0
- data/test/lib/troo/display/decorator_helpers_test.rb +7 -0
- data/test/lib/troo/display/list_decorator_test.rb +98 -0
- data/test/lib/troo/display/list_presenter_test.rb +48 -0
- data/test/lib/troo/display/member_decorator_test.rb +42 -0
- data/test/lib/troo/display/member_presenter_test.rb +70 -0
- data/test/lib/troo/external/board_adaptor_test.rb +36 -0
- data/test/lib/troo/external/board_test.rb +69 -0
- data/test/lib/troo/external/card_adaptor_test.rb +50 -0
- data/test/lib/troo/external/card_test.rb +108 -0
- data/test/lib/troo/external/comment_adaptor_test.rb +41 -0
- data/test/lib/troo/external/comment_test.rb +88 -0
- data/test/lib/troo/external/list_adaptor_test.rb +38 -0
- data/test/lib/troo/external/list_test.rb +65 -0
- data/test/lib/troo/external/member_adaptor_test.rb +44 -0
- data/test/lib/troo/external/member_test.rb +65 -0
- data/test/lib/troo/models/board_persistence_test.rb +61 -0
- data/test/lib/troo/models/board_retrieval_test.rb +93 -0
- data/test/lib/troo/models/board_test.rb +50 -0
- data/test/lib/troo/models/card_persistence_test.rb +60 -0
- data/test/lib/troo/models/card_retrieval_test.rb +101 -0
- data/test/lib/troo/models/card_test.rb +102 -0
- data/test/lib/troo/models/comment_persistence_test.rb +65 -0
- data/test/lib/troo/models/comment_retrieval_test.rb +46 -0
- data/test/lib/troo/models/comment_test.rb +59 -0
- data/test/lib/troo/models/list_persistence_test.rb +60 -0
- data/test/lib/troo/models/list_retrieval_test.rb +93 -0
- data/test/lib/troo/models/list_test.rb +53 -0
- data/test/lib/troo/models/member_persistence_test.rb +59 -0
- data/test/lib/troo/models/member_retrieval_test.rb +58 -0
- data/test/lib/troo/models/member_test.rb +44 -0
- data/test/lib/troo/models/model_helpers_test.rb +103 -0
- data/test/lib/troo/models/refresh_test.rb +45 -0
- data/test/lib/troo/presentation/template_test.rb +40 -0
- data/test/support/fabrication.rb +56 -0
- data/test/support/template.erb +3 -0
- data/test/support/vcr_setup.rb +36 -0
- data/test/test_helper.rb +30 -0
- data/troo.gemspec +24 -5
- metadata +501 -23
@@ -0,0 +1,109 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.trello.com/1/boards/526d8e130a14a9d846001d96
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Authorization:
|
15
|
+
- "<OAuth Credentials>"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
X-Powered-By:
|
24
|
+
- Express
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, must-revalidate, no-cache, no-store
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
29
|
+
Strict-Transport-Security:
|
30
|
+
- max-age=15768000
|
31
|
+
X-Xss-Protection:
|
32
|
+
- 1; mode=block
|
33
|
+
X-Frame-Options:
|
34
|
+
- DENY
|
35
|
+
X-Server-Time:
|
36
|
+
- '1389729856082'
|
37
|
+
Expires:
|
38
|
+
- Thu, 01 Jan 1970 00:00:00
|
39
|
+
Content-Type:
|
40
|
+
- application/json
|
41
|
+
Access-Control-Allow-Origin:
|
42
|
+
- "*"
|
43
|
+
Access-Control-Allow-Methods:
|
44
|
+
- GET, PUT, POST, DELETE
|
45
|
+
Content-Length:
|
46
|
+
- '717'
|
47
|
+
Vary:
|
48
|
+
- Accept-Encoding
|
49
|
+
Date:
|
50
|
+
- Tue, 14 Jan 2014 20:04:16 GMT
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: "{\"id\":\"526d8e130a14a9d846001d96\",\"name\":\"Troo App\",\"desc\":\"\",\"descData\":null,\"closed\":false,\"idOrganization\":null,\"pinned\":true,\"url\":\"<Trello URL>\",\"shortUrl\":\"<Trello URL>\",\"prefs\":{\"permissionLevel\":\"private\",\"voting\":\"disabled\",\"comments\":\"members\",\"invitations\":\"members\",\"selfJoin\":false,\"cardCovers\":true,\"cardAging\":\"regular\",\"background\":\"blue\",\"backgroundColor\":\"#205C7E\",\"backgroundImage\":null,\"backgroundImageScaled\":null,\"backgroundTile\":false,\"backgroundBrightness\":\"unknown\",\"canBePublic\":true,\"canBeOrg\":true,\"canBePrivate\":true,\"canInvite\":true},\"labelNames\":{\"yellow\":\"Analysis Complete\",\"red\":\"\",\"purple\":\"\",\"orange\":\"\",\"green\":\"Ready to Pull\",\"blue\":\"\"}}"
|
54
|
+
http_version:
|
55
|
+
recorded_at: Tue, 14 Jan 2014 20:04:15 GMT
|
56
|
+
- request:
|
57
|
+
method: get
|
58
|
+
uri: https://api.trello.com/1/boards/526d8e130a14a9d846001d96/members?filter=all
|
59
|
+
body:
|
60
|
+
encoding: US-ASCII
|
61
|
+
string: ''
|
62
|
+
headers:
|
63
|
+
Accept:
|
64
|
+
- "*/*; q=0.5, application/xml"
|
65
|
+
Accept-Encoding:
|
66
|
+
- gzip, deflate
|
67
|
+
Authorization:
|
68
|
+
- "<OAuth Credentials>"
|
69
|
+
User-Agent:
|
70
|
+
- Ruby
|
71
|
+
response:
|
72
|
+
status:
|
73
|
+
code: 200
|
74
|
+
message: OK
|
75
|
+
headers:
|
76
|
+
X-Powered-By:
|
77
|
+
- Express
|
78
|
+
Cache-Control:
|
79
|
+
- max-age=0, must-revalidate, no-cache, no-store
|
80
|
+
X-Content-Type-Options:
|
81
|
+
- nosniff
|
82
|
+
Strict-Transport-Security:
|
83
|
+
- max-age=15768000
|
84
|
+
X-Xss-Protection:
|
85
|
+
- 1; mode=block
|
86
|
+
X-Frame-Options:
|
87
|
+
- DENY
|
88
|
+
X-Server-Time:
|
89
|
+
- '1389729856709'
|
90
|
+
Expires:
|
91
|
+
- Thu, 01 Jan 1970 00:00:00
|
92
|
+
Content-Type:
|
93
|
+
- application/json
|
94
|
+
Access-Control-Allow-Origin:
|
95
|
+
- "*"
|
96
|
+
Access-Control-Allow-Methods:
|
97
|
+
- GET, PUT, POST, DELETE
|
98
|
+
Content-Length:
|
99
|
+
- '87'
|
100
|
+
Vary:
|
101
|
+
- Accept-Encoding
|
102
|
+
Date:
|
103
|
+
- Tue, 14 Jan 2014 20:04:16 GMT
|
104
|
+
body:
|
105
|
+
encoding: UTF-8
|
106
|
+
string: "[{\"id\":\"5195fdb5a8c01a2318004f5d\",\"fullName\":\"Gavin Laking\",\"username\":\"gavinlaking1\"}]"
|
107
|
+
http_version:
|
108
|
+
recorded_at: Tue, 14 Jan 2014 20:04:15 GMT
|
109
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: https://api.trello.com/1/cards/526d8f19ddb279532e005259/idList
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: value=526d8e130a14a9d846001d98
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Authorization:
|
15
|
+
- "<OAuth Credentials>"
|
16
|
+
Content-Length:
|
17
|
+
- '30'
|
18
|
+
Content-Type:
|
19
|
+
- application/x-www-form-urlencoded
|
20
|
+
User-Agent:
|
21
|
+
- Ruby
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
X-Powered-By:
|
28
|
+
- Express
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=0, must-revalidate, no-cache, no-store
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=15768000
|
35
|
+
X-Xss-Protection:
|
36
|
+
- 1; mode=block
|
37
|
+
X-Frame-Options:
|
38
|
+
- DENY
|
39
|
+
X-Server-Time:
|
40
|
+
- '1389729840225'
|
41
|
+
Expires:
|
42
|
+
- Thu, 01 Jan 1970 00:00:00
|
43
|
+
Content-Type:
|
44
|
+
- application/json
|
45
|
+
Access-Control-Allow-Origin:
|
46
|
+
- "*"
|
47
|
+
Access-Control-Allow-Methods:
|
48
|
+
- GET, PUT, POST, DELETE
|
49
|
+
Content-Length:
|
50
|
+
- '757'
|
51
|
+
Vary:
|
52
|
+
- Accept-Encoding
|
53
|
+
Date:
|
54
|
+
- Tue, 14 Jan 2014 20:04:00 GMT
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: "{\"id\":\"526d8f19ddb279532e005259\",\"badges\":{\"votes\":0,\"viewingMemberVoted\":false,\"subscribed\":false,\"fogbugz\":\"\",\"checkItems\":0,\"checkItemsChecked\":0,\"comments\":8,\"attachments\":0,\"description\":false,\"due\":null},\"checkItemStates\":[],\"closed\":false,\"dateLastActivity\":\"2014-01-14T20:04:00.195Z\",\"desc\":\"\",\"descData\":null,\"due\":null,\"idBoard\":\"526d8e130a14a9d846001d96\",\"idChecklists\":[],\"idList\":\"526d8e130a14a9d846001d98\",\"idMembers\":[\"5195fdb5a8c01a2318004f5d\"],\"idShort\":8,\"idAttachmentCover\":null,\"manualCoverAttachment\":false,\"labels\":[],\"name\":\"My
|
58
|
+
Test Card\",\"pos\":589823,\"shortUrl\":\"<Trello URL>\",\"url\":\"<Trello URL>\"}"
|
59
|
+
http_version:
|
60
|
+
recorded_at: Tue, 14 Jan 2014 20:03:59 GMT
|
61
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe CreateBoard do
|
5
|
+
let(:described_class) { CreateBoard }
|
6
|
+
let(:board_name) { "My New Board" }
|
7
|
+
let(:description) { "A very brief description..." }
|
8
|
+
|
9
|
+
before do
|
10
|
+
@board = Fabricate(:board, name: board_name, description: description)
|
11
|
+
Troo::BoardPersistence.stubs(:for).returns(@board)
|
12
|
+
end
|
13
|
+
|
14
|
+
after { database_cleanup }
|
15
|
+
|
16
|
+
describe ".initialize" do
|
17
|
+
subject { described_class.new(board_name, description) }
|
18
|
+
|
19
|
+
it "assigns the name to an instance variable" do
|
20
|
+
subject.instance_variable_get("@name").must_equal(board_name)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "assigns the description to an instance variable" do
|
24
|
+
subject.instance_variable_get("@description").must_equal(description)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".with" do
|
29
|
+
before { VCR.insert_cassette(:create_board, decode_compressed_response: true) }
|
30
|
+
after { VCR.eject_cassette }
|
31
|
+
|
32
|
+
subject { described_class.with(board_name, description) }
|
33
|
+
|
34
|
+
context "when the board was created" do
|
35
|
+
it "returns the new board" do
|
36
|
+
subject.must_equal(@board)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "when the board was not created" do
|
41
|
+
before { Trello::Board.stubs(:create).raises(Trello::Error) }
|
42
|
+
|
43
|
+
it { subject.must_equal false }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe CreateCard do
|
5
|
+
let(:described_class) { CreateCard }
|
6
|
+
let(:list_id) { "526d8e130a14a9d846001d97" }
|
7
|
+
let(:card_name) { "My New Card" }
|
8
|
+
let(:description) { "A description to get us started." }
|
9
|
+
|
10
|
+
before do
|
11
|
+
@list = Fabricate(:list)
|
12
|
+
@card = Fabricate(:card, name: card_name, desc: description)
|
13
|
+
|
14
|
+
Troo::CardPersistence.stubs(:for).returns(@card)
|
15
|
+
end
|
16
|
+
|
17
|
+
after { database_cleanup }
|
18
|
+
|
19
|
+
describe ".initialize" do
|
20
|
+
subject { described_class.new(@list, card_name, description) }
|
21
|
+
|
22
|
+
it "assigns the list to an instance variable" do
|
23
|
+
subject.instance_variable_get("@list").must_equal(@list)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "assigns the name to an instance variable" do
|
27
|
+
subject.instance_variable_get("@name").must_equal(card_name)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "assigns the description to an instance variable" do
|
31
|
+
subject.instance_variable_get("@description").must_equal(description)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe ".for" do
|
36
|
+
before { VCR.insert_cassette(:create_card, decode_compressed_response: true) }
|
37
|
+
after { VCR.eject_cassette }
|
38
|
+
|
39
|
+
subject { described_class.for(@list, card_name, description) }
|
40
|
+
|
41
|
+
context "when the card was created" do
|
42
|
+
it "returns the new card" do
|
43
|
+
subject.must_equal(@card)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when the card was not created" do
|
48
|
+
before { Trello::Card.stubs(:create).raises(Trello::Error) }
|
49
|
+
|
50
|
+
it { subject.must_equal false }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe CreateComment do
|
5
|
+
let(:described_class) { CreateComment }
|
6
|
+
let(:card_id) { "526d8f19ddb279532e005259" }
|
7
|
+
let(:comment) { "Some much needed feedback..." }
|
8
|
+
|
9
|
+
before do
|
10
|
+
@card = Fabricate(:card)
|
11
|
+
@comment = Fabricate(:comment, text: comment)
|
12
|
+
|
13
|
+
Troo::CommentPersistence.stubs(:for).returns(@comment)
|
14
|
+
end
|
15
|
+
|
16
|
+
after { database_cleanup }
|
17
|
+
|
18
|
+
describe ".initialize" do
|
19
|
+
subject { described_class.new(@card, comment) }
|
20
|
+
|
21
|
+
it "assigns the card to an instance variable" do
|
22
|
+
subject.instance_variable_get("@card").must_equal(@card)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "assigns the comment to an instance variable" do
|
26
|
+
subject.instance_variable_get("@comment").must_equal(comment)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ".for" do
|
31
|
+
before { VCR.insert_cassette(:create_comment, decode_compressed_response: true) }
|
32
|
+
after { VCR.eject_cassette }
|
33
|
+
|
34
|
+
subject { described_class.for(@card, comment) }
|
35
|
+
|
36
|
+
context "when the comment was created" do
|
37
|
+
it "returns the new comment" do
|
38
|
+
subject.must_equal(@comment)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when the comment was not created" do
|
43
|
+
before { Trello::Card.any_instance.stubs(:add_comment).raises(Trello::Error) }
|
44
|
+
|
45
|
+
it { subject.must_equal false }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe CreateList do
|
5
|
+
let(:described_class) { CreateList }
|
6
|
+
let(:board_id) { "526d8e130a14a9d846001d96" }
|
7
|
+
let(:list_name) { "My New List" }
|
8
|
+
|
9
|
+
before do
|
10
|
+
@board = Fabricate(:board)
|
11
|
+
@list = Fabricate(:list, name: list_name)
|
12
|
+
|
13
|
+
Troo::ListPersistence.stubs(:for).returns(@list)
|
14
|
+
end
|
15
|
+
|
16
|
+
after { database_cleanup }
|
17
|
+
|
18
|
+
describe ".initialize" do
|
19
|
+
subject { described_class.new(@board, list_name) }
|
20
|
+
|
21
|
+
it "assigns the board to an instance variable" do
|
22
|
+
subject.instance_variable_get("@board").must_equal(@board)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "assigns the name to an instance variable" do
|
26
|
+
subject.instance_variable_get("@name").must_equal(list_name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ".for" do
|
31
|
+
before { VCR.insert_cassette(:create_list, decode_compressed_response: true) }
|
32
|
+
after { VCR.eject_cassette }
|
33
|
+
|
34
|
+
subject { described_class.for(@board, list_name) }
|
35
|
+
|
36
|
+
context "when the list was created" do
|
37
|
+
it "returns the new list" do
|
38
|
+
subject.must_equal(@list)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when the list was not created" do
|
43
|
+
before { Trello::List.stubs(:create).raises(Trello::Error) }
|
44
|
+
|
45
|
+
it { subject.must_equal false }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe MoveCard do
|
5
|
+
let(:described_class) { MoveCard }
|
6
|
+
|
7
|
+
before do
|
8
|
+
@list = Fabricate(:list, external_list_id: "526d8e130a14a9d846001d98")
|
9
|
+
@card = Fabricate(:card)
|
10
|
+
Troo::External::Card.stubs(:fetch).returns(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
after { database_cleanup }
|
14
|
+
|
15
|
+
describe ".initialize" do
|
16
|
+
subject { described_class.new(@card, @list) }
|
17
|
+
|
18
|
+
it "assigns the card to an instance variable" do
|
19
|
+
subject.instance_variable_get("@card").must_equal(@card)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "assigns the list to an instance variable" do
|
23
|
+
subject.instance_variable_get("@list").must_equal(@list)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#perform" do
|
28
|
+
before { VCR.insert_cassette(:move_card, decode_compressed_response: true) }
|
29
|
+
after { VCR.eject_cassette }
|
30
|
+
|
31
|
+
subject { described_class.with(@card, @list) }
|
32
|
+
|
33
|
+
context "when the card was moved" do
|
34
|
+
it "returns a refresh of all cards for the board" do
|
35
|
+
subject.wont_equal false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when the card was not moved" do
|
40
|
+
before { Trello::Card.any_instance.stubs(:move_to_list).raises(Trello::Error) }
|
41
|
+
|
42
|
+
it { subject.must_equal false }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative "../../../test_helper"
|
2
|
+
|
3
|
+
module Troo
|
4
|
+
describe RefreshAll do
|
5
|
+
let(:described_class) { RefreshAll }
|
6
|
+
let(:options) { { } }
|
7
|
+
|
8
|
+
before do
|
9
|
+
@board = Fabricate(:board)
|
10
|
+
@list = Fabricate(:list)
|
11
|
+
@card = Fabricate(:card)
|
12
|
+
|
13
|
+
External::Board.stubs(:fetch_all).returns([@board])
|
14
|
+
External::List.stubs(:fetch).returns([@list])
|
15
|
+
External::Card.stubs(:fetch).returns([@card])
|
16
|
+
External::Comment.stubs(:fetch).returns([])
|
17
|
+
External::Member.stubs(:fetch).returns([])
|
18
|
+
end
|
19
|
+
|
20
|
+
after { database_cleanup }
|
21
|
+
|
22
|
+
describe ".initialize" do
|
23
|
+
subject { described_class.new(@board, options) }
|
24
|
+
|
25
|
+
it "assigns the board to an instance variable" do
|
26
|
+
subject.instance_variable_get("@board").must_equal(@board)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "assigns the options to an instance variable" do
|
30
|
+
subject.instance_variable_get("@options").must_equal(options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe ".all" do
|
35
|
+
let(:board) { nil }
|
36
|
+
|
37
|
+
subject { described_class.all(board, options) }
|
38
|
+
|
39
|
+
it "returns true when successful" do
|
40
|
+
subject.must_equal(true)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ".default" do
|
45
|
+
subject { described_class.default(@board, options) }
|
46
|
+
|
47
|
+
it "returns true when successful" do
|
48
|
+
subject.must_equal(true)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe ".lists" do
|
53
|
+
subject { described_class.lists(@board, options) }
|
54
|
+
|
55
|
+
it "refreshes the lists for the board specified" do
|
56
|
+
subject.size.must_equal(1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe ".cards" do
|
61
|
+
subject { described_class.cards(@board, options) }
|
62
|
+
|
63
|
+
it "refreshes the cards for the board specified" do
|
64
|
+
subject.size.must_equal(1)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|