troo 0.0.1 → 0.0.2

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.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +0 -1
  5. data/Guardfile +6 -0
  6. data/LICENSE.txt +1 -0
  7. data/README.md +46 -3
  8. data/Rakefile +11 -0
  9. data/bin/troo +12 -0
  10. data/configuration.yml.example +7 -0
  11. data/features/add_board.feature +1 -0
  12. data/features/add_card.feature +1 -0
  13. data/features/add_comment.feature +1 -0
  14. data/features/add_list.feature +1 -0
  15. data/features/cleanup.feature +0 -0
  16. data/features/move_card_to_list.feature +1 -0
  17. data/features/refresh.feature +1 -0
  18. data/features/set_default.feature +7 -0
  19. data/features/show_board.feature +1 -0
  20. data/features/show_boards.feature +1 -0
  21. data/features/show_card.feature +1 -0
  22. data/features/show_comments.feature +1 -0
  23. data/features/show_list.feature +1 -0
  24. data/features/status.feature +1 -0
  25. data/features/step_definitions/troo_steps.rb +0 -0
  26. data/features/support/env.rb +31 -0
  27. data/features/troo.feature +1 -0
  28. data/features/version.feature +8 -0
  29. data/lib/troo.rb +24 -2
  30. data/lib/troo/actions/create_board.rb +43 -0
  31. data/lib/troo/actions/create_card.rb +43 -0
  32. data/lib/troo/actions/create_comment.rb +44 -0
  33. data/lib/troo/actions/create_list.rb +41 -0
  34. data/lib/troo/actions/move_card.rb +36 -0
  35. data/lib/troo/actions/refresh_all.rb +79 -0
  36. data/lib/troo/actions/set_default.rb +35 -0
  37. data/lib/troo/cli/add_cli.rb +83 -0
  38. data/lib/troo/cli/default_cli.rb +37 -0
  39. data/lib/troo/cli/main_cli.rb +130 -0
  40. data/lib/troo/cli/show_cli.rb +83 -0
  41. data/lib/troo/cli/thor_fixes.rb +9 -0
  42. data/lib/troo/display/board_decorator.rb +58 -0
  43. data/lib/troo/display/board_presenter.rb +65 -0
  44. data/lib/troo/display/card_decorator.rb +105 -0
  45. data/lib/troo/display/card_presenter.rb +27 -0
  46. data/lib/troo/display/comment_decorator.rb +32 -0
  47. data/lib/troo/display/comment_presenter.rb +35 -0
  48. data/lib/troo/display/decorator_helpers.rb +76 -0
  49. data/lib/troo/display/list_decorator.rb +53 -0
  50. data/lib/troo/display/list_presenter.rb +43 -0
  51. data/lib/troo/display/member_decorator.rb +24 -0
  52. data/lib/troo/display/member_presenter.rb +59 -0
  53. data/lib/troo/external/board.rb +49 -0
  54. data/lib/troo/external/board_adaptor.rb +43 -0
  55. data/lib/troo/external/card.rb +70 -0
  56. data/lib/troo/external/card_adaptor.rb +78 -0
  57. data/lib/troo/external/comment.rb +64 -0
  58. data/lib/troo/external/comment_adaptor.rb +53 -0
  59. data/lib/troo/external/list.rb +58 -0
  60. data/lib/troo/external/list_adaptor.rb +48 -0
  61. data/lib/troo/external/member.rb +52 -0
  62. data/lib/troo/external/member_adaptor.rb +63 -0
  63. data/lib/troo/models/board.rb +26 -0
  64. data/lib/troo/models/board_persistence.rb +53 -0
  65. data/lib/troo/models/board_retrieval.rb +45 -0
  66. data/lib/troo/models/card.rb +54 -0
  67. data/lib/troo/models/card_persistence.rb +53 -0
  68. data/lib/troo/models/card_retrieval.rb +49 -0
  69. data/lib/troo/models/comment.rb +32 -0
  70. data/lib/troo/models/comment_persistence.rb +53 -0
  71. data/lib/troo/models/comment_retrieval.rb +32 -0
  72. data/lib/troo/models/list.rb +27 -0
  73. data/lib/troo/models/list_persistence.rb +53 -0
  74. data/lib/troo/models/list_retrieval.rb +45 -0
  75. data/lib/troo/models/member.rb +18 -0
  76. data/lib/troo/models/member_persistence.rb +53 -0
  77. data/lib/troo/models/member_retrieval.rb +36 -0
  78. data/lib/troo/models/model_helpers.rb +32 -0
  79. data/lib/troo/models/refresh.rb +23 -0
  80. data/lib/troo/presentation/template.rb +31 -0
  81. data/lib/troo/troo.rb +69 -0
  82. data/lib/troo/version.rb +2 -1
  83. data/lib/troo/views/card.erb +17 -0
  84. data/lib/troo/views/comment.erb +3 -0
  85. data/logs/.gitkeep +0 -0
  86. data/test/cassettes/board_by_id.yml +59 -0
  87. data/test/cassettes/boards_all.yml +118 -0
  88. data/test/cassettes/card_by_card_id.yml +58 -0
  89. data/test/cassettes/cards_by_board_id.yml +117 -0
  90. data/test/cassettes/cards_by_list_id.yml +114 -0
  91. data/test/cassettes/comments_by_board_id.yml +122 -0
  92. data/test/cassettes/comments_by_card_id.yml +114 -0
  93. data/test/cassettes/comments_by_list_id.yml +109 -0
  94. data/test/cassettes/create_board.yml +62 -0
  95. data/test/cassettes/create_card.yml +63 -0
  96. data/test/cassettes/create_comment.yml +67 -0
  97. data/test/cassettes/create_list.yml +60 -0
  98. data/test/cassettes/list_by_list_id.yml +56 -0
  99. data/test/cassettes/lists_by_board_id.yml +118 -0
  100. data/test/cassettes/member_by_member_id.yml +60 -0
  101. data/test/cassettes/members_by_board_id.yml +109 -0
  102. data/test/cassettes/move_card.yml +61 -0
  103. data/test/lib/troo/actions/create_board_test.rb +47 -0
  104. data/test/lib/troo/actions/create_card_test.rb +54 -0
  105. data/test/lib/troo/actions/create_comment_test.rb +49 -0
  106. data/test/lib/troo/actions/create_list_test.rb +49 -0
  107. data/test/lib/troo/actions/move_card_test.rb +46 -0
  108. data/test/lib/troo/actions/refresh_all_test.rb +68 -0
  109. data/test/lib/troo/actions/set_default_test.rb +44 -0
  110. data/test/lib/troo/cli/add_cli_test.rb +216 -0
  111. data/test/lib/troo/cli/default_cli_test.rb +79 -0
  112. data/test/lib/troo/cli/main_cli_test.rb +232 -0
  113. data/test/lib/troo/cli/show_cli_test.rb +221 -0
  114. data/test/lib/troo/cli/thor_fixes_test.rb +21 -0
  115. data/test/lib/troo/display/board_decorator_test.rb +126 -0
  116. data/test/lib/troo/display/board_presenter_test.rb +77 -0
  117. data/test/lib/troo/display/card_decorator_test.rb +221 -0
  118. data/test/lib/troo/display/card_presenter_test.rb +38 -0
  119. data/test/lib/troo/display/comment_decorator_test.rb +65 -0
  120. data/test/lib/troo/display/comment_presenter_test.rb +47 -0
  121. data/test/lib/troo/display/decorator_helpers_test.rb +7 -0
  122. data/test/lib/troo/display/list_decorator_test.rb +98 -0
  123. data/test/lib/troo/display/list_presenter_test.rb +48 -0
  124. data/test/lib/troo/display/member_decorator_test.rb +42 -0
  125. data/test/lib/troo/display/member_presenter_test.rb +70 -0
  126. data/test/lib/troo/external/board_adaptor_test.rb +36 -0
  127. data/test/lib/troo/external/board_test.rb +69 -0
  128. data/test/lib/troo/external/card_adaptor_test.rb +50 -0
  129. data/test/lib/troo/external/card_test.rb +108 -0
  130. data/test/lib/troo/external/comment_adaptor_test.rb +41 -0
  131. data/test/lib/troo/external/comment_test.rb +88 -0
  132. data/test/lib/troo/external/list_adaptor_test.rb +38 -0
  133. data/test/lib/troo/external/list_test.rb +65 -0
  134. data/test/lib/troo/external/member_adaptor_test.rb +44 -0
  135. data/test/lib/troo/external/member_test.rb +65 -0
  136. data/test/lib/troo/models/board_persistence_test.rb +61 -0
  137. data/test/lib/troo/models/board_retrieval_test.rb +93 -0
  138. data/test/lib/troo/models/board_test.rb +50 -0
  139. data/test/lib/troo/models/card_persistence_test.rb +60 -0
  140. data/test/lib/troo/models/card_retrieval_test.rb +101 -0
  141. data/test/lib/troo/models/card_test.rb +102 -0
  142. data/test/lib/troo/models/comment_persistence_test.rb +65 -0
  143. data/test/lib/troo/models/comment_retrieval_test.rb +46 -0
  144. data/test/lib/troo/models/comment_test.rb +59 -0
  145. data/test/lib/troo/models/list_persistence_test.rb +60 -0
  146. data/test/lib/troo/models/list_retrieval_test.rb +93 -0
  147. data/test/lib/troo/models/list_test.rb +53 -0
  148. data/test/lib/troo/models/member_persistence_test.rb +59 -0
  149. data/test/lib/troo/models/member_retrieval_test.rb +58 -0
  150. data/test/lib/troo/models/member_test.rb +44 -0
  151. data/test/lib/troo/models/model_helpers_test.rb +103 -0
  152. data/test/lib/troo/models/refresh_test.rb +45 -0
  153. data/test/lib/troo/presentation/template_test.rb +40 -0
  154. data/test/support/fabrication.rb +56 -0
  155. data/test/support/template.erb +3 -0
  156. data/test/support/vcr_setup.rb +36 -0
  157. data/test/test_helper.rb +30 -0
  158. data/troo.gemspec +24 -5
  159. metadata +501 -23
