troo 0.0.12 → 0.0.13

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +2 -2
  5. data/Rakefile +1 -1
  6. data/bin/troo +0 -20
  7. data/config/en.yml +1 -1
  8. data/lib/troo.rb +1 -1
  9. data/lib/troo/cli/commands/add.rb +2 -2
  10. data/lib/troo/cli/commands/default.rb +2 -2
  11. data/lib/troo/cli/commands/move/card.rb +2 -2
  12. data/lib/troo/cli/commands/refresh.rb +2 -2
  13. data/lib/troo/cli/commands/show/show_boards.rb +2 -2
  14. data/lib/troo/cli/commands/show/show_comments.rb +2 -2
  15. data/lib/troo/cli/commands/status.rb +2 -2
  16. data/lib/troo/cli/thor_fixes.rb +1 -1
  17. data/lib/troo/cli/wizard.rb +40 -5
  18. data/lib/troo/database.rb +2 -2
  19. data/lib/troo/decorators/resource.rb +1 -1
  20. data/lib/troo/launcher.rb +1 -2
  21. data/lib/troo/preference.rb +1 -1
  22. data/lib/troo/retrieval/remote.rb +2 -2
  23. data/lib/troo/version.rb +1 -1
  24. data/test/lib/troo/api/client_test.rb +2 -0
  25. data/test/lib/troo/api/endpoints_test.rb +2 -0
  26. data/test/lib/troo/api/headers_test.rb +2 -0
  27. data/test/lib/troo/cli/add_test.rb +8 -0
  28. data/test/lib/troo/cli/commands/add_test.rb +2 -0
  29. data/test/lib/troo/cli/commands/default_test.rb +2 -0
  30. data/test/lib/troo/cli/commands/move/card_test.rb +2 -0
  31. data/test/lib/troo/cli/commands/refresh/all_test.rb +2 -0
  32. data/test/lib/troo/cli/commands/refresh_test.rb +2 -0
  33. data/test/lib/troo/cli/commands/show/show_boards_test.rb +2 -0
  34. data/test/lib/troo/cli/commands/show/show_comments_test.rb +2 -0
  35. data/test/lib/troo/cli/commands/show_test.rb +2 -0
  36. data/test/lib/troo/cli/commands/status_test.rb +2 -0
  37. data/test/lib/troo/cli/default_test.rb +6 -0
  38. data/test/lib/troo/cli/main_test.rb +10 -0
  39. data/test/lib/troo/cli/refresh_test.rb +8 -0
  40. data/test/lib/troo/cli/show_test.rb +10 -0
  41. data/test/lib/troo/cli/thor_fixes_test.rb +2 -0
  42. data/test/lib/troo/cli/wizard_test.rb +20 -0
  43. data/test/lib/troo/configuration_test.rb +4 -0
  44. data/test/lib/troo/database_test.rb +18 -0
  45. data/test/lib/troo/decorators/resource_test.rb +66 -0
  46. data/test/lib/troo/helpers/decorator_helpers_test.rb +2 -0
  47. data/test/lib/troo/helpers/model_helpers_test.rb +27 -3
  48. data/test/lib/troo/helpers/remote_model_helpers_test.rb +16 -0
  49. data/test/lib/troo/models/behaviours/set_default_test.rb +4 -0
  50. data/test/lib/troo/models/board_test.rb +2 -0
  51. data/test/lib/troo/models/card_test.rb +2 -0
  52. data/test/lib/troo/models/comment_test.rb +4 -0
  53. data/test/lib/troo/models/list_test.rb +4 -0
  54. data/test/lib/troo/models/member_test.rb +4 -0
  55. data/test/lib/troo/persistence/local_test.rb +2 -0
  56. data/test/lib/troo/preference_test.rb +2 -0
  57. data/test/lib/troo/remote/{comment_data_board.rb → comment_data_board_test.rb} +0 -0
  58. data/test/lib/troo/retrieval/local_test.rb +8 -2
  59. data/test/lib/troo/retrieval/remote_test.rb +7 -1
  60. data/test/lib/troo/version_test.rb +9 -0
  61. data/test/system_test.sh +0 -3
  62. metadata +6 -6
  63. data/test/lib/troo/models/database_test.rb +0 -19
