vedeu 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -2
  3. data/Rakefile +8 -0
  4. data/bin/vedeu +1 -1
  5. data/config/cucumber.yml +8 -0
  6. data/features/getting_started.feature +10 -0
  7. data/features/step_definitions/vedeu_steps.rb +11 -0
  8. data/features/support/env.rb +12 -0
  9. data/lib/vedeu.rb +30 -9
  10. data/lib/vedeu/application.rb +1 -1
  11. data/lib/vedeu/launcher.rb +26 -0
  12. data/lib/vedeu/output/colour.rb +1 -1
  13. data/lib/vedeu/output/compositor.rb +9 -6
  14. data/lib/vedeu/output/directive.rb +1 -1
  15. data/lib/vedeu/output/geometry.rb +1 -1
  16. data/lib/vedeu/output/position.rb +2 -2
  17. data/lib/vedeu/output/style.rb +1 -1
  18. data/lib/vedeu/output/wordwrap.rb +2 -1
  19. data/lib/vedeu/process/event_loop.rb +2 -2
  20. data/lib/vedeu/process/input.rb +30 -0
  21. data/lib/vedeu/repository/command.rb +32 -0
  22. data/lib/vedeu/repository/command_repository.rb +27 -0
  23. data/lib/vedeu/{process → repository}/dummy_command.rb +2 -2
  24. data/lib/vedeu/repository/dummy_interface.rb +4 -0
  25. data/lib/vedeu/repository/interface.rb +52 -0
  26. data/lib/vedeu/repository/interface_repository.rb +49 -0
  27. data/lib/vedeu/repository/repository.rb +35 -0
  28. data/lib/vedeu/repository/storage.rb +46 -0
  29. data/lib/vedeu/support/terminal.rb +5 -6
  30. data/lib/vedeu/version.rb +1 -1
  31. data/test/lib/vedeu/application_test.rb +1 -1
  32. data/test/lib/vedeu/output/compositor_test.rb +15 -13
  33. data/test/lib/vedeu/output/directive_test.rb +1 -1
  34. data/test/lib/vedeu/output/position_test.rb +1 -1
  35. data/test/lib/vedeu/process/event_loop_test.rb +2 -3
  36. data/test/lib/vedeu/process/input_test.rb +19 -0
  37. data/test/lib/vedeu/repository/command_repository_test.rb +55 -0
  38. data/test/lib/vedeu/repository/command_test.rb +39 -0
  39. data/test/lib/vedeu/repository/interface_repository_test.rb +71 -0
  40. data/test/lib/vedeu/repository/interface_test.rb +65 -0
  41. data/test/lib/vedeu/repository/repository_test.rb +88 -0
  42. data/test/lib/vedeu/repository/storage_test.rb +50 -0
  43. data/test/test_helper.rb +8 -0
  44. data/vedeu.gemspec +3 -0
  45. metadata +75 -21
  46. data/lib/vedeu/interface/dummy_interface.rb +0 -14
  47. data/lib/vedeu/interface/interface.rb +0 -57
  48. data/lib/vedeu/interface/interfaces.rb +0 -66
  49. data/lib/vedeu/process/command.rb +0 -51
  50. data/lib/vedeu/process/commands.rb +0 -35
  51. data/test/lib/vedeu/interface/dummy_test.rb +0 -22
  52. data/test/lib/vedeu/interface/interface_test.rb +0 -45
  53. data/test/lib/vedeu/interface/interfaces_test.rb +0 -108
  54. data/test/lib/vedeu/process/command_test.rb +0 -48
  55. data/test/lib/vedeu/process/commands_test.rb +0 -56
  56. data/test/lib/vedeu/process/dummy_command_test.rb +0 -16
