vedeu 0.4.50 → 0.4.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +0 -5
  3. data/examples/material_colours_app.rb +1 -1
  4. data/examples/panel_app.rb +1 -1
  5. data/lib/vedeu/cli/generator/templates/application/config/configuration.erb +7 -2
  6. data/lib/vedeu/configuration/configuration.rb +1 -1
  7. data/lib/vedeu/output/border.rb +0 -6
  8. data/lib/vedeu/output/clear/named_interface.rb +2 -2
  9. data/lib/vedeu/output/output.rb +12 -12
  10. data/lib/vedeu/output/render_border.rb +1 -1
  11. data/lib/vedeu/output/renderers/all.rb +10 -5
  12. data/lib/vedeu/output/renderers/escape_sequence.rb +21 -23
  13. data/lib/vedeu/output/renderers/file.rb +16 -27
  14. data/lib/vedeu/output/renderers/html.rb +36 -42
  15. data/lib/vedeu/output/renderers/json.rb +22 -5
  16. data/lib/vedeu/output/renderers/null.rb +28 -3
  17. data/lib/vedeu/output/renderers/terminal.rb +23 -19
  18. data/lib/vedeu/output/renderers/text.rb +18 -20
  19. data/lib/vedeu/output/virtual_terminal.rb +1 -1
  20. data/lib/vedeu/support/template.rb +1 -1
  21. data/lib/vedeu/version.rb +1 -1
  22. data/test/lib/vedeu/application/application_controller_test.rb +2 -0
  23. data/test/lib/vedeu/application/application_helper_test.rb +2 -0
  24. data/test/lib/vedeu/application/controller_test.rb +1 -1
  25. data/test/lib/vedeu/application/helper_test.rb +2 -0
  26. data/test/lib/vedeu/application/view_test.rb +2 -0
  27. data/test/lib/vedeu/buffers/buffer_test.rb +1 -1
  28. data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -0
  29. data/test/lib/vedeu/cli/generator/application_test.rb +2 -0
  30. data/test/lib/vedeu/cli/generator/helpers_test.rb +1 -0
  31. data/test/lib/vedeu/configuration/api_test.rb +3 -0
  32. data/test/lib/vedeu/cursor/move_test.rb +5 -0
  33. data/test/lib/vedeu/distributed/client_test.rb +4 -0
  34. data/test/lib/vedeu/distributed/server_test.rb +9 -0
  35. data/test/lib/vedeu/dsl/use_test.rb +4 -0
  36. data/test/lib/vedeu/launcher_test.rb +2 -0
  37. data/test/lib/vedeu/main_loop_test.rb +2 -0
  38. data/test/lib/vedeu/null/interface_test.rb +1 -0
  39. data/test/lib/vedeu/output/border_test.rb +0 -8
  40. data/test/lib/vedeu/output/output_test.rb +12 -11
  41. data/test/lib/vedeu/output/refresh_test.rb +1 -0
  42. data/test/lib/vedeu/output/render_border_test.rb +1 -0
  43. data/test/lib/vedeu/output/renderers/all_test.rb +4 -8
  44. data/test/lib/vedeu/output/renderers/escape_sequence_test.rb +5 -4
  45. data/test/lib/vedeu/output/renderers/file_test.rb +14 -19
  46. data/test/lib/vedeu/output/renderers/html_test.rb +55 -56
  47. data/test/lib/vedeu/output/renderers/json_test.rb +4 -5
  48. data/test/lib/vedeu/output/renderers/null_test.rb +9 -3
  49. data/test/lib/vedeu/output/renderers/terminal_test.rb +5 -4
  50. data/test/lib/vedeu/output/renderers/text_test.rb +5 -4
  51. data/test/lib/vedeu/output/text_test.rb +2 -0
  52. data/test/lib/vedeu/output/virtual_terminal_test.rb +10 -28
  53. data/test/lib/vedeu/repositories/collection_test.rb +1 -0
  54. data/test/lib/vedeu/repositories/model_test.rb +3 -0
  55. data/test/lib/vedeu/repositories/repository_test.rb +1 -0
  56. data/test/lib/vedeu/support/visibility_test.rb +1 -0
  57. data/test/lib/vedeu/traps_test.rb +1 -0
  58. data/test/lib/vedeu_test.rb +1 -0
  59. data/vedeu.gemspec +0 -2
  60. metadata +2 -30
