vedeu 0.6.69 → 0.6.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +4 -0
  3. data/lib/vedeu/all.rb +5 -7
  4. data/lib/vedeu/borders/all.rb +1 -0
  5. data/lib/vedeu/borders/repository.rb +2 -6
  6. data/lib/vedeu/borders/set_attribute.rb +71 -0
  7. data/lib/vedeu/buffers/buffer.rb +6 -1
  8. data/lib/vedeu/buffers/refresh.rb +6 -1
  9. data/lib/vedeu/common.rb +2 -1
  10. data/lib/vedeu/configuration/configuration.rb +1 -1
  11. data/lib/vedeu/cursors/all.rb +1 -0
  12. data/lib/vedeu/cursors/cursor.rb +8 -27
  13. data/lib/vedeu/cursors/move.rb +69 -0
  14. data/lib/vedeu/cursors/repository.rb +1 -1
  15. data/lib/vedeu/dsl/all.rb +2 -0
  16. data/lib/vedeu/dsl/composition.rb +6 -1
  17. data/lib/vedeu/dsl/lines.rb +21 -0
  18. data/lib/vedeu/dsl/streams.rb +21 -0
  19. data/lib/vedeu/groups/clear.rb +6 -1
  20. data/lib/vedeu/groups/refresh.rb +6 -1
  21. data/lib/vedeu/input/capture.rb +6 -1
  22. data/lib/vedeu/interfaces/clear.rb +6 -1
  23. data/lib/vedeu/interfaces/interface.rb +20 -8
  24. data/lib/vedeu/models/all.rb +1 -0
  25. data/lib/vedeu/models/focus.rb +19 -14
  26. data/lib/vedeu/models/page.rb +5 -0
  27. data/lib/vedeu/models/row.rb +5 -0
  28. data/lib/vedeu/models/toggleable.rb +6 -1
  29. data/lib/vedeu/null/all.rb +0 -1
  30. data/lib/vedeu/output/all.rb +0 -2
  31. data/lib/vedeu/output/compressor.rb +2 -1
  32. data/lib/vedeu/output/wordwrap.rb +6 -1
  33. data/lib/vedeu/output/write.rb +2 -0
  34. data/lib/vedeu/presentation/all.rb +17 -0
  35. data/lib/vedeu/presentation/background.rb +47 -0
  36. data/lib/vedeu/presentation/colour.rb +42 -0
  37. data/lib/vedeu/presentation/foreground.rb +47 -0
  38. data/lib/vedeu/{output/presentation → presentation}/presentation.rb +0 -0
  39. data/lib/vedeu/{output/presentation → presentation}/style.rb +0 -0
  40. data/lib/vedeu/presentation/styles.rb +45 -0
  41. data/lib/vedeu/{output/renderers → renderers}/all.rb +5 -5
  42. data/lib/vedeu/{output/renderers → renderers}/file.rb +0 -0
  43. data/lib/vedeu/{output/renderers → renderers}/html.rb +0 -0
  44. data/lib/vedeu/{output/renderers → renderers}/json.rb +0 -0
  45. data/lib/vedeu/{output/renderers → renderers}/options.rb +5 -1
  46. data/lib/vedeu/{output → renderers}/templates/html_renderer.vedeu +0 -0
  47. data/lib/vedeu/{output/renderers → renderers}/terminal.rb +1 -1
  48. data/lib/vedeu/repositories/all.rb +1 -0
  49. data/lib/vedeu/repositories/parent.rb +32 -0
  50. data/lib/vedeu/repositories/repositories.rb +1 -0
  51. data/lib/vedeu/runtime/flags.rb +2 -0
  52. data/lib/vedeu/templating/view_template.rb +6 -1
  53. data/lib/vedeu/version.rb +1 -1
  54. data/lib/vedeu/views/all.rb +20 -0
  55. data/lib/vedeu/{models/views → views}/char.rb +33 -21
  56. data/lib/vedeu/views/chars.rb +15 -0
  57. data/lib/vedeu/{models/views → views}/composition.rb +0 -0
  58. data/lib/vedeu/{models/views → views}/html_char.rb +0 -0
  59. data/lib/vedeu/{models/views → views}/line.rb +17 -21
  60. data/lib/vedeu/views/lines.rb +15 -0
  61. data/lib/vedeu/{models/views → views}/stream.rb +16 -20
  62. data/lib/vedeu/views/streams.rb +15 -0
  63. data/lib/vedeu/{models/views → views}/view.rb +28 -17
  64. data/lib/vedeu/views/view_collection.rb +15 -0
  65. data/lib/vedeu.rb +2 -0
  66. data/test/lib/vedeu/borders/set_attribute_test.rb +62 -0
  67. data/test/lib/vedeu/common_test.rb +6 -0
  68. data/test/lib/vedeu/cursors/cursor_test.rb +0 -8
  69. data/test/lib/vedeu/cursors/move_test.rb +73 -0
  70. data/test/lib/vedeu/cursors/repository_test.rb +3 -1
  71. data/test/lib/vedeu/dsl/lines_test.rb +12 -0
  72. data/test/lib/vedeu/dsl/streams_test.rb +13 -0
  73. data/test/lib/vedeu/events/aliases_test.rb +4 -4
  74. data/test/lib/vedeu/groups/refresh_test.rb +0 -6
  75. data/test/lib/vedeu/input/store_test.rb +2 -2
  76. data/test/lib/vedeu/interfaces/interface_test.rb +6 -1
  77. data/test/lib/vedeu/models/focus_test.rb +25 -10
  78. data/test/lib/vedeu/models/page_test.rb +6 -0
  79. data/test/lib/vedeu/models/row_test.rb +12 -0
  80. data/test/lib/vedeu/presentation/background_test.rb +72 -0
  81. data/test/lib/vedeu/presentation/colour_test.rb +67 -0
  82. data/test/lib/vedeu/presentation/foreground_test.rb +73 -0
  83. data/test/lib/vedeu/{output/presentation → presentation}/presentation_test.rb +0 -0
  84. data/test/lib/vedeu/{output/presentation → presentation}/style_test.rb +0 -0
  85. data/test/lib/vedeu/{output/presentation → presentation}/styles_test.rb +7 -9
  86. data/test/lib/vedeu/{output/renderers → renderers}/all_test.rb +3 -2
  87. data/test/lib/vedeu/{output/renderers → renderers}/file_test.rb +0 -0
  88. data/test/lib/vedeu/{output/renderers → renderers}/html_test.rb +2 -1
  89. data/test/lib/vedeu/{output/renderers → renderers}/json_test.rb +1 -0
  90. data/test/lib/vedeu/{output/renderers → renderers}/options_test.rb +10 -6
  91. data/test/lib/vedeu/{output/renderers → renderers}/terminal_test.rb +0 -0
  92. data/test/lib/vedeu/repositories/repositories_test.rb +1 -0
  93. data/test/lib/vedeu/runtime/flags_test.rb +2 -0
  94. data/test/lib/vedeu/templating/helpers_test.rb +15 -6
  95. data/test/lib/vedeu/{models/views → views}/char_test.rb +0 -0
  96. data/test/lib/vedeu/{models/views → views}/composition_test.rb +0 -0
  97. data/test/lib/vedeu/{models/views → views}/html_char_test.rb +0 -0
  98. data/test/lib/vedeu/{models/views → views}/line_test.rb +6 -1
  99. data/test/lib/vedeu/views/lines_test.rb +13 -0
  100. data/test/lib/vedeu/{models/views → views}/stream_test.rb +6 -1
  101. data/test/lib/vedeu/views/streams_test.rb +13 -0
  102. data/test/lib/vedeu/views/view_collection_test.rb +13 -0
  103. data/test/lib/vedeu/{models/views → views}/view_test.rb +6 -1
  104. data/test/support/examples/material_colours_app.rb +1 -1
  105. data/test/support/helpers/presentation_colour_test_class.rb +29 -0
  106. data/test/test_helper.rb +4 -0
  107. metadata +84 -56
  108. data/lib/vedeu/models/views/all.rb +0 -16
  109. data/lib/vedeu/null/view.rb +0 -26
  110. data/lib/vedeu/output/presentation/all.rb +0 -15
  111. data/lib/vedeu/output/presentation/colour.rb +0 -100
  112. data/lib/vedeu/output/presentation/styles.rb +0 -42
  113. data/test/lib/vedeu/null/view_test.rb +0 -31
  114. data/test/lib/vedeu/output/presentation/colour_test.rb +0 -172