@@ -0,0 +1,71 @@
1
+ require_relative '../../../test_helper'
2
+
3
+ module Vedeu
4
+ describe InterfaceRepository do
5
+ let(:described_class) { InterfaceRepository }
6
+ let(:interface) { :dummy }
7
+ let(:value) { "dummy" }
8
+
9
+ before do
10
+ Interface.create({ name: "dummy" })
11
+
12
+ Terminal.stubs(:input)
13
+ Input.stubs(:evaluate)
14
+ Compositor.stubs(:arrange)
15
+ end
16
+
17
+ describe '.activate' do
18
+ let(:subject) { described_class.activate(interface) }
19
+
20
+ it { subject.must_be_instance_of(Array) }
21
+ end
22
+
23
+ describe '.deactivate' do
24
+ let(:subject) { described_class.deactivate }
25
+
26
+ it { subject.must_be_instance_of(Array) }
27
+ end
28
+
29
+ describe '.activated' do
30
+ let(:subject) { described_class.activated }
31
+
32
+ it { subject.must_be_instance_of(Interface) }
33
+ end
34
+
35
+ describe '.find_by_name' do
36
+ let(:subject) { described_class.find_by_name(value) }
37
+
38
+ it { subject.must_be_instance_of(Interface) }
39
+ end
40
+
41
+ describe '.initial_state' do
42
+ let(:subject) { described_class.initial_state }
43
+
44
+ it { subject.must_be_instance_of(Array) }
45
+ end
46
+
47
+ describe '.input' do
48
+ let(:subject) { described_class.input }
49
+
50
+ it { subject.must_be_instance_of(Array) }
51
+ end
52
+
53
+ describe '.output' do
54
+ let(:subject) { described_class.output }
55
+
56
+ it { subject.must_be_instance_of(Array) }
57
+ end
58
+
59
+ describe '.update' do
60
+ let(:subject) { described_class.update }
61
+
62
+ it { skip }
63
+ end
64
+
65
+ describe '.klass' do
66
+ let(:subject) { described_class.klass }
67
+
68
+ it { subject.must_equal(Interface) }
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,65 @@
1
+ require_relative '../../../test_helper'
2
+
3
+ module Vedeu
4
+ describe Interface do
5
+ let(:described_class) { Interface }
6
+ let(:described_instance) { described_class.new(attributes) }
7
+ let(:attributes) { { name: :test_interface } }
8
+ let(:result) {}
9
+
10
+ before do
11
+ Terminal.stubs(:input).returns('stop')
12
+ Input.stubs(:evaluate).returns(result)
13
+ Compositor.stubs(:arrange).returns([])
14
+ end
15
+
16
+ it { described_instance.must_be_instance_of(Interface) }
17
+
18
+ describe '#create' do
19
+ let(:subject) { described_class.create(attributes) }
20
+
21
+ it { subject.must_be_instance_of(Interface) }
22
+ end
23
+
24
+ describe '#initial_state' do
25
+ let(:subject) { described_instance.initial_state }
26
+
27
+ # it { proc { subject }.must_raise(NotImplementedError) }
28
+
29
+ it { subject.must_be_instance_of(NilClass) }
30
+ end
31
+
32
+ describe '#origin' do
33
+ it { skip }
34
+ end
35
+
36
+ describe '#initial_state' do
37
+ it { skip }
38
+ end
39
+
40
+ describe '#input' do
41
+ let(:subject) { described_instance.input }
42
+
43
+ context 'when the command evaluates to :stop' do
44
+ let(:result) { :stop }
45
+
46
+ it { proc { subject }.must_raise(Collapse) }
47
+ end
48
+
49
+ context 'when the command evaluates to anything else' do
50
+ let(:result) { :something_else }
51
+
52
+ it { subject.must_be_instance_of(NilClass) }
53
+ end
54
+ end
55
+
56
+ describe '#output' do
57
+ let(:subject) { described_instance.output }
58
+ let(:command) { mock }
59
+
60
+ it 'sends the output of the command to the compositor' do
61
+ subject.must_be_instance_of(NilClass)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,88 @@
1
+ require_relative '../../../test_helper'
2
+
3
+ module Vedeu
4
+ class Dummy
5
+ attr_accessor :id
6
+
7
+ def name
8
+ "dummy"
9
+ end
10
+ end
11
+
12
+ class DummyRepository
13
+ extend Repository
14
+
15
+ def self.klass
16
+ Dummy
17
+ end
18
+ end
19
+
20
+ describe Repository do
21
+ let(:described_class) { DummyRepository }
22
+
23
+ before do
24
+ @dummy = DummyRepository.create(Dummy.new)
25
+ end
26
+
27
+ after do
28
+ DummyRepository.reset
29
+ end
30
+
31
+ describe '#adaptor' do
32
+ let(:subject) { described_class.adaptor }
33
+
34
+ it { subject.must_be_instance_of(Storage) }
35
+ end
36
+
37
+ describe '#adaptor=' do
38
+ let(:subject) { described_class.adaptor=(adaptor) }
39
+ let(:adaptor) { Storage.new }
40
+
41
+ it { subject.must_be_instance_of(Storage) }
42
+ end
43
+
44
+ describe '#find' do
45
+ let(:subject) { described_class.find(id) }
46
+ let(:id) { @dummy.id }
47
+
48
+ it { subject.must_be_instance_of(Dummy) }
49
+ end
50
+
51
+ describe '#all' do
52
+ let(:subject) { described_class.all }
53
+
54
+ it { subject.must_be_instance_of(Array) }
55
+ end
56
+
57
+ describe '#query' do
58
+ let(:subject) { described_class.query(klass, attribute, value) }
59
+ let(:klass) { Dummy }
60
+ let(:attribute) { :name }
61
+ let(:value) { "dummy" }
62
+
63
+ it { subject.must_be_instance_of(Dummy) }
64
+ end
65
+
66
+ describe '#create' do
67
+ let(:subject) { described_class.create(model) }
68
+ let(:model) { @dummy }
69
+
70
+ it { subject.must_be_instance_of(Dummy) }
71
+ end
72
+
73
+ describe '#delete' do
74
+ let(:subject) { described_class.delete(model) }
75
+ let(:model) { @dummy }
76
+
77
+ it { subject.must_be_instance_of(Dummy) }
78
+ end
79
+
80
+ describe '#reset' do
81
+ let(:subject) { described_class.reset }
82
+
83
+ it { subject.must_be_instance_of(Array) }
84
+
85
+ # it { subject.must_be_empty }
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,50 @@
1
+ require_relative '../../../test_helper'
2
+
3
+ module Vedeu
4
+ describe Storage do
5
+ let(:described_class) { Storage }
6
+ let(:subject) { described_class.new }
7
+ let(:record) {}
8
+ let(:klass) {}
9
+
10
+ it { subject.must_be_instance_of(Storage) }
11
+
12
+ describe '#create' do
13
+ let(:subject) { described_class.new.create(record) }
14
+
15
+ it { skip }
16
+ end
17
+
18
+ describe '#delete' do
19
+ let(:subject) { described_class.new.delete(record) }
20
+
21
+ it { skip }
22
+ end
23
+
24
+ describe '#reset' do
25
+ let(:subject) { described_class.new.reset(klass) }
26
+
27
+ it { skip }
28
+ end
29
+
30
+ describe '#find' do
31
+ let(:subject) { described_class.new.find(klass, id) }
32
+
33
+ it { skip }
34
+ end
35
+
36
+ describe '#all' do
37
+ let(:subject) { described_class.new.all(klass) }
38
+
39
+ it { skip }
40
+ end
41
+
42
+ describe '#query' do
43
+ let(:subject) { described_class.new.query(klass, attribute, value) }
44
+ let(:attribute) {}
45
+ let(:value) {}
46
+
47
+ it { skip }
48
+ end
49
+ end
50
+ end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'simplecov'
2
2
  require 'minitest/autorun'