@@ -20,20 +20,24 @@ module Vedeu
20
20
  subject { model_instance.duplicate(_name) }
21
21
 
22
22
  context 'when the model exists' do
23
+ # @todo
23
24
  # it { skip }
24
25
  end
25
26
 
26
27
  context 'when the model does not exist' do
28
+ # @todo
27
29
  # it { skip }
28
30
  end
29
31
  end
30
32
 
31
33
  describe '#use' do
32
34
  context 'when the model exists' do
35
+ # @todo
33
36
  # it { skip }
34
37
  end
35
38
 
36
39
  context 'when the model does not exist' do
40
+ # @todo
37
41
  # it { skip }
38
42
  end
39
43
  end
@@ -28,10 +28,12 @@ module Vedeu
28
28
  subject { instance.debug_execute! }
29
29
 
30
30
  context 'when debugging is enabled in the configuration' do
31
+ # @todo
31
32
  # it { skip }
32
33
  end
33
34
 
34
35
  context 'when debugging is not enabled in the configuration' do
36
+ # @todo
35
37
  # it { skip }
36
38
  end
37
39
  end
@@ -21,10 +21,12 @@ module Vedeu
21
21
 
22
22
  context 'when the application has started' do
23
23
  context 'when the loop is running' do
24
+ # @todo
24
25
  # it { skip }
25
26
  end
26
27
 
27
28
  context 'when the loop is not running' do
29
+ # @todo
28
30
  # it { skip }
29
31
  end
30
32
  end
@@ -48,6 +48,7 @@ module Vedeu
48
48
  describe '#visible=' do
49
49
  subject { instance.visible=(:irrelevant) }
50
50
 
51
+ # @todo
51
52
  # it { skip }
52
53
  # it { subject.must_be_instance_of(FalseClass) }
53
54
  end
@@ -561,14 +561,6 @@ module Vedeu
561
561
  end
562
562
  end
563
563
 
564
- describe '#to_s' do
565
- subject { instance.to_s }
566
-
567
- it { subject.must_be_instance_of(String) }
568
-
569
- it { subject.must_equal('') }
570
- end
571
-
572
564
  end # Border
573
565
 
574
566
  end # Vedeu
@@ -5,45 +5,46 @@ module Vedeu
5
5
  describe Output do
6
6
 
7
7
  let(:described) { Vedeu::Output }
8
- let(:instance) { described.new(content) }
9
- let(:content) {}
8
+ let(:instance) { described.new(output) }
9
+ let(:output) {}
10
10
  let(:drb) { false }
11
11
 
12
12
  before do
13
13
  Vedeu::Configuration.stubs(:drb?).returns(drb)
14
+ Vedeu.renderers.stubs(:render)
14
15
  end
15
16
 
16
17
  describe '#initialize' do
17
18
  it { instance.must_be_instance_of(described) }
18
- it { instance.instance_variable_get('@content').must_equal(content) }
19
+ it { instance.instance_variable_get('@output').must_equal(output) }
19
20
  end
20
21
 
21
22
  describe '.render' do
22
23
  before { Vedeu.renderers.stubs(:render) }
23
24
 
24
- subject { described.render(content) }
25
+ subject { described.render(output) }
25
26
 
26
27
  context 'when DRb is enabled' do
27
28
  let(:drb) { true }
28
29
  let(:virtual_buffer) { [] }
29
30
 
30
31
  before do
31
- Vedeu::Renderers::HTML.stubs(:to_file)
32
+ # Vedeu::Renderers::HTML.stubs(:to_file)
32
33
  Vedeu::VirtualBuffer.stubs(:retrieve).returns(virtual_buffer)
