vedeu 0.4.53 → 0.4.54

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/api.rb +68 -5
  3. data/lib/vedeu/bindings/system.rb +0 -15
  4. data/lib/vedeu/bindings/visibility.rb +57 -13
  5. data/lib/vedeu/buffers/buffer.rb +5 -56
  6. data/lib/vedeu/cursor/cursor.rb +24 -16
  7. data/lib/vedeu/exceptions.rb +1 -1
  8. data/lib/vedeu/models/group.rb +39 -4
  9. data/lib/vedeu/models/interface.rb +41 -5
  10. data/lib/vedeu/null/buffer.rb +5 -0
  11. data/lib/vedeu/null/interface.rb +15 -0
  12. data/lib/vedeu/output/all.rb +1 -1
  13. data/lib/vedeu/output/background.rb +1 -1
  14. data/lib/vedeu/output/clear/named_interface.rb +0 -2
  15. data/lib/vedeu/output/{translator.rb → colour_translator.rb} +5 -5
  16. data/lib/vedeu/output/foreground.rb +1 -1
  17. data/lib/vedeu/output/render_border.rb +0 -1
  18. data/lib/vedeu/repositories/model.rb +15 -6
  19. data/lib/vedeu/repositories/repositories/buffers.rb +6 -0
  20. data/lib/vedeu/repositories/repositories/cursors.rb +6 -0
  21. data/lib/vedeu/repositories/repositories/groups.rb +6 -0
  22. data/lib/vedeu/repositories/repositories/interfaces.rb +6 -0
  23. data/lib/vedeu/support/all.rb +1 -2
  24. data/lib/vedeu/support/template.rb +7 -0
  25. data/lib/vedeu/support/toggleable.rb +98 -0
  26. data/lib/vedeu/version.rb +1 -1
  27. data/test/lib/vedeu/api_test.rb +7 -1
  28. data/test/lib/vedeu/bindings/system_test.rb +5 -16
  29. data/test/lib/vedeu/bindings/visibility_test.rb +4 -0
  30. data/test/lib/vedeu/buffers/buffer_test.rb +9 -91
  31. data/test/lib/vedeu/cursor/cursor_test.rb +4 -6
  32. data/test/lib/vedeu/dsl/geometry_test.rb +24 -0
  33. data/test/lib/vedeu/models/group_test.rb +16 -14
  34. data/test/lib/vedeu/models/interface_test.rb +1 -1
  35. data/test/lib/vedeu/null/buffer_test.rb +6 -0
  36. data/test/lib/vedeu/null/interface_test.rb +18 -0
  37. data/test/lib/vedeu/output/clear/named_interface_test.rb +10 -19
  38. data/test/lib/vedeu/output/{translator_test.rb → colour_translator_test.rb} +5 -5
  39. data/test/lib/vedeu/support/toggleable_test.rb +69 -0
  40. data/vedeu.gemspec +1 -1
  41. metadata +10 -13
  42. data/lib/vedeu/support/options.rb +0 -70
  43. data/lib/vedeu/support/visibility.rb +0 -122
  44. data/test/lib/vedeu/support/options_test.rb +0 -70
  45. data/test/lib/vedeu/support/visibility_test.rb +0 -95
@@ -1,70 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- describe Options do
6
-
7
- let(:described) { Vedeu::Options }
8
- let(:instance) { described.new(options) }
9
- let(:options) {
10
- {}
11
- }
12
-
13
- describe '#initialize' do
14
- it { instance.must_be_instance_of(described) }
15
- it { instance.instance_variable_get('@_options').must_equal(options) }
16
- end
17
-
18
- describe '#_build' do
19
- subject { instance._build }
20
-
21
- it { subject.must_be_instance_of(described) }
22
-
23
- context 'with no options' do
24
- it 'defines no methods' do
25
- subject
26
- instance._defined.must_equal([])
27
- end
28
- end
29
-
30
- context 'with a predicate option' do
31
- let(:options) {
32
- {
33
- predicate: false
34
- }
35
- }
36
-
37
- it 'defines the method and the predicate as an alias to that method' do
38
- subject
39
- instance.must_respond_to(:predicate)
40
- instance.predicate.must_equal(false)
41
-
42
- instance.must_respond_to(:predicate?)
43
- instance.predicate?.must_equal(false)
44
-
45
- instance._defined.must_equal([:predicate, :predicate?])
46
- end
47
- end
48
-
49
- context 'with a normal option' do
50
- let(:options) {
51
- {
52
- some_option: 'some_value'
53
- }
54
- }
55
-
56
- it 'defines the method' do
57
- subject
58
- instance.must_respond_to(:some_option)
59
- instance.some_option.must_equal('some_value')
60
-
61
- instance.wont_respond_to(:some_option?)
62
-
63
- instance._defined.must_equal([:some_option])
64
- end
65
- end
66
- end
67
-
68
- end # Option
69
-
70
- end # Vedeu
@@ -1,95 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Vedeu
4
-
5
- class VisibilityTestModel
6
- attr_accessor :visible
7
- alias_method :visible?, :visible
8
-
9
- def initialize(visible = true)
10
- @visible = visible
11
- end
12
-
13
- def store
14
- self
15
- end
16
- end
17
-
18
- describe Visibility do
19
-
20
- let(:described) { Vedeu::Visibility }
21
- let(:instance) { described.new(model) }
22
- let(:model) { VisibilityTestModel.new(visible) }
23
- let(:visible) { true }
24
- let(:_name) { 'Vedeu::Visibility' }
25
-
26
- describe '#initialize' do
27
- it { instance.must_be_instance_of(described) }
28
- it { instance.instance_variable_get('@model').must_equal(model) }
29
- end
30
-
31
- describe '.show' do
32
- subject { described.show(model) }
33
-
34
- it { subject.must_equal(model) }
35
-
36
- it { subject; instance.state.must_equal(:visible) }
37
- end
38
-
39
- describe '.hide' do
40
- subject { described.hide(model) }
41
-
42
- it { subject.must_equal(model) }
43
-
44
- it { subject; instance.state.must_equal(:invisible) }
45
- end
46
-
47
- describe '.show_cursor' do
48
- subject { described.show_cursor(_name) }
49
-
50
- it { subject; instance.state.must_equal(:visible) }
51
- end
52
-
53
- describe '.hide_cursor' do
54
- subject { described.hide_cursor(_name) }
55
-
56
- # @todo
57
- # it { subject; instance.state.must_equal(:invisible) }
58
- # it { skip }
59
- end
60
-
61
- describe '.toggle' do
62
- subject { described.toggle(model) }
63
-
64
- it { subject.must_equal(model) }
65
-
66
- context 'when the model is visible' do
67
- it { subject; instance.state.must_equal(:invisible) }
68
- end
69
-
70
- context 'when the model is not visible' do
71
- let(:visible) { false }
72
-
73
- it { subject; instance.state.must_equal(:visible) }
74
- end
75
- end
76
-
77
- describe '#state' do
78
- subject { instance.state }
79
-
80
- it { subject.must_be_instance_of(Symbol) }
81
-
82
- context 'when the model is visible' do
83
- it { subject.must_equal(:visible) }
84
- end
85
-
86
- context 'when the model is not visible' do
87
- let(:visible) { false }
88
-
89
- it { subject.must_equal(:invisible) }
90
- end
91
- end
92
-
93
- end # Visibility
94
-
95
- end # Vedeu