3
3
  require 'minitest/pride'
4
+ require 'pry'
5
+ require 'pry-nav'
4
6
 
5
7
  SimpleCov.start do
6
8
  command_name 'MiniTest::Spec'
@@ -15,6 +17,12 @@ module MiniTest
15
17
  end
16
18
  end
17
19
 
20
+ class DummyCommand
21
+ def self.dispatch
22
+ :stop
23
+ end
24
+ end
25
+
18
26
  Minitest.after_run do
19
27
  print [27.chr, '[', '?25h'].join # show cursor
20
28
  end
data/vedeu.gemspec CHANGED
@@ -17,7 +17,10 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
+ spec.add_development_dependency "aruba"
20
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "cucumber"
23
+ spec.add_development_dependency "guard-cucumber"
21
24
  spec.add_development_dependency "guard", "2.6.1"
22
25
  spec.add_development_dependency "guard-minitest", "2.3.0"
23
26
  spec.add_development_dependency "minitest", "5.3.4"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
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-06-01 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aruba
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -24,6 +38,34 @@ dependencies:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
40
  version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cucumber
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: guard
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -152,11 +194,13 @@ files:
152
194
  - README.md
153
195
  - Rakefile
154
196
  - bin/vedeu
197
+ - config/cucumber.yml
198
+ - features/getting_started.feature
199
+ - features/step_definitions/vedeu_steps.rb
200
+ - features/support/env.rb
155
201
  - lib/vedeu.rb
156
202
  - lib/vedeu/application.rb
157
- - lib/vedeu/interface/dummy_interface.rb
158
- - lib/vedeu/interface/interface.rb
159
- - lib/vedeu/interface/interfaces.rb
203
+ - lib/vedeu/launcher.rb
160
204
  - lib/vedeu/output/background.rb
161
205
  - lib/vedeu/output/base.rb
162
206
  - lib/vedeu/output/colour.rb
@@ -170,17 +214,20 @@ files:
170
214
  - lib/vedeu/output/style.rb
171
215
  - lib/vedeu/output/translator.rb