@@ -0,0 +1,48 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ describe ListPresenter do
5
+ let(:described_class) { ListPresenter }
6
+ let(:options) { { } }
7
+
8
+ before do
9
+ @list = Fabricate(:list)
10
+ @board = Fabricate(:board)
11
+ @card = Fabricate(:card)
12
+ end
13
+
14
+ after { database_cleanup }
15
+
16
+ describe "#initialize" do
17
+ subject { described_class.new(@list, options) }
18
+
19
+ it "assigns the list to an instance variable" do
20
+ subject.instance_variable_get("@list").must_equal(@list)
21
+ end
22
+
23
+ it "assigns the options to an instance variable" do
24
+ subject.instance_variable_get("@options").must_equal(options)
25
+ end
26
+ end
27
+
28
+ describe "#render_show" do
29
+ subject { capture_io { described_class.new(@list, options).render_show }.join }
30
+
31
+ context "when the list has cards" do
32
+ it "renders the view" do
33
+ subject.must_match /My Test Board/
34
+ subject.must_match /My Test List/
35
+ subject.must_match /My Test Card/
36
+ end
37
+ end
38
+
39
+ context "when the list has no cards" do
40
+ before { @card.delete }
41
+
42
+ it "returns a polite message" do
43
+ subject.must_match /No cards were found./
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,42 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ describe MemberDecorator do
5
+ let(:described_class) { MemberDecorator }
6
+
7
+ before { @member = Fabricate(:member) }
8
+ after { database_cleanup }
9
+
10
+ describe "#initialize" do
11
+ subject { described_class.new(@member) }
12
+
13
+ it "assigns the member to an instance variable" do
14
+ subject.instance_variable_get("@member").must_equal(@member)
15
+ end
16
+ end
17
+
18
+ describe "#username" do
19
+ subject { described_class.new(@member).username }
20
+
21
+ it "returns the member's username" do
22
+ subject.must_equal("@#{@member.username}")
23
+ end
24
+ end
25
+
26
+ describe "#name" do
27
+ subject { described_class.new(@member).name }
28
+
29
+ it "returns the member's full name" do
30
+ subject.must_equal(@member.full_name)
31
+ end
32
+ end
33
+
34
+ describe "#initials" do
35
+ subject { described_class.new(@member).initials }
36
+
37
+ it "returns the member's initials" do
38
+ subject.must_equal(@member.initials)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,70 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ describe MemberPresenter do
5
+ let(:described_class) { MemberPresenter }
6
+ let(:options) { { } }
7
+ let(:external_member_ids) { ["5195fdb5a8c01a2318004f5d"] }
8
+
9
+ before do
10
+ @card = Fabricate(:card, external_member_ids: external_member_ids)
11
+ @member = Fabricate(:member)
12
+ end
13
+
14
+ after { database_cleanup }
15
+
16
+ describe "#initialize" do
17
+ subject { described_class.new(@card, options) }
18
+
19
+ it "assigns the card to an instance variable" do
20
+ subject.instance_variable_get("@card").must_equal(@card)
21
+ end
22
+
23
+ it "assigns the options to an instance variable" do
24
+ subject.instance_variable_get("@options").must_equal(options)
25
+ end
26
+ end
27
+
28
+ describe "#render_show" do
29
+ subject { described_class.render_show(@card, options) }
30
+
31
+ context "when there is one member" do
32
+ it "returns the member" do
33
+ subject.must_equal("@gavinlaking1")
34
+ end
35
+ end
36
+
37
+ context "when there are two members" do
38
+ let(:external_member_ids) { ["5195fdb5a8c01a2318004f5d", "helium"] }
39
+
40
+ before { @member_2 = Fabricate(:member, username: "helium", external_member_id: "helium") }
41
+
42
+ it "returns a formatted list of members" do
43
+ subject.must_equal("@gavinlaking1 and @helium")
44
+ end
45
+ end
46
+
47
+ context "when there are many members" do
48
+ let(:external_member_ids) { ["5195fdb5a8c01a2318004f5d", "helium", "lithium", "beryllium"] }
49
+
50
+ before do
51
+ @member_2 = Fabricate(:member, username: "helium", external_member_id: "helium")
52
+ @member_3 = Fabricate(:member, username: "lithium", external_member_id: "lithium")
53
+ @member_4 = Fabricate(:member, username: "beryllium", external_member_id: "beryllium")
54
+ end
55
+
56
+ it "returns a formatted list of members" do
57
+ subject.must_equal("@gavinlaking1, @helium, @lithium and @beryllium")
58
+ end
59
+ end
60
+
61
+ context "when there are no members" do
62
+ before { @member.delete }
63
+
64
+ it "returns a polite message" do
65
+ subject.must_match /No members have been assigned/
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,36 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ module External
5
+ describe BoardAdaptor do
6
+ let(:described_class) { BoardAdaptor }
7
+ let(:resource) { OpenStruct.new({
8
+ id: "526d8e130a14a9d846001d96",
9
+ name: "My Test Board",
10
+ description: "A very brief description...",
11
+ closed: false,
12
+ }) }
13
+
14
+ describe "#initialize" do
15
+ subject { described_class.new(resource) }
16
+
17
+ it "assigns the resource to an instance variable" do
18
+ subject.instance_variable_get("@resource").must_equal(resource)
19
+ end
20
+ end
21
+
22
+ describe "#adapted" do
23
+ subject { described_class.adapt(resource) }
24
+
25
+ it "returns an adapted resource suitable for local persistence" do
26
+ subject.must_equal({
27
+ external_board_id: "526d8e130a14a9d846001d96",
28
+ name: "My Test Board",
29
+ description: "A very brief description...",
30
+ closed: "false",
31
+ })
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,69 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ module External
5
+ describe Board do
6
+ let(:described_class) { Board }
7
+ let(:board_id) { "526d8e130a14a9d846001d96" }
8
+ let(:options) { { } }
9
+
10
+ describe ".initialize" do
11
+ subject { described_class.new(board_id, options) }
12
+
13
+ it "assigns the external_id" do
14
+ subject.instance_variable_get("@external_id").must_equal(board_id)
15
+ end
16
+
17
+ it "assigns the options" do
18
+ subject.instance_variable_get("@options").must_equal(options)
19
+ end
20
+ end
21
+
22
+ describe ".fetch" do
23
+ before { VCR.insert_cassette(:board_by_id, decode_compressed_response: true) }
24
+ after { VCR.eject_cassette }
25
+
26
+ subject { described_class.fetch(board_id, options) }
27
+
28
+ it "returns a single board" do
29
+ subject.size.must_equal(1)
30
+ end
31
+
32
+ it "returns a board with the board_id" do
33
+ subject.first.external_board_id.must_equal(board_id)
34
+ end
35
+
36
+ it "returns a board with the correct name" do
37
+ subject.first.name.must_equal("Troo App")
38
+ end
39
+
40
+ context "when the board cannot be found" do
41
+ before { Trello::Board.stubs(:find).raises(Trello::Error) }
42
+
43
+ it "returns an empty collection" do
44
+ subject.must_equal([])
45
+ end
46
+ end
47
+ end
48
+
49
+ describe ".fetch_all" do
50
+ before { VCR.insert_cassette(:boards_all, decode_compressed_response: true) }
51
+ after { VCR.eject_cassette }
52
+
53
+ subject { described_class.fetch_all }
54
+
55
+ it "returns multiple boards" do
56
+ subject.size.must_equal(1)
57
+ end
58
+
59
+ context "when no boards can be found" do
60
+ before { Trello::Board.stubs(:all).raises(Trello::Error) }
61
+
62
+ it "returns an empty collection" do
63
+ subject.must_equal([])
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,50 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ module External
5
+ describe CardAdaptor do
6
+ let(:described_class) { CardAdaptor }
7
+ let(:resource) { OpenStruct.new({
8
+ board_id: "526d8e130a14a9d846001d96",
9
+ list_id: "526d8e130a14a9d846001d97",
10
+ id: "526d8f19ddb279532e005259",
11
+ member_ids: ["5195fdb5a8c01a2318004f5d"],
12
+ short_id: 67,
13
+ name: "My Test Card",
14
+ desc: "some description",
15
+ url: "some trello url",
16
+ pos: 16,
17
+ last_activity_date: "2013-12-17 21:48:09 UTC",
18
+ closed: false,
19
+ }) }
20
+
21
+ describe "#initialize" do
22
+ subject { described_class.new(resource) }
23
+
24
+ it "assigns the resource to an instance variable" do
25
+ subject.instance_variable_get("@resource").must_equal(resource)
26
+ end
27
+ end
28
+
29
+ describe "#adapted" do
30
+ subject { described_class.adapt(resource) }
31
+
32
+ it "returns an adapted resource suitable for local persistence" do
33
+ subject.must_equal({
34
+ external_board_id: "526d8e130a14a9d846001d96",
35
+ external_list_id: "526d8e130a14a9d846001d97",
36
+ external_card_id: "526d8f19ddb279532e005259",
37
+ external_member_ids: "[\"5195fdb5a8c01a2318004f5d\"]",
38
+ short_id: "67",
39
+ name: "My Test Card",
40
+ desc: "some description",
41
+ url: "some trello url",
42
+ position: "16",
43
+ last_activity_date: "2013-12-17 21:48:09 UTC",
44
+ closed: "false",
45
+ })
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,108 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ module External
5
+ describe Card do
6
+ let(:described_class) { Card }
7
+ let(:card_id) { "526d8f19ddb279532e005259" }
8
+ let(:options) { {} }
9
+
10
+ before { @card = Fabricate(:card) }
11
+ after { database_cleanup }
12
+
13
+ describe ".initialize" do
14
+ subject { described_class.new("some_id", options) }
15
+
16
+ it "assigns the external_id" do
17
+ subject.instance_variable_get("@external_id").must_equal("some_id")
18
+ end
19
+
20
+ it "assigns the options" do
21
+ subject.instance_variable_get("@options").must_equal(options)
22
+ end
23
+ end
24
+
25
+ describe "when the mode is board" do
26
+ before { VCR.insert_cassette(:cards_by_board_id, decode_compressed_response: true) }
27
+ after { VCR.eject_cassette }
28
+
29
+ let(:board_id) { "526d8e130a14a9d846001d96" }
30
+ let(:options) { { mode: :board, comments: false } }
31
+
32
+ subject { described_class.fetch(board_id, options) }
33
+
34
+ it "returns multiple cards" do
35
+ subject.size.must_equal(2)
36
+ end
37
+
38
+ context "when the board cannot be found" do
39
+ before { Trello::Board.stubs(:find).raises(Trello::Error) }
40
+
41
+ it "returns an empty collection" do
42
+ subject.must_equal([])
43
+ end
44
+ end
45
+ end
46
+
47
+ describe "when the mode is list" do
48
+ before { VCR.insert_cassette(:cards_by_list_id, decode_compressed_response: true) }
49
+ after { VCR.eject_cassette }
50
+
51
+ let(:list_id) { "526d8e130a14a9d846001d97" }
52
+ let(:options) { { mode: :list, comments: false } }
53
+
54
+ subject { described_class.fetch(list_id, options) }
55
+
56
+ it "returns multiple cards" do
57
+ subject.size.must_equal(1)
58
+ end
59
+
60
+ context "when the list cannot be found" do
61
+ before { Trello::List.stubs(:find).raises(Trello::Error) }
62
+
63
+ it "returns an empty collection" do
64
+ subject.must_equal([])
65
+ end
66
+ end
67
+ end
68
+
69
+ describe "when the mode is card" do
70
+ before { VCR.insert_cassette(:card_by_card_id, decode_compressed_response: true) }
71
+ after { VCR.eject_cassette }
72
+
73
+ let(:card_id) { "526d8f19ddb279532e005259" }
74
+ let(:options) { { mode: :card, comments: false } }
75
+
76
+ subject { described_class.fetch(card_id, options) }
77
+
78
+ it "returns a single card" do
79
+ subject.size.must_equal(1)
80
+ end
81
+
82
+ context "when the card cannot be found" do
83
+ before { Trello::Card.stubs(:find).raises(Trello::Error) }
84
+
85
+ it "returns an empty collection" do
86
+ subject.must_equal([])
87
+ end
88
+ end
89
+ end
90
+
91
+ describe "when the comments options is enabled" do
92
+ before do
93
+ Trello::Card.stubs(:find).returns(resource)
94
+ External::Comment.stubs(:fetch)
95
+ end
96
+
97
+ let(:resource) { OpenStruct.new(id: "526d8f19ddb279532e005259") }
98
+ let(:options) { { mode: :card, comments: true } }
99
+
100
+ subject { described_class.fetch(card_id, options) }
101
+
102
+ it "fetches the comments for the card" do
103
+ subject.size.must_equal(1)
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,41 @@
1
+ require_relative "../../../test_helper"
2
+
3
+ module Troo
4
+ module External
5
+ describe CommentAdaptor do
6
+ let(:described_class) { CommentAdaptor }
7
+ let(:resource) { OpenStruct.new({
8
+ id: "51f9277b2822b8654f0023af",
9
+ member_creator_id: "5195fdb5a8c01a2318004f5d",
10
+ date: "2013-12-17 22:01:13 UTC",
11
+ data: {
12
+ "text" => "My Test Comment",
13
+ "board" => { "id" => "526d8e130a14a9d846001d96" },
14
+ "card" => { "id" => "526d8f19ddb279532e005259" } } })
15
+ }
16
+
17
+ describe "#initialize" do
18
+ subject { described_class.new(resource) }
19
+
20
+ it "assigns the resource to an instance variable" do
21
+ subject.instance_variable_get("@resource").must_equal(resource)
22
+ end
23
+ end
24
+
25
+ describe "#adapted" do
26
+ subject { described_class.adapt(resource) }
27
+
28
+ it "returns an adapted resource suitable for local persistence" do
29
+ subject.must_equal({
30
+ external_comment_id: "51f9277b2822b8654f0023af",
31
+ external_board_id: "526d8e130a14a9d846001d96",
32
+ external_card_id: "526d8f19ddb279532e005259",
33
+ external_member_id: "5195fdb5a8c01a2318004f5d",
34
+ date: "2013-12-17 22:01:13 UTC",
35
+ text: "My Test Comment",
36
+ })
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end