@@ -0,0 +1,15 @@
1
+ module Vedeu
2
+
3
+ module Views
4
+
5
+ # A collection of {Vedeu::Views::Char} instances.
6
+ #
7
+ # @api private
8
+ #
9
+ class Chars < Vedeu::Repositories::Collection
10
+
11
+ end # Chars
12
+
13
+ end # Views
14
+
15
+ end # Vedeu
File without changes
File without changes
@@ -2,14 +2,6 @@ module Vedeu
2
2
 
3
3
  module Views
4
4
 
5
- # A collection of {Vedeu::Views::Line} instances.
6
- #
7
- # @api private
8
- #
9
- class Lines < Vedeu::Repositories::Collection
10
-
11
- end # Lines
12
-
13
5
  # Represents a single row of the terminal. It is a container for
14
6
  # {Vedeu::Views::Stream} objects. A line's width is determined by
15
7
  # the {Vedeu::Geometries::Geometry} it belongs to.
@@ -17,15 +9,12 @@ module Vedeu
17
9
  class Line
18
10
 
19
11
  include Vedeu::Repositories::Model
12
+ include Vedeu::Repositories::Parent
20
13
  include Vedeu::Presentation
21
14
 
22
15
  collection Vedeu::Views::Streams
23
16
  member Vedeu::Views::Stream