172
216
  - lib/vedeu/output/wordwrap.rb
173
- - lib/vedeu/process/command.rb
174
- - lib/vedeu/process/commands.rb
175
- - lib/vedeu/process/dummy_command.rb
176
217
  - lib/vedeu/process/event_loop.rb
177
218
  - lib/vedeu/process/exit.rb
219
+ - lib/vedeu/process/input.rb
220
+ - lib/vedeu/repository/command.rb
221
+ - lib/vedeu/repository/command_repository.rb
222
+ - lib/vedeu/repository/dummy_command.rb
223
+ - lib/vedeu/repository/dummy_interface.rb
224
+ - lib/vedeu/repository/interface.rb
225
+ - lib/vedeu/repository/interface_repository.rb
226
+ - lib/vedeu/repository/repository.rb
227
+ - lib/vedeu/repository/storage.rb
178
228
  - lib/vedeu/support/terminal.rb
179
229
  - lib/vedeu/version.rb
180
230
  - test/lib/vedeu/application_test.rb
181
- - test/lib/vedeu/interface/dummy_test.rb
182
- - test/lib/vedeu/interface/interface_test.rb
183
- - test/lib/vedeu/interface/interfaces_test.rb
184
231
  - test/lib/vedeu/output/background_test.rb
185
232
  - test/lib/vedeu/output/base_test.rb
186
233
  - test/lib/vedeu/output/colour_test.rb
@@ -194,11 +241,15 @@ files:
194
241
  - test/lib/vedeu/output/style_test.rb
195
242
  - test/lib/vedeu/output/translator_test.rb
196
243
  - test/lib/vedeu/output/wordwrap_test.rb
197
- - test/lib/vedeu/process/command_test.rb
198
- - test/lib/vedeu/process/commands_test.rb
199
- - test/lib/vedeu/process/dummy_command_test.rb
200
244
  - test/lib/vedeu/process/event_loop_test.rb
201
245
  - test/lib/vedeu/process/exit_test.rb
246
+ - test/lib/vedeu/process/input_test.rb
247
+ - test/lib/vedeu/repository/command_repository_test.rb
248
+ - test/lib/vedeu/repository/command_test.rb
249
+ - test/lib/vedeu/repository/interface_repository_test.rb
250
+ - test/lib/vedeu/repository/interface_test.rb
251
+ - test/lib/vedeu/repository/repository_test.rb
252
+ - test/lib/vedeu/repository/storage_test.rb
202
253
  - test/lib/vedeu/support/terminal_test.rb
203
254
  - test/lib/vedeu/version_test.rb
204
255
  - test/test_helper.rb
@@ -228,10 +279,10 @@ signing_key:
228
279
  specification_version: 4
229
280
  summary: A terminal case of wonderland.
230
281
  test_files:
282
+ - features/getting_started.feature
283
+ - features/step_definitions/vedeu_steps.rb
284
+ - features/support/env.rb
231
285
  - test/lib/vedeu/application_test.rb
232
- - test/lib/vedeu/interface/dummy_test.rb
233
- - test/lib/vedeu/interface/interface_test.rb
234
- - test/lib/vedeu/interface/interfaces_test.rb
235
286
  - test/lib/vedeu/output/background_test.rb
236
287
  - test/lib/vedeu/output/base_test.rb
237
288
  - test/lib/vedeu/output/colour_test.rb
@@ -245,12 +296,15 @@ test_files:
245
296
  - test/lib/vedeu/output/style_test.rb
246
297
  - test/lib/vedeu/output/translator_test.rb
247
298
  - test/lib/vedeu/output/wordwrap_test.rb
248
- - test/lib/vedeu/process/command_test.rb
249
- - test/lib/vedeu/process/commands_test.rb
250
- - test/lib/vedeu/process/dummy_command_test.rb
251
299
  - test/lib/vedeu/process/event_loop_test.rb
252
300
  - test/lib/vedeu/process/exit_test.rb
301
+ - test/lib/vedeu/process/input_test.rb
302
+ - test/lib/vedeu/repository/command_repository_test.rb
303
+ - test/lib/vedeu/repository/command_test.rb
304
+ - test/lib/vedeu/repository/interface_repository_test.rb
305
+ - test/lib/vedeu/repository/interface_test.rb
306
+ - test/lib/vedeu/repository/repository_test.rb
307
+ - test/lib/vedeu/repository/storage_test.rb
253
308
  - test/lib/vedeu/support/terminal_test.rb
254
309
  - test/lib/vedeu/version_test.rb
255
310
  - test/test_helper.rb
256
- has_rdoc: