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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/bin/troo +0 -20
- data/config/en.yml +1 -1
- data/lib/troo.rb +1 -1
- data/lib/troo/cli/commands/add.rb +2 -2
- data/lib/troo/cli/commands/default.rb +2 -2
- data/lib/troo/cli/commands/move/card.rb +2 -2
- data/lib/troo/cli/commands/refresh.rb +2 -2
- data/lib/troo/cli/commands/show/show_boards.rb +2 -2
- data/lib/troo/cli/commands/show/show_comments.rb +2 -2
- data/lib/troo/cli/commands/status.rb +2 -2
- data/lib/troo/cli/thor_fixes.rb +1 -1
- data/lib/troo/cli/wizard.rb +40 -5
- data/lib/troo/database.rb +2 -2
- data/lib/troo/decorators/resource.rb +1 -1
- data/lib/troo/launcher.rb +1 -2
- data/lib/troo/preference.rb +1 -1
- data/lib/troo/retrieval/remote.rb +2 -2
- data/lib/troo/version.rb +1 -1
- data/test/lib/troo/api/client_test.rb +2 -0
- data/test/lib/troo/api/endpoints_test.rb +2 -0
- data/test/lib/troo/api/headers_test.rb +2 -0
- data/test/lib/troo/cli/add_test.rb +8 -0
- data/test/lib/troo/cli/commands/add_test.rb +2 -0
- data/test/lib/troo/cli/commands/default_test.rb +2 -0
- data/test/lib/troo/cli/commands/move/card_test.rb +2 -0
- data/test/lib/troo/cli/commands/refresh/all_test.rb +2 -0
- data/test/lib/troo/cli/commands/refresh_test.rb +2 -0
- data/test/lib/troo/cli/commands/show/show_boards_test.rb +2 -0
- data/test/lib/troo/cli/commands/show/show_comments_test.rb +2 -0
- data/test/lib/troo/cli/commands/show_test.rb +2 -0
- data/test/lib/troo/cli/commands/status_test.rb +2 -0
- data/test/lib/troo/cli/default_test.rb +6 -0
- data/test/lib/troo/cli/main_test.rb +10 -0
- data/test/lib/troo/cli/refresh_test.rb +8 -0
- data/test/lib/troo/cli/show_test.rb +10 -0
- data/test/lib/troo/cli/thor_fixes_test.rb +2 -0
- data/test/lib/troo/cli/wizard_test.rb +20 -0
- data/test/lib/troo/configuration_test.rb +4 -0
- data/test/lib/troo/database_test.rb +18 -0
- data/test/lib/troo/decorators/resource_test.rb +66 -0
- data/test/lib/troo/helpers/decorator_helpers_test.rb +2 -0
- data/test/lib/troo/helpers/model_helpers_test.rb +27 -3
- data/test/lib/troo/helpers/remote_model_helpers_test.rb +16 -0
- data/test/lib/troo/models/behaviours/set_default_test.rb +4 -0
- data/test/lib/troo/models/board_test.rb +2 -0
- data/test/lib/troo/models/card_test.rb +2 -0
- data/test/lib/troo/models/comment_test.rb +4 -0
- data/test/lib/troo/models/list_test.rb +4 -0
- data/test/lib/troo/models/member_test.rb +4 -0
- data/test/lib/troo/persistence/local_test.rb +2 -0
- data/test/lib/troo/preference_test.rb +2 -0
- data/test/lib/troo/remote/{comment_data_board.rb → comment_data_board_test.rb} +0 -0
- data/test/lib/troo/retrieval/local_test.rb +8 -2
- data/test/lib/troo/retrieval/remote_test.rb +7 -1
- data/test/lib/troo/version_test.rb +9 -0
- data/test/system_test.sh +0 -3
- metadata +6 -6
- data/test/lib/troo/models/database_test.rb +0 -19
|
@@ -26,11 +26,13 @@ module Troo
|
|
|
26
26
|
after { database_cleanup }
|
|
27
27
|
|
|
28
28
|
describe '.first' do
|
|
29
|
+
let(:criteria) {}
|
|
30
|
+
|
|
29
31
|
subject { described_class.first(criteria) }
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
let(:criteria) {}
|
|
33
|
+
it { subject.must_be_instance_of(ModelHelpersDummy) }
|
|
33
34
|
|
|
35
|
+
context 'when no criteria are provided' do
|
|
34
36
|
it 'returns the first model stored of that type' do
|
|
35
37
|
subject.name.must_equal('My Dumb Model')
|
|
36
38
|
end
|
|
@@ -46,10 +48,12 @@ module Troo
|
|
|
46
48
|
end
|
|
47
49
|
|
|
48
50
|
describe '.update' do
|
|
51
|
+
let(:criteria) {}
|
|
52
|
+
|
|
49
53
|
subject { described_class.update(criteria) }
|
|
50
54
|
|
|
51
55
|
context 'when no criteria are provided' do
|
|
52
|
-
|
|
56
|
+
it { subject.must_be_instance_of(FalseClass) }
|
|
53
57
|
|
|
54
58
|
it 'returns false; no update was performed' do
|
|
55
59
|
subject.must_equal(false)
|
|
@@ -59,6 +63,8 @@ module Troo
|
|
|
59
63
|
context 'when criteria are provided' do
|
|
60
64
|
let(:criteria) { { name: 'My Updated Model' } }
|
|
61
65
|
|
|
66
|
+
it { subject.must_be_instance_of(TrueClass) }
|
|
67
|
+
|
|
62
68
|
it 'updates all records with the criteria' do
|
|
63
69
|
subject.must_equal(true)
|
|
64
70
|
ModelHelpersDummy.all.each do |dummy|
|
|
@@ -72,6 +78,8 @@ module Troo
|
|
|
72
78
|
subject { described_class.default }
|
|
73
79
|
|
|
74
80
|
context 'when there is a default model' do
|
|
81
|
+
it { subject.must_be_instance_of(ModelHelpersDummy) }
|
|
82
|
+
|
|
75
83
|
it 'returns the model' do
|
|
76
84
|
subject.must_equal(@dumber)
|
|
77
85
|
end
|
|
@@ -80,6 +88,8 @@ module Troo
|
|
|
80
88
|
context 'when there is no default model' do
|
|
81
89
|
before { @dumber.delete }
|
|
82
90
|
|
|
91
|
+
it { subject.must_be_instance_of(NilClass) }
|
|
92
|
+
|
|
83
93
|
it { subject.must_equal(nil) }
|
|
84
94
|
end
|
|
85
95
|
end
|
|
@@ -88,12 +98,16 @@ module Troo
|
|
|
88
98
|
subject { described_class.default? }
|
|
89
99
|
|
|
90
100
|
context 'when there is a default model' do
|
|
101
|
+
it { subject.must_be_instance_of(TrueClass) }
|
|
102
|
+
|
|
91
103
|
it { subject.must_equal true }
|
|
92
104
|
end
|
|
93
105
|
|
|
94
106
|
context 'when there is no default model' do
|
|
95
107
|
before { @dumber.delete }
|
|
96
108
|
|
|
109
|
+
it { subject.must_be_instance_of(FalseClass) }
|
|
110
|
+
|
|
97
111
|
it { subject.must_equal false }
|
|
98
112
|
end
|
|
99
113
|
end
|
|
@@ -103,6 +117,8 @@ module Troo
|
|
|
103
117
|
|
|
104
118
|
subject { described_class.count(criteria) }
|
|
105
119
|
|
|
120
|
+
it { subject.must_be_instance_of(Fixnum) }
|
|
121
|
+
|
|
106
122
|
context 'when no criteria is specified' do
|
|
107
123
|
it 'returns the number of this model persisted' do
|
|
108
124
|
subject.must_equal(2)
|
|
@@ -118,8 +134,16 @@ module Troo
|
|
|
118
134
|
end
|
|
119
135
|
end
|
|
120
136
|
|
|
137
|
+
describe '.by_external_id' do
|
|
138
|
+
subject { described_class.by_external_id(id) }
|
|
139
|
+
|
|
140
|
+
it { skip }
|
|
141
|
+
end
|
|
142
|
+
|
|
121
143
|
describe '.retrieve' do
|
|
122
144
|
subject { described_class.retrieve(id, options) }
|
|
145
|
+
|
|
146
|
+
it { skip }
|
|
123
147
|
end
|
|
124
148
|
end
|
|
125
149
|
end
|
|
@@ -28,6 +28,8 @@ module Troo
|
|
|
28
28
|
describe '.all' do
|
|
29
29
|
subject { described_class.all }
|
|
30
30
|
|
|
31
|
+
it { subject.must_be_instance_of(Hash) }
|
|
32
|
+
|
|
31
33
|
it 'returns the resource parameters' do
|
|
32
34
|
subject.must_equal({})
|
|
33
35
|
end
|
|
@@ -36,6 +38,8 @@ module Troo
|
|
|
36
38
|
describe '.by_board_id' do
|
|
37
39
|
subject { described_class.by_board_id }
|
|
38
40
|
|
|
41
|
+
it { subject.must_be_instance_of(Hash) }
|
|
42
|
+
|
|
39
43
|
it 'returns the resource parameters' do
|
|
40
44
|
subject.must_equal({})
|
|
41
45
|
end
|
|
@@ -44,6 +48,8 @@ module Troo
|
|
|
44
48
|
describe '.by_list_id' do
|
|
45
49
|
subject { described_class.by_list_id }
|
|
46
50
|
|
|
51
|
+
it { subject.must_be_instance_of(Hash) }
|
|
52
|
+
|
|
47
53
|
it 'returns the resource parameters' do
|
|
48
54
|
subject.must_equal({})
|
|
49
55
|
end
|
|
@@ -52,6 +58,8 @@ module Troo
|
|
|
52
58
|
describe '.by_card_id' do
|
|
53
59
|
subject { described_class.by_card_id }
|
|
54
60
|
|
|
61
|
+
it { subject.must_be_instance_of(Hash) }
|
|
62
|
+
|
|
55
63
|
it 'returns the resource parameters' do
|
|
56
64
|
subject.must_equal({})
|
|
57
65
|
end
|
|
@@ -60,9 +68,17 @@ module Troo
|
|
|
60
68
|
describe '.by_member_id' do
|
|
61
69
|
subject { described_class.by_member_id }
|
|
62
70
|
|
|
71
|
+
it { subject.must_be_instance_of(Hash) }
|
|
72
|
+
|
|
63
73
|
it 'returns the resource parameters' do
|
|
64
74
|
subject.must_equal({})
|
|
65
75
|
end
|
|
66
76
|
end
|
|
77
|
+
|
|
78
|
+
describe '#preprocess' do
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
describe '#local' do
|
|
82
|
+
end
|
|
67
83
|
end
|
|
68
84
|
end
|
|
@@ -7,6 +7,8 @@ module Troo
|
|
|
7
7
|
describe '#default?' do
|
|
8
8
|
subject { described_class.new.default? }
|
|
9
9
|
|
|
10
|
+
it { subject.must_be_instance_of(FalseClass) }
|
|
11
|
+
|
|
10
12
|
it { subject.must_equal false }
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -27,6 +29,8 @@ module Troo
|
|
|
27
29
|
context 'when the entity is already the default' do
|
|
28
30
|
let(:entity) { @board_1 }
|
|
29
31
|
|
|
32
|
+
it { subject.must_be_instance_of(TrueClass) }
|
|
33
|
+
|
|
30
34
|
it { subject.must_equal true }
|
|
31
35
|
end
|
|
32
36
|
|
|
@@ -48,6 +48,8 @@ module Troo
|
|
|
48
48
|
describe '.type' do
|
|
49
49
|
subject { described_class.type }
|
|
50
50
|
|
|
51
|
+
it { subject.must_be_instance_of(Symbol) }
|
|
52
|
+
|
|
51
53
|
it 'returns the type of model' do
|
|
52
54
|
subject.must_equal(:comments)
|
|
53
55
|
end
|
|
@@ -94,6 +96,8 @@ module Troo
|
|
|
94
96
|
describe '#type' do
|
|
95
97
|
subject { described_class.new.type }
|
|
96
98
|
|
|
99
|
+
it { subject.must_be_instance_of(Symbol) }
|
|
100
|
+
|
|
97
101
|
it 'returns the type of the model instance' do
|
|
98
102
|
subject.must_equal(:comments)
|
|
99
103
|
end
|
|
@@ -44,6 +44,8 @@ module Troo
|
|
|
44
44
|
describe '.type' do
|
|
45
45
|
subject { described_class.type }
|
|
46
46
|
|
|
47
|
+
it { subject.must_be_instance_of(Symbol) }
|
|
48
|
+
|
|
47
49
|
it 'returns the type of model' do
|
|
48
50
|
subject.must_equal(:list)
|
|
49
51
|
end
|
|
@@ -89,6 +91,8 @@ module Troo
|
|
|
89
91
|
describe '#type' do
|
|
90
92
|
subject { described_class.new.type }
|
|
91
93
|
|
|
94
|
+
it { subject.must_be_instance_of(Symbol) }
|
|
95
|
+
|
|
92
96
|
it 'returns the type of the model instance' do
|
|
93
97
|
subject.must_equal(:list)
|
|
94
98
|
end
|
|
@@ -56,6 +56,8 @@ module Troo
|
|
|
56
56
|
describe '.type' do
|
|
57
57
|
subject { described_class.type }
|
|
58
58
|
|
|
59
|
+
it { subject.must_be_instance_of(Symbol) }
|
|
60
|
+
|
|
59
61
|
it 'returns the type of model' do
|
|
60
62
|
subject.must_equal(:member)
|
|
61
63
|
end
|
|
@@ -90,6 +92,8 @@ module Troo
|
|
|
90
92
|
describe '#type' do
|
|
91
93
|
subject { described_class.new.type }
|
|
92
94
|
|
|
95
|
+
it { subject.must_be_instance_of(Symbol) }
|
|
96
|
+
|
|
93
97
|
it 'returns the type of the model instance' do
|
|
94
98
|
subject.must_equal(:member)
|
|
95
99
|
end
|
|
@@ -12,6 +12,8 @@ module Troo
|
|
|
12
12
|
describe '.with_collection' do
|
|
13
13
|
subject { described_class.with_collection(resources) }
|
|
14
14
|
|
|
15
|
+
it { subject.must_be_instance_of(Array) }
|
|
16
|
+
|
|
15
17
|
context 'when the collection is empty' do
|
|
16
18
|
it 'returns the empty collection' do
|
|
17
19
|
subject.must_equal []
|
|
File without changes
|
|
@@ -26,13 +26,15 @@ module Troo
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
describe '.all' do
|
|
29
|
+
let(:collection) { [:resource, :resource] }
|
|
30
|
+
|
|
29
31
|
before { klass.stubs(:all).returns(collection) }
|
|
30
32
|
|
|
31
33
|
subject { described_class.all(klass) }
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
let(:collection) { [:resource, :resource] }
|
|
35
|
+
it { subject.must_be_instance_of(Array) }
|
|
35
36
|
|
|
37
|
+
context 'when local resources exist' do
|
|
36
38
|
it 'returns all the local resources' do
|
|
37
39
|
subject.must_equal(collection)
|
|
38
40
|
end
|
|
@@ -50,6 +52,8 @@ module Troo
|
|
|
50
52
|
describe '.default' do
|
|
51
53
|
subject { described_class.default(klass, options) }
|
|
52
54
|
|
|
55
|
+
it { subject.must_be_instance_of(NilClass) }
|
|
56
|
+
|
|
53
57
|
context 'when the default is set' do
|
|
54
58
|
let(:default_resource) { stub }
|
|
55
59
|
|
|
@@ -66,6 +70,8 @@ module Troo
|
|
|
66
70
|
describe '.retrieve' do
|
|
67
71
|
subject { described_class.retrieve(klass, id, options) }
|
|
68
72
|
|
|
73
|
+
it { subject.must_be_instance_of(NilClass) }
|
|
74
|
+
|
|
69
75
|
context 'without an ID' do
|
|
70
76
|
context 'when the default is set' do
|
|
71
77
|
let(:default_resource) { stub }
|
|
@@ -5,7 +5,7 @@ module Troo
|
|
|
5
5
|
describe Remote do
|
|
6
6
|
let(:described_class) { Remote }
|
|
7
7
|
let(:klass) do
|
|
8
|
-
|
|
8
|
+
stub('klass', all: {},
|
|
9
9
|
by_board_id: {},
|
|
10
10
|
by_list_id: {},
|
|
11
11
|
by_card_id: {},
|
|
@@ -23,9 +23,15 @@ module Troo
|
|
|
23
23
|
.returns(persisted)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
subject { described_class.new(klass, external_id, options) }
|
|
27
|
+
|
|
28
|
+
it { subject.must_be_instance_of(Troo::Retrieval::Remote) }
|
|
29
|
+
|
|
26
30
|
describe '#fetch' do
|
|
27
31
|
subject { described_class.fetch(klass, external_id, options) }
|
|
28
32
|
|
|
33
|
+
it { subject.must_be_instance_of(Array) }
|
|
34
|
+
|
|
29
35
|
context 'when no resources were retrieved' do
|
|
30
36
|
let(:resources) { [] }
|
|
31
37
|
|
data/test/system_test.sh
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: troo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gavin Laking
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-04-
|
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aruba
|
|
@@ -641,7 +641,6 @@ files:
|
|
|
641
641
|
- test/lib/troo/models/board_test.rb
|
|
642
642
|
- test/lib/troo/models/card_test.rb
|
|
643
643
|
- test/lib/troo/models/comment_test.rb
|
|
644
|
-
- test/lib/troo/models/database_test.rb
|
|
645
644
|
- test/lib/troo/models/list_test.rb
|
|
646
645
|
- test/lib/troo/models/member_test.rb
|
|
647
646
|
- test/lib/troo/models/refresh_test.rb
|
|
@@ -659,7 +658,7 @@ files:
|
|
|
659
658
|
- test/lib/troo/presenters/resource_test.rb
|
|
660
659
|
- test/lib/troo/remote/board_test.rb
|
|
661
660
|
- test/lib/troo/remote/card_test.rb
|
|
662
|
-
- test/lib/troo/remote/
|
|
661
|
+
- test/lib/troo/remote/comment_data_board_test.rb
|
|
663
662
|
- test/lib/troo/remote/comment_data_card_test.rb
|
|
664
663
|
- test/lib/troo/remote/comment_data_test.rb
|
|
665
664
|
- test/lib/troo/remote/comment_test.rb
|
|
@@ -672,6 +671,7 @@ files:
|
|
|
672
671
|
- test/lib/troo/remote/persistence/move_card_test.rb
|
|
673
672
|
- test/lib/troo/retrieval/local_test.rb
|
|
674
673
|
- test/lib/troo/retrieval/remote_test.rb
|
|
674
|
+
- test/lib/troo/version_test.rb
|
|
675
675
|
- test/lib/troo_test.rb
|
|
676
676
|
- test/support/fabrication.rb
|
|
677
677
|
- test/support/fake_trello/fake_response.rb
|
|
@@ -805,7 +805,6 @@ test_files:
|
|
|
805
805
|
- test/lib/troo/models/board_test.rb
|
|
806
806
|
- test/lib/troo/models/card_test.rb
|
|
807
807
|
- test/lib/troo/models/comment_test.rb
|
|
808
|
-
- test/lib/troo/models/database_test.rb
|
|
809
808
|
- test/lib/troo/models/list_test.rb
|
|
810
809
|
- test/lib/troo/models/member_test.rb
|
|
811
810
|
- test/lib/troo/models/refresh_test.rb
|
|
@@ -823,7 +822,7 @@ test_files:
|
|
|
823
822
|
- test/lib/troo/presenters/resource_test.rb
|
|
824
823
|
- test/lib/troo/remote/board_test.rb
|
|
825
824
|
- test/lib/troo/remote/card_test.rb
|
|
826
|
-
- test/lib/troo/remote/
|
|
825
|
+
- test/lib/troo/remote/comment_data_board_test.rb
|
|
827
826
|
- test/lib/troo/remote/comment_data_card_test.rb
|
|
828
827
|
- test/lib/troo/remote/comment_data_test.rb
|
|
829
828
|
- test/lib/troo/remote/comment_test.rb
|
|
@@ -836,6 +835,7 @@ test_files:
|
|
|
836
835
|
- test/lib/troo/remote/persistence/move_card_test.rb
|
|
837
836
|
- test/lib/troo/retrieval/local_test.rb
|
|
838
837
|
- test/lib/troo/retrieval/remote_test.rb
|
|
838
|
+
- test/lib/troo/version_test.rb
|
|
839
839
|
- test/lib/troo_test.rb
|
|
840
840
|
- test/support/fabrication.rb
|
|
841
841
|
- test/support/fake_trello/fake_response.rb
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require_relative '../../../test_helper'
|
|
2
|
-
|
|
3
|
-
module Troo
|
|
4
|
-
describe Database do
|
|
5
|
-
let(:described_class) { Database }
|
|
6
|
-
let(:configuration) { stub(database: '1') }
|
|
7
|
-
let(:options) { {} }
|
|
8
|
-
|
|
9
|
-
before { Ohm.stubs(:connect) }
|
|
10
|
-
|
|
11
|
-
describe '#connect' do
|
|
12
|
-
subject { described_class.connect(configuration, options) }
|
|
13
|
-
|
|
14
|
-
it 'connects to the persistence layer' do
|
|
15
|
-
subject.must_equal(nil)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|