24
17
 
25
- # @!attribute [r] attributes
26
- # @return [Hash]
27
- attr_reader :attributes
28
-
29
18
  # @!attribute [rw] parent
30
19
  # @return [Vedeu::Views::View]
31
20
  attr_accessor :parent
@@ -35,14 +24,13 @@ module Vedeu
35
24
  # @param attributes [Hash]
36
25
  # @option attributes client [void]
37
26
  # @option attributes colour [Vedeu::Colours::Colour]
27
+ # @option attributes name [String|Symbol]
38
28
  # @option attributes parent [Vedeu::Views::View]
39
29
  # @option attributes style [Vedeu::Presentation::Style]
40
30
  # @option attributes value [Vedeu::Views::Streams]
41
31
  # @return [Vedeu::Views::Line]
42
32
  def initialize(attributes = {})
43
- @attributes = defaults.merge!(attributes)
44
-
45
- @attributes.each do |key, value|
33
+ defaults.merge!(attributes).each do |key, value|
46
34
  instance_variable_set("@#{key}", value)
47
35
  end
48
36
  end
@@ -54,6 +42,18 @@ module Vedeu
54
42
  end
55
43
  alias_method :<<, :add
56
44
 
45
+ # @return [Hash<Symbol => void>]
46
+ def attributes
47
+ {
48
+ client: @client,
49
+ colour: @colour,
50
+ name: name,
51
+ parent: parent,
52
+ style: @style,
53
+ value: value,
54
+ }
55
+ end
56
+
57
57
  # Returns an array of all the characters with formatting for
58
58
  # this line.
59
59
  #
@@ -86,11 +86,6 @@ module Vedeu
86
86
  end
87
87
  alias_method :==, :eql?
88
88
 
89
- # @return [NilClass|String|Symbol]
90
- def name
91
- parent.name if parent
92
- end
93
-
94
89
  # Returns the size of the content in characters without
95
90
  # formatting.
96
91
  #
@@ -109,11 +104,12 @@ module Vedeu
109
104
 
110
105
  # The default values for a new instance of this class.
111
106
  #
112
- # @return [Hash<Symbol => void>]
107
+ # @return [Hash<Symbol => Array<void>|NilClass>]
113
108
  def defaults