@@ -25,6 +25,8 @@ module Troo
25
25
  describe '.dispatch' do
26
26
  subject { described_class.dispatch(value, id, options) }
27
27
 
28
+ it { subject.must_be_instance_of(String) }
29
+
28
30
  [:board, :card, :list, :comment].each do |test_type|
29
31
  context "when the type is #{test_type}" do
30
32
  let(:type) { test_type }
@@ -20,6 +20,8 @@ module Troo
20
20
  describe '.dispatch' do
21
21
  subject { described_class.dispatch(klass, id) }
22
22
 
23
+ it { subject.must_be_instance_of(String) }
24
+
23
25
  context 'when the resource exists' do
24
26
  it 'sets the default and returns a polite message' do
25
27
  subject.must_match(/set as default/)
@@ -28,6 +28,8 @@ module Troo
28
28
  described_class.dispatch(card_id, list_id, board_id)
29
29
  end
30
30
 
31
+ it { subject.must_be_instance_of(String) }
32
+
31
33
  context 'when the card can be moved' do
32
34
  let(:outcome) { true }
33
35
 
@@ -13,6 +13,8 @@ module Troo
13
13
  describe '.dispatch' do
14
14
  subject { described_class.dispatch }
15
15
 
16
+ it { subject.must_be_instance_of(String) }
17
+
16
18
  context 'when all the resources are refreshed' do
17
19
  it 'returns a polite message' do
18
20
  subject.must_match(/All local data refreshed/)
@@ -23,6 +23,8 @@ module Troo
23
23
  describe '.dispatch' do
24
24
  subject { described_class.dispatch(klass, id) }
25
25
 
26
+ it { subject.must_be_instance_of(String) }
27
+
26
28
  context 'when the resource exists' do
27
29
  let(:resource) { @board }
28
30
  let(:retrieved) { [@board] }
@@ -16,6 +16,8 @@ module Troo
16
16
  describe '.dispatch' do
17
17
  subject { described_class.dispatch }
18
18
 
19
+ it { subject.must_be_instance_of(String) }
20
+
19
21
  context 'when boards exist' do
20
22
  let(:resources) { [@board] }
21
23
 
@@ -23,6 +23,8 @@ module Troo
23
23
  describe '.dispatch' do
24
24
  subject { described_class.dispatch(id) }
25
25
 
26
+ it { subject.must_be_instance_of(String) }
27
+
26
28
  context 'when a resource ID is provided' do
27
29
  context 'and the resource exists' do
28
30
  let(:resource) { @card }
@@ -25,6 +25,8 @@ module Troo
25
25
  describe '.dispatch' do
26
26
  subject { described_class.dispatch(klass, id) }
27
27
 
28
+ it { subject.must_be_instance_of(String) }
29
+
28
30
  context 'when a resource ID is provided' do
29
31
  context 'and the resource exists' do
30
32
  let(:resource) { @card }
@@ -15,6 +15,8 @@ module Troo
15
15
  before { Fabricate(:board, default: default) }
16
16
  after { database_cleanup }
17
17
 
18
+ it { subject.must_be_instance_of(String) }
19
+
18
20
  context 'when a default is set' do
19
21
  it 'returns a polite message' do
20
22
  subject.must_match(/1 board found/)
@@ -10,6 +10,8 @@ module Troo
10
10
 
11
11
  subject { capture_io { described_class.new.board(id) }.join }
12
12
 
13
+ it { subject.must_be_instance_of(String) }
14
+
13
15
  it 'returns the output of the command' do
14
16
  subject.must_match(/Board cannot be found/)
15
17
  end
@@ -20,6 +22,8 @@ module Troo
20
22
 
21
23
  subject { capture_io { described_class.new.card(id) }.join }
22
24
 
25
+ it { subject.must_be_instance_of(String) }
26
+
23
27
  it 'returns the output of the command' do
24
28
  subject.must_match(/Card cannot be found/)
25
29
  end
@@ -30,6 +34,8 @@ module Troo
30
34
 
31
35
  subject { capture_io { described_class.new.list(id) }.join }
32
36
 
37
+ it { subject.must_be_instance_of(String) }
38
+
33
39
  it 'returns the output of the command' do
34
40
  subject.must_match(/List cannot be found/)
35
41
  end
@@ -10,6 +10,8 @@ module Troo
10
10
 
11
11
  subject { capture_io { described_class.new.status }.join }
12
12
 
13
+ it { subject.must_be_instance_of(String) }
14
+
13
15
  it 'returns the output of the command' do
14
16
  subject.must_match(/Status/)
15
17
  end
@@ -22,6 +24,8 @@ module Troo
22
24
  describe '#config' do
23
25
  subject { capture_io { described_class.new.config }.join }
24
26
 
27
+ it { subject.must_be_instance_of(String) }
28
+
25
29
  it 'returns the current configuration' do
26
30
  subject.must_match(/Current configuration/)
27
31
  end
@@ -34,6 +38,8 @@ module Troo
34
38
 
35
39
  subject { capture_io { described_class.new.cleanup }.join }
36
40
 
41
+ it { subject.must_be_instance_of(String) }
42
+
37
43
  context 'when the user confirms the operation' do
38
44
  it 'returns the output of the command' do
39
45
  subject.must_match(/All local data has been removed/)
@@ -52,6 +58,8 @@ module Troo
52
58
  describe '#version' do
53
59
  subject { capture_io { described_class.new.version }.join }
54
60
 
61
+ it { subject.must_be_instance_of(String) }
62
+
55
63
  it 'returns the output of the command' do
56
64
  subject.must_match(/#{Troo::VERSION}/)
57
65
  end
@@ -68,6 +76,8 @@ module Troo
68
76
  end.join
69
77
  end
70
78
 
79
+ it { subject.must_be_instance_of(String) }
80
+
71
81
  it 'returns the output of the command' do
72
82
  subject.must_match(/Card cannot be found/)
73
83
  end
@@ -10,6 +10,8 @@ module Troo
10
10
 
11
11
  subject { capture_io { described_class.new.all }.join }
12
12
 
13
+ it { subject.must_be_instance_of(String) }
14
+
13
15
  it 'returns the output of the command' do
14
16
  subject.must_match(/Cannot refresh all local data/)
15
17
  end
@@ -18,6 +20,8 @@ module Troo
18
20
  describe '#board' do
19
21
  subject { capture_io { described_class.new.board }.join }
20
22
 
23
+ it { subject.must_be_instance_of(String) }
24
+
21
25
  it 'returns the output of the command' do
22
26
  subject.must_match(/Board cannot be found/)
23
27
  end
@@ -26,6 +30,8 @@ module Troo
26
30
  describe '#card' do
27
31
  subject { capture_io { described_class.new.card }.join }
28
32
 
33
+ it { subject.must_be_instance_of(String) }
34
+
29
35
  it 'returns the output of the command' do
30
36
  subject.must_match(/Card cannot be found/)
31
37
  end
@@ -34,6 +40,8 @@ module Troo
34
40
  describe '#list' do
35
41
  subject { capture_io { described_class.new.list }.join }
36
42
 
43
+ it { subject.must_be_instance_of(String) }
44
+
37
45
  it 'returns the output of the command' do
38
46
  subject.must_match(/List cannot be found/)
39
47
  end
@@ -8,6 +8,8 @@ module Troo
8
8
  describe '#boards' do
9
9
  subject { capture_io { described_class.new.boards }.join }
10
10
 
11
+ it { subject.must_be_instance_of(String) }
12
+
11
13
  it 'returns the output of the command' do
12
14
  subject.must_match(/Boards cannot be found/)
13
15
  end
@@ -16,6 +18,8 @@ module Troo
16
18
  describe '#board' do
17
19
  subject { capture_io { described_class.new.board }.join }
18
20
 
21
+ it { subject.must_be_instance_of(String) }
22
+
19
23
  it 'returns the output of the command' do
20
24
  subject.must_match(/Board cannot be found/)
21
25
  end
@@ -24,6 +28,8 @@ module Troo
24
28
  describe '#list' do
25
29
  subject { capture_io { described_class.new.list }.join }
26
30
 
31
+ it { subject.must_be_instance_of(String) }
32
+
27
33
  it 'returns the output of the command' do
28
34
  subject.must_match(/List cannot be found/)
29
35
  end
@@ -32,6 +38,8 @@ module Troo
32
38
  describe '#card' do
33
39
  subject { capture_io { described_class.new.card }.join }
34
40
 
41
+ it { subject.must_be_instance_of(String) }
42
+
35
43
  it 'returns the output of the command' do
36
44
  subject.must_match(/Card cannot be found/)
37
45
  end
@@ -40,6 +48,8 @@ module Troo
40
48
  describe '#comments' do
41
49
  subject { capture_io { described_class.new.comments }.join }
42
50
 
51
+ it { subject.must_be_instance_of(String) }
52
+
43
53
  it 'returns the output of the command' do
44
54
  subject.must_match(/Card cannot be found/)
45
55
  end
@@ -19,6 +19,8 @@ module Troo
19
19
  described_class.banner(command, namespace, subcommand)
20
20
  end
21
21
 
22
+ it { subject.must_be_instance_of(String) }
23
+
22
24
  context 'when executing a subcommand' do
23
25
  let(:package_name) { 'show' }
24
26
 
@@ -5,8 +5,12 @@ module Troo
5
5
  describe Wizard do
6
6
  let(:described_class) { Wizard }
7
7
  let(:described_instance) { described_class.new }
8
+ let(:exists) { true }
8
9
 
9
10
  before do
11
+ File.stubs(:exist?).returns(exists)
12
+ File.stubs(:dirname).returns('')
13
+ FileUtils.stubs(:cp).returns(true)
10
14
  $stdin.stubs(:gets).returns("y\n")
11
15
  Launchy.stubs(:open).returns(true)
12
16
  Dir.stubs(:home).returns('./tmp')
@@ -15,10 +19,26 @@ module Troo
15
19
  describe '#start' do
16
20
  subject { capture_io { described_class.new.start }.join }
17
21
 
22
+ it { subject.must_be_instance_of(String) }
23
+
18
24
  it 'returns a welcome message' do
19
25
  subject.must_match(/Welcome/)
20
26
  end
21
27
 
28
+ context 'when a configuration file does not exist' do
29
+ let(:exists) { false }
30
+
31
+ it 'returns the "created" message' do
32
+ subject.must_match(/file was created/)
33
+ end
34
+ end
35
+
36
+ context 'when a configuration file exists' do
37
+ it 'returns the "already exists" message' do
38
+ subject.must_match(/already exists/)
39
+ end
40
+ end
41
+
22
42
  context 'when the user proceeds to step one' do
23
43
  it 'returns a thank you message' do
24
44
  subject.must_match(/Thank you/)
@@ -6,6 +6,8 @@ module Troo
6
6
 
7
7
  subject { described_class.load('config/trooconf.yml', 'test') }
8
8
 
9
+ it { subject.must_be_instance_of(Troo::Configuration) }
10
+
9
11
  context 'configures' do
10
12
  it 'the name of the configuration' do
11
13
  subject.name.must_equal('My Example Test Configuration')
@@ -71,6 +73,8 @@ module Troo
71
73
  described_class.load('config/trooconf.yml', 'test').view
72
74
  end
73
75
 
76
+ it { subject.must_be_instance_of(String) }
77
+
74
78
  it 'returns the configuration' do
75
79
  subject.must_equal(" api_key: some_key
76
80
  api_token: some_secret
@@ -3,5 +3,23 @@ require_relative '../../test_helper'
3
3
  module Troo
4
4
  describe Database do
5
5
  let(:described_class) { Database }
6
+ let(:configuration) { stub(database: '1') }
7
+ let(:options) { {} }
8
+
9
+ before { Ohm.stubs(:connect) }
10
+
11
+ subject { described_class.new(configuration, options) }
12
+
13
+ it { subject.must_be_instance_of(Troo::Database) }
14
+
15
+ describe '#connect' do
16
+ subject { described_class.connect(configuration, options) }
17
+
18
+ it { subject.must_be_instance_of(NilClass) }
19
+
20
+ it 'connects to the persistence layer' do
21
+ subject.must_equal(nil)
22
+ end
23
+ end
6
24
  end
7
25
  end
@@ -29,12 +29,34 @@ module Troo
29
29
  describe '#title' do
30
30
  subject { described_instance.title }
31
31
 
32
+ it { subject.must_be_instance_of(String) }
33
+
32
34
  it { subject.must_match(/My Resource/) }
33
35
  end
34
36
 
37
+ describe '#resource_title' do
38
+ subject { described_instance.resource_title }
39
+
40
+ it { subject.must_be_instance_of(String) }
41
+ end
42
+
43
+ describe '#resource_id' do
44
+ subject { described_instance.resource_id }
45
+
46
+ it { subject.must_be_instance_of(String) }
47
+ end
48
+
49
+ describe '#id' do
50
+ subject { described_instance.id }
51
+
52
+ it { subject.must_be_instance_of(Fixnum) }
53
+ end
54
+
35
55
  describe '#description' do
36
56
  subject { described_instance.description }
37
57
 
58
+ it { subject.must_be_instance_of(String) }
59
+
38
60
  context 'when a description exists' do
39
61
  it 'returns the description' do
40
62
  subject.must_equal(klass.description)
@@ -54,6 +76,8 @@ module Troo
54
76
  subject { described_instance.default }
55
77
 
56
78
  context 'when the resource is default' do
79
+ it { subject.must_be_instance_of(String) }
80
+
57
81
  it 'returns a marker' do
58
82
  subject.must_equal('*')
59
83
  end
@@ -62,6 +86,8 @@ module Troo
62
86
  context 'when the resource is not the default' do
63
87
  let(:default) { false }
64
88
 
89
+ it { subject.must_be_instance_of(NilClass) }
90
+
65
91
  it 'returns nil so that join compacts the value away' do
66
92
  subject.must_equal nil
67
93
  end
@@ -71,6 +97,8 @@ module Troo
71
97
  describe '#name' do
72
98
  subject { described_instance.name }
73
99
 
100
+ it { subject.must_be_instance_of(String) }
101
+
74
102
  context 'when the resource has a name' do
75
103
  let(:resource_name) { 'My Resource' }
76
104
 
@@ -90,11 +118,43 @@ module Troo
90
118
  end
91
119
  end
92
120
 
121
+ # describe '#board' do
122
+ # subject { described_instance.board }
123
+
124
+ # it { subject.must_be_instance_of(String) }
125
+ # end
126
+
127
+ # describe '#list' do
128
+ # subject { described_instance.list }
129
+
130
+ # it { subject.must_be_instance_of(String) }
131
+ # end
132
+
133
+ # describe '#comments' do
134
+ # subject { described_instance.comments }
135
+
136
+ # it { subject.must_be_instance_of(String) }
137
+ # end
138
+
139
+ # describe '#members' do
140
+ # subject { described_instance.members }
141
+
142
+ # it { subject.must_be_instance_of(String) }
143
+ # end
144
+
145
+ # describe '#last_activity_date' do
146
+ # subject { described_instance.last_activity_date }
147
+
148
+ # it { subject.must_be_instance_of(String) }
149
+ # end
150
+
93
151
  describe '#as_view' do
94
152
  before { Template.stubs(:parse).returns('some output') }
95
153
 
96
154
  subject { described_instance.as_view }
97
155
 
156
+ it { subject.must_be_instance_of(String) }
157
+
98
158
  it 'returns the rendered content' do
99
159
  subject.must_match(/some output/)
100
160
  end
@@ -103,6 +163,8 @@ module Troo
103
163
  describe '#username' do
104
164
  subject { described_instance.username }
105
165
 
166
+ it { subject.must_be_instance_of(String) }
167
+
106
168
  it 'returns the comment member username' do
107
169
  subject.must_equal('@' + klass.member.username)
108
170
  end
@@ -111,6 +173,8 @@ module Troo
111
173
  describe '#text' do
112
174
  subject { described_instance.text }
113
175
 
176
+ it { subject.must_be_instance_of(String) }
177
+
114
178
  it 'returns the comment text' do
115
179
  subject.must_equal(klass.text)
116
180
  end
@@ -119,6 +183,8 @@ module Troo
119
183
  describe '#date' do
120
184
  subject { described_instance.date }
121
185
 
186
+ it { subject.must_be_instance_of(String) }
187
+
122
188
  it 'returns the comment date' do
123
189
  subject.must_equal(klass.date)
124
190
  end