33
34
  end
34
35
 
35
36
  it {
36
- Vedeu.expects(:trigger).with(:_drb_store_output_, content)
37
+ Vedeu.expects(:trigger).with(:_drb_store_output_, output)
37
38
  subject
38
39
  }
39
40
 
40
- it 'writes the virtual buffer to a file' do
41
- Vedeu::Renderers::HTML.expects(:to_file).with(virtual_buffer)
42
- subject
43
- end
41
+ # it 'writes the virtual buffer to a file' do
42
+ # Vedeu::Renderers::HTML.expects(:to_file).with(virtual_buffer)
43
+ # subject
44
+ # end
44
45
  end
45
46
 
46
- it { Vedeu.renderers.expects(:render).with(content); subject }
47
+ it { Vedeu.renderers.expects(:render).with(output); subject }
47
48
  end
48
49
 
49
50
  end # Output
@@ -28,6 +28,7 @@ module Vedeu
28
28
  end
29
29
 
30
30
  context 'when there are registered interfaces' do
31
+ # @todo
31
32
  # it { skip }
32
33
  end
33
34
  end
@@ -48,6 +48,7 @@ module Vedeu
48
48
  context 'when the border is enabled' do
49
49
  let(:enabled) { true }
50
50
 
51
+ # @todo
51
52
  # it { skip }
52
53
  end
53
54
  end
@@ -17,6 +17,7 @@ module Vedeu
17
17
  describe Renderers do
18
18
 
19
19
  let(:described) { Vedeu::Renderers }
20
+ let(:output) {}
20
21
 
21
22
  before { Vedeu::Renderers.reset }
22
23
  after { Vedeu::Renderers.reset }
@@ -29,14 +30,16 @@ module Vedeu
29
30
  context 'API' do
30
31
  before { Vedeu::Renderers.renderer(*renderers) }
31
32
 
32
- subject { Vedeu.renderers.render }
33
+ subject { Vedeu.renderers.render(output) }
33
34
 
35
+ # @todo
34
36
  # context 'when a single renderer is defined' do
35
37
  # let(:renderers) { DummyRenderer }
36
38
 
37
39
  # it { subject.must_equal([:dummy]) }
38
40
  # end
39
41
 
42
+ # @todo
40
43
  # context 'when multiple renderers are defined' do
41
44
  # let(:renderers) { [DummyRenderer, FooRenderer] }
42
45
 
@@ -92,13 +95,6 @@ module Vedeu
92
95
  it { subject.size.must_equal(0) }
93
96
  end
94
97
 
95
- describe '.storage' do
96
- subject { described.storage }
97
-
98
- it { subject.must_be_instance_of(Set) }
99
- it { subject.size.must_equal(0) }
100
- end
101
-
102
98
  end # Renderers
103
99
 
104
100
  end # Vedeu
@@ -7,16 +7,17 @@ module Vedeu
7
7
  describe EscapeSequence do
8
8
 
9
9
  let(:described) { Vedeu::Renderers::EscapeSequence }
10
- let(:instance) { described.new(output) }
10
+ let(:instance) { described.new(options) }
11
+ let(:options) { {} }
11
12
  let(:output) {}
12
13
 
13
14
  describe '#initialize' do
14
15
  it { instance.must_be_instance_of(described) }
15
- it { instance.instance_variable_get('@output').must_equal(output) }
16
+ it { instance.instance_variable_get('@options').must_equal(options) }
16
17
  end
17
18
 
18
- describe '.render' do
19
- subject { described.render(output) }
19
+ describe '#render' do
20
+ subject { instance.render(output) }
20
21
 
21
22
  it { subject.must_be_instance_of(String) }
22
23
 
@@ -7,7 +7,7 @@ module Vedeu
7
7
  describe File do
8
8
 
9
9
  let(:described) { Vedeu::Renderers::File }