114
109
  {
115
110
  client: nil,
116
111
  colour: nil,
112
+ name: nil,
117
113
  parent: nil,
118
114
  style: nil,
119
115
  value: [],
@@ -0,0 +1,15 @@
1
+ module Vedeu
2
+
3
+ module Views
4
+
5
+ # A collection of {Vedeu::Views::Line} instances.
6
+ #
7
+ # @api private
8
+ #
9
+ class Lines < Vedeu::Repositories::Collection
10
+
11
+ end # Lines
12
+
13
+ end # Views
14
+
15
+ end # Vedeu
@@ -2,30 +2,20 @@ module Vedeu
2
2
 
3
3
  module Views
4
4
 
5
- # A collection of {Vedeu::Views::Stream} instances.
6
- #
7
- # @api private
8
- #
9
- class Streams < Vedeu::Repositories::Collection
10
-
11
- end # Streams
12
-
13
5
  # Represents a character or collection of characters as part of a
14
6
  # {Vedeu::Views::Line} which you wish to colour and style
15
7
  # independently of the other characters in that line.
16
8
  #
17
9
  class Stream
18
10
 
11
+ include Vedeu::Common
19
12
  include Vedeu::Repositories::Model
13
+ include Vedeu::Repositories::Parent
20
14
  include Vedeu::Presentation
21
15
 
22
16
  collection Vedeu::Views::Chars
23
17
  member Vedeu::Views::Char
24
18
 
25
- # @!attribute [r] attributes
26
- # @return [Hash]
27
- attr_reader :attributes
28
-
29
19
  # @!attribute [rw] parent
30
20
  # @return [Vedeu::Views::Line]
31
21
  attr_accessor :parent
@@ -46,9 +36,7 @@ module Vedeu
46
36
  # @option attributes value [String]
47
37
  # @return [Vedeu::Views::Stream]
48
38
  def initialize(attributes = {})
49
- @attributes = defaults.merge!(attributes)
50
-
51
- @attributes.each do |key, value|
39
+ defaults.merge!(attributes).each do |key, value|
52
40
  instance_variable_set("@#{key}", value)
53
41
  end
54
42
  end
@@ -60,6 +48,18 @@ module Vedeu
60
48
  end
61
49
  alias_method :<<, :add
62
50
 
51
+ # @return [Hash<Symbol => void>]
52
+ def attributes
53
+ {
54
+ client: @client,
55
+ colour: colour,
56
+ name: name,
57
+ parent: parent,
58
+ style: style,
59
+ value: value,
60
+ }
61
+ end
62
+
63
63
  # Returns an array of characters, each element is the escape
64
64
  # sequences of colours and styles for this stream, the character
65
65
  # itself, and the escape sequences of colours and styles for the
@@ -102,11 +102,6 @@ module Vedeu
102
102
  end
103
103
  alias_method :==, :eql?
104
104
 
105
- # @return [NilClass|String|Symbol]
106
- def name
107
- parent.name if parent
108
- end
109
-
110
105
  # Returns the size of the content in characters without
111
106
  # formatting.
112
107
  #
@@ -124,6 +119,7 @@ module Vedeu
124
119
  {
125
120
  client: nil,
126
121
  colour: nil,
122
+ name: nil,
127
123
  parent: nil,
128
124
  style: nil,
129
125
  value: '',
@@ -0,0 +1,15 @@
1
+ module Vedeu
2
+
3
+ module Views
4
+
5
+ # A collection of {Vedeu::Views::Stream} instances.
6
+ #
7
+ # @api private
8
+ #
9
+ class Streams < Vedeu::Repositories::Collection
10
+
11
+ end # Streams
12
+
13
+ end # Views
14
+
15
+ end # Vedeu
@@ -2,29 +2,18 @@ module Vedeu
2
2
 
3
3
  module Views
4
4
 
5
- # A collection of {Vedeu::Views::View} instances.
6
- #
7
- # @api private
8
- #
9
- class ViewCollection < Vedeu::Repositories::Collection
10
-
11
- end # ViewCollection
12
-
13
5
  # Represents a container for {Vedeu::Views::Line} and
14
6
  # {Vedeu::Views::Stream} objects.
15
7
  #
16
8
  class View
17
9
 
18
10
  include Vedeu::Repositories::Model
11
+ include Vedeu::Repositories::Parent
19
12
  include Vedeu::Presentation
20
13
 
21
14
  collection Vedeu::Views::Lines
22
15
  member Vedeu::Views::Line
23
16
 
24
- # @!attribute [r] attributes
25
- # @return [Hash]
26
- attr_reader :attributes
27
-
28
17
  # @!attribute [rw] client
29
18
  # @return [Fixnum|Float]
30
19
  attr_accessor :client
@@ -63,9 +52,7 @@ module Vedeu
63
52
  # @option attributes zindex [Fixnum]
64
53
  # @return [Vedeu::Views::View]
65
54
  def initialize(attributes = {})
66
- @attributes = defaults.merge!(attributes)
67
-
68
- @attributes.each do |key, value|
55
+ defaults.merge!(attributes).each do |key, value|
69
56
  instance_variable_set("@#{key}", value)
70
57
  end
71
58
  end
@@ -77,6 +64,20 @@ module Vedeu
77
64
  end
78
65
  alias_method :<<, :add
79
66
 
67
+ # @return [Hash]
68
+ def attributes
69
+ {
70
+ client: @client,
71
+ colour: colour,
72
+ cursor_visible: cursor_visible,
73
+ name: name,
74
+ parent: parent,
75
+ style: style,
76
+ value: value,
77
+ zindex: zindex,
78
+ }
79
+ end
80
+
80
81
  # Returns a DSL instance responsible for defining the DSL
81
82
  # methods of this model.
82
83
  #
@@ -118,7 +119,7 @@ module Vedeu
118
119
  'Cannot store an interface ' \
119
120
  'without a name.'.freeze unless present?(name)
120
121
 
121
- Vedeu.buffers.by_name(name).add(self)
122
+ buffer.add(self)
122
123
 
123
124
  self
124
125
  end
@@ -127,11 +128,16 @@ module Vedeu
127
128
  #
128
129
  # @return [Boolean]
129
130
  def visible?
130
- Vedeu.interfaces.by_name(name).visible?
131
+ interface.visible?
131
132
  end
132
133
 
133
134
  private
134
135
 
136
+ # @return [Vedeu::Buffers::Buffer]
137
+ def buffer
138
+ Vedeu.buffers.by_name(name)
139
+ end
140
+
135
141
  # The default values for a new instance of this class.
136
142
  #
137
143
  # @return [Hash]
@@ -148,6 +154,11 @@ module Vedeu
148
154
  }
149
155
  end
150
156
 
157
+ # @return [Vedeu::Interfaces::Interface]
158
+ def interface
159
+ Vedeu.interfaces.by_name(name)
160
+ end
161
+
151
162
  end # View
152
163
 
153
164
  end # Views
@@ -0,0 +1,15 @@
1
+ module Vedeu
2
+
3
+ module Views
4
+
5
+ # A collection of {Vedeu::Views::View} instances.
6
+ #
7
+ # @api private
8
+ #
9
+ class ViewCollection < Vedeu::Repositories::Collection
10
+
11
+ end # ViewCollection
12
+
13
+ end # Views
14
+
15
+ end # Vedeu
data/lib/vedeu.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # Ruby standard libraries
1
2
  require 'base64'
2
3
  require 'date'
3
4
  require 'drb'
@@ -13,6 +14,7 @@ require 'thread'
13
14
  require 'time'
14
15
  require 'zlib'
15
16
 
17
+ # Gem dependencies
16
18
  require 'thor'
17
19
 
18
20
  # Vedeu is a GUI framework for terminal/console applications written
@@ -0,0 +1,62 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Borders
6
+
7
+ describe SetAttribute do
8
+
9
+ let(:described) { Vedeu::Borders::SetAttribute }
10
+ let(:instance) { described.new(_name, attribute, _value) }
11
+ let(:_name) {}
12
+ let(:attribute) {}
13
+ let(:_value) {}
14
+ let(:border) {
15
+ Vedeu::Borders::Border.new(name: _name)
16
+ }
17
+
18
+ describe '#initialize' do
19
+ it { instance.must_be_instance_of(described) }
20
+ it { instance.instance_variable_get('@name').must_equal(_name) }
21
+ it { instance.instance_variable_get('@attribute').must_equal(attribute) }
22
+ it { instance.instance_variable_get('@value').must_equal(_value) }
23
+ end
24
+
25
+ describe '.update' do
26
+ let(:_name) { 'Vedeu::Borders::SetAttribute' }
27
+ let(:attribute) { :title }
28
+
29
+ subject { described.update(_name, attribute, _value) }
30
+
31
+ it { subject.must_be_instance_of(Vedeu::Borders::Border) }
32
+
33
+ context 'when a name is given' do
34
+ context 'when an attribute is given' do
35
+ context 'when a value is given' do
36
+ let(:_value) { 'Other value' }
37
+
38
+ it { subject.send(attribute).must_equal(_value) }
39
+ end
40
+
41
+ context 'when a value is not given' do
42
+ it { subject.send(attribute).must_equal('') }
43
+ end
44
+ end
45
+
46
+ context 'when an attribute is not given' do
47
+ let(:attribute) {}
48
+
49
+ it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
50
+ end
51
+ end
52
+ end
53
+
54
+ describe '#update' do
55
+ it { instance.must_respond_to(:update) }
56
+ end
57
+
58
+ end # SetAttribute
59
+
60
+ end # Borders
61
+
62
+ end # Vedeu
@@ -83,6 +83,12 @@ module Vedeu
83
83
  it { subject.must_equal(true) }
84
84
  end
85
85
 
86
+ context 'when the variable is a Symbol' do
87
+ let(:_value) { :some_value }
88
+
89
+ it { subject.must_equal(true) }
90
+ end
91
+
86
92
  context 'when the variable is not nil or empty' do
87
93
  let(:_value) { 'not empty' }
88
94
 
@@ -135,8 +135,6 @@ module Vedeu
135
135
  let(:ox) { 3 }
136
136
  let(:oy) { 2 }
137
137
 
138
- before { Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name) }
139
-
140
138
  subject { instance.move_down }
141
139
 
142
140
  it { subject.must_be_instance_of(described) }
@@ -153,8 +151,6 @@ module Vedeu
153
151
  let(:ox) { 3 }
154
152
  let(:oy) { 2 }
155
153
 
156
- before { Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name) }
157
-
158
154
  subject { instance.move_left }
159
155
 
160
156
  it { subject.must_be_instance_of(described) }
@@ -187,8 +183,6 @@ module Vedeu
187
183
  let(:ox) { 3 }
188
184
  let(:oy) { 2 }
189
185
 
190
- before { Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name) }
191
-
192
186
  subject { instance.move_right }
193
187
 
194
188
  it { subject.must_be_instance_of(described) }
@@ -205,8 +199,6 @@ module Vedeu
205
199
  let(:ox) { 3 }
206
200
  let(:oy) { 2 }
207
201
 
208
- before { Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name) }
209
-
210
202
  subject { instance.move_up }
211
203
 
212
204
  it { subject.must_be_instance_of(described) }
@@ -0,0 +1,73 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Cursors
6
+
7
+ describe Move do
8
+
9
+ let(:described) { Vedeu::Cursors::Move }
10
+ let(:instance) { described.new(_name, direction) }
11
+ let(:_name) {}
12
+ let(:direction) {}
13
+ let(:visible) { true }
14
+
15
+ describe '#initialize' do
16
+ it { instance.must_be_instance_of(described) }
17
+ it { instance.instance_variable_get('@name').must_equal(_name) }
18
+ it { instance.instance_variable_get('@direction').must_equal(direction) }
19
+ end
20
+
21
+ describe '.move' do
22
+ let(:cursor) {
23
+ Vedeu::Cursors::Cursor.new(name: _name, visible: visible)
24
+ }
25
+
26
+ before do
27
+ Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name)
28
+ end
29
+
30
+ subject { described.move(_name, direction) }
31
+
32
+ context 'when a name is given' do
33
+ let(:_name) { 'Vedeu::Cursors::Move' }
34
+
35
+ before do
36
+ Vedeu.cursors.stubs(:by_name).returns(cursor)
37
+ end
38
+
39
+ context 'when the cursor is visible' do
40
+ context 'when a valid direction is given' do
41
+ let(:direction) { :move_left }
42
+
43
+ it { subject.must_be_instance_of(Vedeu::Cursors::Cursor) }
44
+ end
45
+
46
+ context 'when an invalid direction is given' do
47
+ let(:direction) { :invalid }
48
+
49
+ it { subject.must_equal(nil) }
50
+ end
51
+ end
52
+
53
+ context 'when the cursor is not visible' do
54
+ let(:visible) { false }
55
+
56
+ it { subject.must_equal(nil) }
57
+ end
58
+ end
59
+
60
+ context 'when a name is not given' do
61
+ it { subject.must_equal(nil) }
62
+ end
63
+ end
64
+
65
+ describe '#move' do
66
+ it { instance.must_respond_to(:move) }
67
+ end
68
+
69
+ end # Move
70
+
71
+ end # Cursors
72
+
73
+ end # Vedeu
@@ -39,7 +39,9 @@ module Vedeu
39
39
  end
40
40
 
41
41
  context 'when there are no interfaces or views defined' do
42
- it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
42
+ it 'returns an unnamed cursor' do
43
+ subject.must_be_instance_of(Vedeu::Cursors::Cursor)
44
+ end
43
45
  end
44
46
  end
45
47
 
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module DSL
6
+
7
+ describe Lines do
8
+ end # Lines
9
+
10
+ end # DSL
11
+
12
+ end # Vedeu
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module DSL
6
+
7
+ describe Streams do
8
+
9
+ end # Streams
10
+
11
+ end # DSL
12
+
13
+ end # Vedeu
@@ -8,7 +8,7 @@ module Vedeu
8
8
 
9
9
  let(:described) { Vedeu::Events::Aliases }
10
10
 
11
- before { described.reset }
11
+ before { described.reset! }
12
12
 
13
13
  describe '.add' do
14
14
  let(:alias_name) { :alias_test }
@@ -88,10 +88,10 @@ module Vedeu
88
88
  end
89
89
  end
90
90
 
91
- describe '.reset' do
92
- subject { described.reset }
91
+ describe '.reset!' do
92
+ subject { described.reset! }
93
93
 
94
- it { described.must_respond_to(:reset!) }
94
+ it { described.must_respond_to(:reset) }
95
95
 
96
96
  it { subject.must_equal({}) }
97
97
  end
@@ -45,12 +45,6 @@ module Vedeu
45
45
 
46
46
  it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
47
47
  end
48
-
49
- context 'when no interfaces/views have been registered' do
50
- before { Vedeu::Models::Focus.reset }
51
-
52
- it { proc { subject }.must_raise(Vedeu::Error::Fatal) }
53
- end
54
48
  end
55
49
 
56
50
  context 'when the name is present' do
@@ -8,7 +8,7 @@ module Vedeu
8
8
 
9
9
  let(:described) { Vedeu::Input::Store }
10
10
 
11
- before { described.reset }
11
+ before { described.reset! }
12
12
 
13
13
  describe '#add_command' do
14
14
  let(:command) { 'command_1' }
@@ -99,7 +99,7 @@ module Vedeu
99
99
  end
100
100
 
101
101
  describe '#reset' do
102
- subject { described.reset }
102
+ subject { described.reset! }
103
103
 
104
104
  it { subject.must_equal({ commands: [], keypresses: [] }) }
105
105
  end
@@ -76,10 +76,15 @@ module Vedeu
76
76
  instance.must_respond_to(:visible)
77
77
  instance.must_respond_to(:visible=)
78
78
  instance.must_respond_to(:visible?)
79
- instance.must_respond_to(:attributes)
80
79
  }
81
80
  end
82
81
 
82
+ describe '#attributes' do
83
+ subject { instance.attributes }
84
+
85
+ it { subject.must_be_instance_of(Hash) }
86
+ end
87
+
83
88
  describe '#deputy' do
84
89
  subject { instance.deputy }
85
90