10
- let(:instance) { described.new(output, options) }
10
+ let(:instance) { described.new(options) }
11
11
  let(:output) { 'Some content...' }
12
12
  let(:options) {
13
13
  {
@@ -20,27 +20,22 @@ module Vedeu
20
20
 
21
21
  describe '#initialize' do
22
22
  it { instance.must_be_instance_of(described) }
23
- it { instance.instance_variable_get('@output').must_equal(output) }
24
23
  it { instance.instance_variable_get('@options').must_equal(options) }
25
24
  end
26
25
 
27
- describe '.render' do
28
- it { described.must_respond_to(:render) }
29
- end
30
-
31
26
  describe '#render' do
32
27
  let(:_time) { Time.new(2015, 4, 12, 20, 05, 00, "+01:00") }
33
28
 
34
- subject { instance.render }
29
+ subject { instance.render(output) }
35
30
 
36
31
  it { subject.must_be_instance_of(String) }
37
32
 
38
33
  context 'when the filename option is not set' do
39
34
  context 'when the timestamp option is not set' do
40
- it {
41
- ::File.expects(:open).with('/tmp/out', 'w')
42
- subject
43
- }
35
+ # it {
36
+ # ::File.expects(:write).with('/tmp/out', nil)
37
+ # subject
38
+ # }
44
39
  end
45
40
 
46
41
  context 'when the timestamp option is set' do
@@ -48,20 +43,20 @@ module Vedeu
48
43
 
49
44
  before { Time.stubs(:now).returns(_time) }
50
45
 
51
- it {
52
- ::File.expects(:open).with('/tmp/out_1428865500.0', 'w')
53
- subject
54
- }
46
+ # it {
47
+ # ::File.expects(:write).with('/tmp/out_1428865500.0', 'w')
48
+ # subject
49
+ # }
55
50
  end
56
51
  end
57
52
 
58
53
  context 'when the filename option is set' do
59
54
  let(:filename) { 'some_name' }
60
55
 
61
- it {
62
- ::File.expects(:open).with('/tmp/some_name', 'w')
63
- subject
64
- }
56
+ # it {
57
+ # ::File.expects(:write).with('/tmp/some_name', 'w')
58
+ # subject
59
+ # }
65
60
  end
66
61
  end
67
62
 
@@ -6,82 +6,80 @@ module Vedeu
6
6
 
7
7
  describe HTML do
8
8
 
9
- let(:described) { Vedeu::Renderers::HTML }
10
- let(:instance) { described.new(output) }
11
- let(:output) {}
12
-
13
- before do
14
- ::File.stubs(:open)
15
- end
9
+ let(:described) { Vedeu::Renderers::HTML }
10
+ let(:instance) { described.new(options) }
11
+ let(:options) {
12
+ {
13
+ content: content,
14
+ write_file: write_file,
15
+ }
16
+ }
17
+ let(:content) { [''] }
18
+ let(:write_file) { false }
16
19
 
17
20
  describe '#initialize' do
18
21
  it { instance.must_be_instance_of(described) }
19
- it { instance.instance_variable_get('@output').must_equal(output) }
22
+ it { instance.instance_variable_get('@options').must_equal(options) }
20
23
  end
21
24
 
22
- describe '.render' do
23
- it { described.must_respond_to(:render) }
24
- end
25
+ # describe '#render' do
26
+ # before { ::File.stubs(:open) }
25
27
 
26
- describe '.to_file' do
27
- it { described.must_respond_to(:to_file) }
28
- end
28
+ # subject { instance.render(content) }
29
29
 
30
- describe '#render' do
31
- before { ::File.stubs(:open) }
30
+ # it { subject.must_be_instance_of(String) }
32
31
 
33
- subject { instance.render }
32
+ # context 'when the :write_file option is true' do
33
+ # let(:write_file) { true }
34
34
 
35
- it { subject.must_be_instance_of(String) }
36
- end
35
+ # context 'when a path is given' do
36
+ # let(:path) { '/tmp/test_vedeu_html_renderer.html' }
37
37
 
38
- describe '#to_file' do
39
- before { ::File.stubs(:open) }
38
+ # # it do
39
+ # # ::File.expects(:open)
40
+ # # subject
41
+ # # end
42
+ # end
40
43
 
41
- subject { instance.to_file(path) }
44
+ # context 'when a path is not given' do
45
+ # let(:path) {}
46
+ # let(:_time) { Time.new(2015, 4, 12, 16, 55) }
42
47
 
43
- context 'when a path is given' do
44
- let(:path) { '/tmp/test_vedeu_html_renderer.html' }
48
+ # before { Time.stubs(:now).returns(_time) }
45
49
 
46
- it do
47
- ::File.expects(:open)
48
- subject
49
- end
50
- end
50
+ # # it do
51
+ # # ::File.expects(:open)#.with('/tmp/vedeu_html_1428854100.html', 'w')
52
+ # # subject
53
+ # # end
54
+ # end
55
+ # end
51
56
 
52
- context 'when a path is not given' do
53
- let(:path) {}
54
- let(:_time) { Time.new(2015, 4, 12, 16, 55) }
57
+ # context 'when the :write_file options is false' do
58
+ # let(:write_file) { false }
55
59
 
56
- before { Time.stubs(:now).returns(_time) }
57
-
58
- it do
59
- ::File.expects(:open)#.with('/tmp/vedeu_html_1428854100.html', 'w')
60
- subject
61
- end
62
- end
63
- end
60
+ # @todo
61
+ # # it { skip }
62
+ # end
63
+ # end
64
64
 
65
65
  describe '#html_body' do
66
+ let(:content) {
67
+ [
68
+ [
69
+ Vedeu::Char.new(value: 't'),
70
+ Vedeu::Char.new(value: 'e'),
71
+ Vedeu::Char.new(value: 's'),
72
+ Vedeu::Char.new(value: 't'),
73
+ ]
74
+ ]
75
+ }
76
+
66
77
  subject { instance.html_body }
67
78
 
68
79
  it { subject.must_be_instance_of(String) }
69
80
 
70
- it { subject.must_equal('') }
71
-
72
- context 'when there is output' do
73
- let(:output) {
74
- [
75
- [
76
- Vedeu::Char.new(value: 't'),
77
- Vedeu::Char.new(value: 'e'),
78
- Vedeu::Char.new(value: 's'),
79
- Vedeu::Char.new(value: 't'),
80
- ]
81
- ]
82
- }
83
-
84
- it { subject.must_equal(
81
+ it do
82
+ subject.must_equal(
85
83
  "<tr>\n" \
86
84
  "<td style='background:#000;color:#222;border:1px #000 solid;'>" \
87
85
  "t</td>\n" \
@@ -91,7 +89,8 @@ module Vedeu
91
89
  "s</td>\n" \
92
90
  "<td style='background:#000;color:#222;border:1px #000 solid;'>" \
93
91
  "t</td>\n" \
94
- "</tr>\n") }
92
+ "</tr>\n"
93
+ )
95
94
  end
96
95
  end
97
96
 
@@ -7,18 +7,17 @@ module Vedeu
7
7
  describe JSON do
8
8
 
9
9
  let(:described) { Vedeu::Renderers::JSON }
10
- let(:instance) { described.new(output, options) }
11
- let(:output) {}
10
+ let(:instance) { described.new(options) }
12
11
  let(:options) { {} }
12
+ let(:output) {}
13
13
 
14
14
  describe '#initialize' do
15
15
  it { instance.must_be_instance_of(described) }
16
- it { instance.instance_variable_get('@output').must_equal(output) }
17
16
  it { instance.instance_variable_get('@options').must_equal(options) }
18
17
  end
19
18
 
20
- describe '.render' do
21
- subject { described.render(output, options) }
19
+ describe '#render' do
20
+ subject { instance.render(output) }
22
21
 
23
22
  it { subject.must_be_instance_of(String) }
24
23