vedeu 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -0
  3. data/lib/vedeu/bindings/movement.rb +20 -74
  4. data/lib/vedeu/borders/borders.rb +1 -5
  5. data/lib/vedeu/buffers/buffers.rb +1 -5
  6. data/lib/vedeu/cursor/cursors.rb +2 -2
  7. data/lib/vedeu/dsl/interface.rb +1 -1
  8. data/lib/vedeu/events/events.rb +2 -2
  9. data/lib/vedeu/geometry/coordinate.rb +6 -18
  10. data/lib/vedeu/geometry/geometries.rb +1 -5
  11. data/lib/vedeu/input/keymaps.rb +1 -5
  12. data/lib/vedeu/log/log.rb +0 -1
  13. data/lib/vedeu/models/group.rb +14 -0
  14. data/lib/vedeu/models/groups.rb +1 -5
  15. data/lib/vedeu/models/interfaces.rb +1 -5
  16. data/lib/vedeu/models/menus.rb +1 -5
  17. data/lib/vedeu/models/views/char.rb +0 -4
  18. data/lib/vedeu/output/refresh_group.rb +8 -23
  19. data/lib/vedeu/plugins.rb +1 -1
  20. data/lib/vedeu/plugins/plugin.rb +1 -1
  21. data/lib/vedeu/version.rb +1 -1
  22. data/test/lib/vedeu/colours/colour_test.rb +5 -0
  23. data/test/lib/vedeu/colours/colour_translator_test.rb +5 -4
  24. data/test/lib/vedeu/colours/colours_test.rb +4 -0
  25. data/test/lib/vedeu/distributed/test_application_test.rb +19 -0
  26. data/test/lib/vedeu/dsl/interface_test.rb +10 -18
  27. data/test/lib/vedeu/input/keymap_test.rb +4 -0
  28. data/test/lib/vedeu/log/debug_test.rb +21 -2
  29. data/test/lib/vedeu/models/escape_test.rb +4 -0
  30. data/test/lib/vedeu/models/group_test.rb +9 -0
  31. data/test/lib/vedeu/models/views/view_test.rb +13 -0
  32. data/test/lib/vedeu/null/border_test.rb +4 -0
  33. data/test/lib/vedeu/null/buffer_test.rb +4 -0
  34. data/test/lib/vedeu/null/geometry_test.rb +1 -7
  35. data/test/lib/vedeu/plugins/plugin_test.rb +10 -1
  36. data/test/lib/vedeu/repositories/repository_test.rb +5 -0
  37. data/test/lib/vedeu/runtime/launcher_test.rb +4 -0
  38. data/test/test_helper.rb +33 -28
  39. metadata +2 -3
  40. data/examples/colours_app.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adbde558d3cfb0668d3d05c5e21effc821b92ab4
4
- data.tar.gz: 1bef10fb655bcbc83cee7796ba12269a114321f9
3
+ metadata.gz: c62441c6579d781c59c825d69511b5d3705f6014
4
+ data.tar.gz: b944ba4c7e976e70968d18b2bf758887b83b3516
5
5
  SHA512:
6
- metadata.gz: 24481b866de7f7aa5042a7575aa0e67bf99dd7230bb1085c22c2334a796309bd5a94095539e54b26d7e1c8bcb9450891d015b4eac65597b630038e619dad54a0
7
- data.tar.gz: a8423cfe4e0c26e88e5a3ef60d0ed4f8b5dde4725b4a89492285dad0b1c3dfe0096d9f1a736f9ac7f81491b01d1f7b734cad345a747154e5017a9be4ca8ee56e
6
+ metadata.gz: abb5508cfafc005658e04093bf5b0c4ba39e44cbdcc5830658d05b6b58804e259b95d57d236981a851b95db6bf3771852788e0690ab9740b29cae3254db12feb
7
+ data.tar.gz: 86f47fa933d1ac72ab151aa968b8a7c2ef830e007fda1d4d5631e66a128ed054a11cf989cf852674968f0b79436f76a7f2f38f83a9891f1913a7969e4f51e7c6
data/Rakefile CHANGED
@@ -16,7 +16,10 @@ YARD::Rake::YardocTask.new(:yard) do |t|
16
16
  'lib/**/*.rb',
17
17
  '-',
18
18
  'docs/api.md',
19
+ 'docs/dsl.md',
20
+ 'docs/events.md',
19
21
  'docs/getting_started.md',
22
+ 'docs/object_graph.md',
20
23
  ]
21
24
  end
22
25
 
@@ -16,54 +16,42 @@ module Vedeu
16
16
  cursor_origin!
17
17
  cursor_position!
18
18
  cursor_reposition!
19
- down!
20
- left!
21
- right!
22
- up!
19
+ directional!
23
20
  end
24
21
 
25
22
  private
26
23
 
27
- # Move the cursor/view down by one character.
24
+ # Move the cursor/view down, left, right or up by one character.
28
25
  #
29
26
  # @example
30
27
  # Vedeu.trigger(:_cursor_down_, name)
31
28
  # Vedeu.trigger(:_view_down_, name)
32
29
  # Vedeu.trigger(:_geometry_down_, name)
33
- #
34
- # @return [TrueClass]
35
- # @see Vedeu::Move
36
- def down!
37
- Vedeu.bind(:_cursor_down_) do |name|
38
- Vedeu::Move.down(Vedeu::Cursor, name)
39
- end
40
-
41
- Vedeu.bind(:_view_down_) do |name|
42
- Vedeu::Move.down(Vedeu::Geometry, name)
43
- end
44
-
45
- Vedeu.bind_alias(:_geometry_down_, :_view_down_)
46
- end
47
-
48
- # Move the cursor/view left by one character.
49
- #
50
- # @example
51
30
  # Vedeu.trigger(:_cursor_left_, name)
52
31
  # Vedeu.trigger(:_view_left_, name)
53
32
  # Vedeu.trigger(:_geometry_left_, name)
33
+ # Vedeu.trigger(:_cursor_right_, name)
34
+ # Vedeu.trigger(:_view_right_, name)
35
+ # Vedeu.trigger(:_geometry_right_, name)
36
+ # Vedeu.trigger(:_cursor_up_, name)
37
+ # Vedeu.trigger(:_view_up_, name)
38
+ # Vedeu.trigger(:_geometry_up_, name)
54
39
  #
55
40
  # @return [TrueClass]
56
41
  # @see Vedeu::Move
57
- def left!
58
- Vedeu.bind(:_cursor_left_) do |name|
59
- Vedeu::Move.left(Vedeu::Cursor, name)
60
- end
61
-
62
- Vedeu.bind(:_view_left_) do |name|
63
- Vedeu::Move.left(Vedeu::Geometry, name)
42
+ def directional!
43
+ [:down, :left, :right, :up].each do |direction|
44
+ Vedeu.bind("_cursor_#{direction}_".to_sym) do |name|
45
+ Vedeu::Move.send(direction, Vedeu::Cursor, name)
46
+ end
47
+
48
+ Vedeu.bind("_view_#{direction}_".to_sym) do |name|
49
+ Vedeu::Move.send(direction, Vedeu::Geometry, name)
50
+ end
51
+
52
+ Vedeu.bind_alias("_geometry_#{direction}_".to_sym,
53
+ "_view_#{direction}_".to_sym)
64
54
  end
65
-
66
- Vedeu.bind_alias(:_geometry_left_, :_view_left_)
67
55
  end
68
56
 
69
57
  # This event moves the cursor to the interface origin; the top left corner
@@ -111,48 +99,6 @@ module Vedeu
111
99
  end
112
100
  end
113
101
 
114
- # Move the cursor/view right by one character.
115
- #
116
- # @example
117
- # Vedeu.trigger(:_cursor_right_, name)
118
- # Vedeu.trigger(:_view_right_, name)
119
- # Vedeu.trigger(:_geometry_right_, name)
120
- #
121
- # @return [TrueClass]
122
- # @see Vedeu::Move
123
- def right!
124
- Vedeu.bind(:_cursor_right_) do |name|
125
- Vedeu::Move.right(Vedeu::Cursor, name)
126
- end
127
-
128
- Vedeu.bind(:_view_right_) do |name|
129
- Vedeu::Move.right(Vedeu::Geometry, name)
130
- end
131
-
132
- Vedeu.bind_alias(:_geometry_right_, :_view_right_)
133
- end
134
-
135
- # Move the cursor/view up by one character.
136
- #
137
- # @example
138
- # Vedeu.trigger(:_cursor_up, name)
139
- # Vedeu.trigger(:_view_up_, name)
140
- # Vedeu.trigger(:_geometry_up_, name)
141
- #
142
- # @return [TrueClass]
143
- # @see Vedeu::Move
144
- def up!
145
- Vedeu.bind(:_cursor_up_) do |name|
146
- Vedeu::Move.up(Vedeu::Cursor, name)
147
- end
148
-
149
- Vedeu.bind(:_view_up_) do |name|
150
- Vedeu::Move.up(Vedeu::Geometry, name)
151
- end
152
-
153
- Vedeu.bind_alias(:_geometry_up_, :_view_up_)
154
- end
155
-
156
102
  end # Movement
157
103
  # :nocov:
158
104
 
@@ -5,11 +5,7 @@ module Vedeu
5
5
  #
6
6
  class Borders < Vedeu::Repository
7
7
 
8
- class << self
9
-
10
- alias_method :borders, :repository
11
-
12
- end # Eigenclass
8
+ singleton_class.send(:alias_method, :borders, :repository)
13
9
 
14
10
  null Vedeu::Null::Border
15
11
  real Vedeu::Border
@@ -4,11 +4,7 @@ module Vedeu
4
4
  #
5
5
  class Buffers < Vedeu::Repository
6
6
 
7
- class << self
8
-
9
- alias_method :buffers, :repository
10
-
11
- end # Eigenclass
7
+ singleton_class.send(:alias_method, :buffers, :repository)
12
8
 
13
9
  null Vedeu::Null::Buffer
14
10
  real Vedeu::Buffer
@@ -4,9 +4,9 @@ module Vedeu
4
4
  #
5
5
  class Cursors < Vedeu::Repository
6
6
 
7
- class << self
7
+ singleton_class.send(:alias_method, :cursors, :repository)
8
8
 
9
- alias_method :cursors, :repository
9
+ class << self
10
10
 
11
11
  # @return [Vedeu::Cursor]
12
12
  # @see Vedeu::API.cursor
@@ -162,7 +162,7 @@ module Vedeu
162
162
  # When the above is specified (outside of a `Vedeu.interface`
163
163
  # declaration), the named interface will be focussed instead.
164
164
  #
165
- # @return [String] The name of the interface in focus.
165
+ # @return [Array<String>] A list of focusable interfaces.
166
166
  def focus!
167
167
  Vedeu::Focus.add(model.name, true) if present?(model.name)
168
168
  end
@@ -4,9 +4,9 @@ module Vedeu
4
4
  #
5
5
  class Events < Vedeu::Repository
6
6
 
7
- class << self
7
+ singleton_class.send(:alias_method, :events, :repository)
8
8
 
9
- alias_method :events, :repository
9
+ class << self
10
10
 
11
11
  # Remove all stored models from the repository.
12
12
  #
@@ -82,7 +82,9 @@ module Vedeu
82
82
  y_range[oy]
83
83
  end
84
84
 
85
- validate_y(pos)
85
+ pos = pos < by ? by : pos
86
+ pos = pos > byn ? byn : pos
87
+ pos
86
88
  end
87
89
 
88
90
  # Returns the x coordinate for a given index.
@@ -103,7 +105,9 @@ module Vedeu
103
105
  x_range[ox]
104
106
  end
105
107
 
106
- validate_x(pos)
108
+ pos = pos < bx ? bx : pos
109
+ pos = pos > bxn ? bxn : pos
110
+ pos
107
111
  end
108
112
 
109
113
  protected
@@ -127,22 +131,6 @@ module Vedeu
127
131
  @border ||= Vedeu.borders.by_name(name)
128
132
  end
129
133
 
130
- # @param value [Fixnum]
131
- # @return [Fixnum]
132
- def validate_x(value)
133
- value = value < bx ? bx : value
134
- value = value > bxn ? bxn : value
135
- value
136
- end
137
-
138
- # @param value [Fixnum]
139
- # @return [Fixnum]
140
- def validate_y(value)
141
- value = value < by ? by : value
142
- value = value > byn ? byn : value
143
- value
144
- end
145
-
146
134
  # Returns the maximum y index for an area.
147
135
  #
148
136
  # @example
@@ -5,11 +5,7 @@ module Vedeu
5
5
  #
6
6
  class Geometries < Vedeu::Repository
7
7
 
8
- class << self
9
-
10
- alias_method :geometries, :repository
11
-
12
- end # Eigenclass
8
+ singleton_class.send(:alias_method, :geometries, :repository)
13
9
 
14
10
  null Vedeu::Null::Geometry
15
11
  real Vedeu::Geometry
@@ -4,11 +4,7 @@ module Vedeu
4
4
  #
5
5
  class Keymaps < Vedeu::Repository
6
6
 
7
- class << self
8
-
9
- alias_method :keymaps, :repository
10
-
11
- end # Eigenclass
7
+ singleton_class.send(:alias_method, :keymaps, :repository)
12
8
 
13
9
  real Vedeu::Keymap
14
10
 
data/lib/vedeu/log/log.rb CHANGED
@@ -13,7 +13,6 @@ module Vedeu
13
13
  @level = DEBUG
14
14
  @default_formatter = Formatter.new
15
15
  @formatter = nil
16
- @logdev = nil
17
16
  @logdev = LocklessLogDevice.new(logdev) if logdev
18
17
  end
19
18
 
@@ -54,6 +54,13 @@ module Vedeu
54
54
  }
55
55
  end
56
56
 
57
+ # Return the members of the group sorted by the zindex of the members.
58
+ #
59
+ # @return [Array<String>]
60
+ def by_zindex
61
+ interfaces.sort { |a, b| a.zindex <=> b.zindex }.map(&:name)
62
+ end
63
+
57
64
  # Hide the named group of interfaces, or without a name, the group of the
58
65
  # currently focussed interface. Useful for hiding part of that which is
59
66
  # currently displaying in the terminal.
@@ -131,6 +138,13 @@ module Vedeu
131
138
  }
132
139
  end
133
140
 
141
+ # Return the interfaces for all members of the group.
142
+ #
143
+ # @return [Array<Vedeu::Interface]
144
+ def interfaces
145
+ members.map { |name| Vedeu.interfaces.by_name(name) }
146
+ end
147
+
134
148
  end # Group
135
149
 
136
150
  end # Vedeu
@@ -4,11 +4,7 @@ module Vedeu
4
4
  #
5
5
  class Groups < Vedeu::Repository
6
6
 
7
- class << self
8
-
9
- alias_method :groups, :repository
10
-
11
- end # Eigenclass
7
+ singleton_class.send(:alias_method, :groups, :repository)
12
8
 
13
9
  null Vedeu::Group
14
10
  real Vedeu::Group
@@ -4,11 +4,7 @@ module Vedeu
4
4
  #
5
5
  class Interfaces < Vedeu::Repository
6
6
 
7
- class << self
8
-
9
- alias_method :interfaces, :repository
10
-
11
- end # Eigenclass
7
+ singleton_class.send(:alias_method, :interfaces, :repository)
12
8
 
13
9
  null Vedeu::Null::Interface
14
10
  real Vedeu::Interface
@@ -4,11 +4,7 @@ module Vedeu
4
4
  #
5
5
  class Menus < Vedeu::Repository
6
6
 
7
- class << self
8
-
9
- alias_method :menus, :repository
10
-
11
- end # Eigenclass
7
+ singleton_class.send(:alias_method, :menus, :repository)
12
8
 
13
9
  real Vedeu::Menu
14
10
  null Vedeu::Null::Menu
@@ -25,10 +25,6 @@ module Vedeu
25
25
  # @return [Vedeu::Views::Line]
26
26
  attr_accessor :parent
27
27
 
28
- # @!attribute [r] position
29
- # @return [Vedeu::Position]
30
- attr_reader :position
31
-
32
28
  # @!attribute [w] value
33
29
  # @return [String]
34
30
  attr_writer :value
@@ -20,7 +20,14 @@ module Vedeu
20
20
 
21
21
  # @return [void]
22
22
  def by_name
23
- zindexed.each { |name| Vedeu::Refresh.by_name(name) }
23
+ unless present?(name)
24
+ fail Vedeu::MissingRequired,
25
+ 'Cannot refresh group with an empty group name.'
26
+ end
27
+
28
+ Vedeu.groups.by_name(name).by_zindex.each do |name|
29
+ Vedeu::Refresh.by_name(name)
30
+ end
24
31
  end
25
32
 
26
33
  protected
@@ -29,28 +36,6 @@ module Vedeu
29
36
  # @return [String]
30
37
  attr_reader :name
31
38
 
32
- private
33
-
34
- # @return [Array<String>]
35
- def zindexed
36
- interfaces.sort_by(&:zindex).map(&:name)
37
- end
38
-
39
- # @return [Array<Vedeu::Interface>]
40
- def interfaces
41
- members.map { |name| Vedeu.interfaces.by_name(name) }
42
- end
43
-
44
- # @return [Set]
45
- def members
46
- unless present?(name)
47
- fail Vedeu::MissingRequired,
48
- 'Cannot refresh group with an empty group name.'
49
- end
50
-
51
- Vedeu.groups.by_name(name).members
52
- end
53
-
54
39
  end # RefreshGroup
55
40
 
56
41
  end # Vedeu
data/lib/vedeu/plugins.rb CHANGED
@@ -36,7 +36,7 @@ module Vedeu
36
36
  Gem::Specification.each do |gem|
37
37
  next unless gem.name =~ /^#{prefix}/
38
38
 
39
- plugin_name = gem.name[/^#{prefix}-(.*)/, 1]
39
+ plugin_name = gem.name[/^#{prefix}_(.*)/, 1]
40
40
 
41
41
  register(plugin_name, Vedeu::Plugin.new(plugin_name, gem))
42
42
  end
@@ -29,7 +29,7 @@ module Vedeu
29
29
  def initialize(name, gem)
30
30
  @name = name
31
31
  @gem = gem
32
- @gem_name = "vedeu-#{name}"
32
+ @gem_name = "vedeu_#{name}"
33
33
  @enabled = false
34
34
  end
35
35
 
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.5.7'
4
+ VERSION = '0.5.8'
5
5
 
6
6
  end
@@ -27,6 +27,11 @@ module Vedeu
27
27
  }
28
28
  end
29
29
 
30
+ describe 'accessors' do
31
+ it { instance.must_respond_to(:background) }
32
+ it { instance.must_respond_to(:foreground) }
33
+ end
34
+
30
35
  describe '.coerce' do
31
36
  let(:attributes) {
32
37
  {
@@ -8,15 +8,16 @@ module Vedeu
8
8
  let(:instance) { described.new(colour) }
9
9
  let(:colour) { '#ff0000' }
10
10
 
11
- describe 'alias methods' do
12
- it { instance.must_respond_to(:value) }
13
- end
14
-
15
11
  describe '#initialize' do
16
12
  it { instance.must_be_instance_of(described) }
17
13
  it { instance.instance_variable_get('@colour').must_equal(colour) }
18
14
  end
19
15
 
16
+ describe 'accessors' do
17
+ it { instance.must_respond_to(:colour) }
18
+ it { instance.must_respond_to(:value) }
19
+ end
20
+
20
21
  describe '.coerce' do
21
22
  let(:_value) {}
22
23
 
@@ -12,6 +12,10 @@ module Vedeu
12
12
  it { instance.instance_variable_get('@storage').must_equal({}) }
13
13
  end
14
14
 
15
+ describe 'accessors' do
16
+ it { instance.must_respond_to(:storage) }
17
+ end
18
+
15
19
  describe '#register' do
16
20
  let(:colour) { 'ff0000' }
17
21
  let(:escape_sequence) { 'fake_escape_sequence' }
@@ -12,6 +12,25 @@ module Vedeu
12
12
  it { instance.must_be_instance_of(described) }
13
13
  end
14
14
 
15
+ describe 'accessors' do
16
+ it { instance.must_respond_to(:borders) }
17
+ it { instance.must_respond_to(:borders=) }
18
+ it { instance.must_respond_to(:configuration) }
19
+ it { instance.must_respond_to(:configuration=) }
20
+ it { instance.must_respond_to(:events) }
21
+ it { instance.must_respond_to(:events=) }
22
+ it { instance.must_respond_to(:geometries) }
23
+ it { instance.must_respond_to(:geometries=) }
24
+ it { instance.must_respond_to(:interfaces) }
25
+ it { instance.must_respond_to(:interfaces=) }
26
+ it { instance.must_respond_to(:keymaps) }
27
+ it { instance.must_respond_to(:keymaps=) }
28
+ it { instance.must_respond_to(:menus) }
29
+ it { instance.must_respond_to(:menus=) }
30
+ it { instance.must_respond_to(:views) }
31
+ it { instance.must_respond_to(:views=) }
32
+ end
33
+
15
34
  describe '.build' do
16
35
  subject { described.build(attributes) { } }
17
36
 
@@ -9,8 +9,9 @@ module Vedeu
9
9
  let(:described) { Vedeu::DSL::Interface }
10
10
  let(:instance) { described.new(model, client) }
11
11
  let(:model) {
12
- Vedeu::Interface.new(name: 'actinium')
12
+ Vedeu::Interface.new(name: _name)
13
13
  }
14
+ let(:_name) { 'actinium' }
14
15
  let(:client) {}
15
16
 
16
17
  describe '#initialize' do
@@ -159,27 +160,18 @@ module Vedeu
159
160
  end
160
161
 
161
162
  describe '#focus!' do
162
- context 'when a single call is made' do
163
- before do
164
- Vedeu::Focus.reset
165
- Vedeu.interface('curium') { focus! }
166
- end
163
+ subject { instance.focus! }
167
164
 
168
- it 'sets the interface as current' do
169
- Vedeu.focus.must_equal('curium')
170
- end
165
+ context 'when the interface does not yet have a name' do
166
+ let(:_name) {}
167
+
168
+ it { subject.must_equal(nil) }
171
169
  end
172
170
 
173
- context 'when no calls are made' do
174
- before do
175
- Vedeu::Focus.reset
176
- Vedeu.interface('curium') {}
177
- Vedeu.interface('dysprosium') {}
178
- end
171
+ context 'when the interface has a name' do
172
+ before { Vedeu::Focus.reset }
179
173
 
180
- it 'the first interface defined will be current' do
181
- Vedeu.focus.must_equal('curium')
182
- end
174
+ it { subject.must_equal(['actinium']) }
183
175
  end
184
176
  end
185
177
 
@@ -25,6 +25,10 @@ module Vedeu
25
25
  end
26
26
  end
27
27
 
28
+ describe 'accessors' do
29
+ it { instance.must_respond_to(:name) }
30
+ end
31
+
28
32
  describe '#add' do
29
33
  subject { instance.add(key) }
30
34
 
@@ -6,9 +6,28 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Debug }
8
8
 
9
+ before do
10
+ File.stubs(:open).with('/tmp/profile.html', 'w').returns(:some_code)
11
+ end
12
+
9
13
  describe '.debug' do
10
- # @todo
11
- # it { skip }
14
+ let(:filename) { 'profile.html' }
15
+ let(:some_code) { :some_code }
16
+
17
+ context 'when the block is not given' do
18
+ subject { described.debug(filename) }
19
+
20
+ it { subject.must_equal(nil) }
21
+ end
22
+
23
+ context 'when the block is given' do
24
+ subject { described.debug(filename) { some_code } }
25
+
26
+ it {
27
+ ::File.expects(:open).with('/tmp/profile.html', 'w')
28
+ subject
29
+ }
30
+ end
12
31
  end
13
32
 
14
33
  end # Debug
@@ -20,6 +20,10 @@ module Vedeu
20
20
  it { instance.instance_variable_get('@value').must_equal(_value) }
21
21
  end
22
22
 
23
+ describe 'accessors' do
24
+ it { instance.must_respond_to(:value) }
25
+ end
26
+
23
27
  describe '#colour' do
24
28
  it { instance.colour.must_equal('') }
25
29
  end
@@ -58,6 +58,15 @@ module Vedeu
58
58
  end
59
59
  end
60
60
 
61
+ describe '#by_zindex' do
62
+ subject { instance.by_zindex }
63
+
64
+ it { subject.must_be_instance_of(Array) }
65
+
66
+ # @todo Add more tests.
67
+ # it { skip }
68
+ end
69
+
61
70
  describe '#hide' do
62
71
  subject { instance.hide }
63
72
 
@@ -15,6 +15,19 @@ module Vedeu
15
15
  }
16
16
  let(:_name) { 'Vedeu::Views::View' }
17
17
 
18
+ describe 'accessors' do
19
+ it { instance.must_respond_to(:attributes) }
20
+ it { instance.must_respond_to(:client) }
21
+ it { instance.must_respond_to(:client=) }
22
+ it { instance.must_respond_to(:name) }
23
+ it { instance.must_respond_to(:name=) }
24
+ it { instance.must_respond_to(:parent) }
25
+ it { instance.must_respond_to(:parent=) }
26
+ it { instance.must_respond_to(:lines=) }
27
+ it { instance.must_respond_to(:zindex) }
28
+ it { instance.must_respond_to(:zindex=) }
29
+ end
30
+
18
31
  describe '#store_immediate' do
19
32
  subject { instance.store_immediate }
20
33
 
@@ -28,6 +28,10 @@ module Vedeu
28
28
  it { instance.instance_variable_get('@name').must_equal(_name) }
29
29
  end
30
30
 
31
+ describe 'accessors' do
32
+ it { instance.must_respond_to(:name) }
33
+ end
34
+
31
35
  describe '#bx' do
32
36
  subject { instance.bx }
33
37
 
@@ -23,6 +23,10 @@ module Vedeu
23
23
  it { instance.instance_variable_get('@name').must_equal(_name) }
24
24
  end
25
25
 
26
+ describe 'accessors' do
27
+ it { instance.must_respond_to(:name) }
28
+ end
29
+
26
30
  describe '#null' do
27
31
  subject { instance.null }
28
32
 
@@ -25,15 +25,9 @@ module Vedeu
25
25
  it { instance.instance_variable_get('@name').must_equal(_name) }
26
26
  end
27
27
 
28
- describe '#maximised' do
28
+ describe 'accessors' do
29
29
  it { instance.must_respond_to(:maximised) }
30
- end
31
-
32
- describe '#maximised=' do
33
30
  it { instance.must_respond_to(:maximised=) }
34
- end
35
-
36
- describe '#name' do
37
31
  it { instance.must_respond_to(:name) }
38
32
  end
39
33
 
@@ -15,11 +15,20 @@ module Vedeu
15
15
  it { instance.instance_variable_get('@gem').must_equal(_gem) }
16
16
  it {
17
17
  instance.instance_variable_get('@gem_name').
18
- must_equal("vedeu-#{_name}")
18
+ must_equal("vedeu_#{_name}")
19
19
  }
20
20
  it { instance.instance_variable_get('@enabled').must_equal(false) }
21
21
  end
22
22
 
23
+ describe 'accessors' do
24
+ it { instance.must_respond_to(:name) }
25
+ it { instance.must_respond_to(:gem) }
26
+ it { instance.must_respond_to(:gem_name) }
27
+ it { instance.must_respond_to(:enabled) }
28
+ it { instance.must_respond_to(:enabled=) }
29
+ it { instance.must_respond_to(:enabled?) }
30
+ end
31
+
23
32
  describe '#load!' do
24
33
  subject { instance.load! }
25
34
 
@@ -52,6 +52,11 @@ module Vedeu
52
52
  it { instance.instance_variable_get('@storage').must_equal(storage) }
53
53
  end
54
54
 
55
+ describe 'accessors' do
56
+ it { instance.must_respond_to(:model) }
57
+ it { instance.must_respond_to(:storage) }
58
+ end
59
+
55
60
  describe '#all' do
56
61
  subject { instance.all }
57
62
 
@@ -17,6 +17,10 @@ module Vedeu
17
17
  it { instance.instance_variable_get('@exit_code').must_equal(1) }
18
18
  end
19
19
 
20
+ describe 'accessors' do
21
+ it { instance.must_respond_to(:exit_code) }
22
+ end
23
+
20
24
  describe '#debug_execute!' do
21
25
  subject { instance.debug_execute! }
22
26
 
data/test/test_helper.rb CHANGED
@@ -1,5 +1,8 @@
1
- require 'simplecov'
2
- require 'simplecov-console' if ENV['CONSOLE_COVERAGE']
1
+ unless ENV['NO_SIMPLECOV']
2
+ require 'simplecov'
3
+ require 'simplecov-console' if ENV['CONSOLE_COVERAGE']
4
+ end
5
+
3
6
  require 'pry'
4
7
  require 'minitest/autorun'
5
8
  require 'minitest/pride' unless ENV['NO_COLOR']
@@ -8,32 +11,34 @@ require 'minitest/hell'
8
11
  # GC.disable # Uncomment to remove ~20ms from test run speed; left uncommented
9
12
  # though makes tests slower over time with 'guard'.
10
13
 
11
- SimpleCov.start do
12
- formatter SimpleCov::Formatter::Console if ENV['CONSOLE_COVERAGE']
13
- command_name 'MiniTest::Spec'
14
- add_filter '/test/'
15
- add_group 'application', 'vedeu/application'
16
- add_group 'bindings', 'vedeu/bindings'
17
- add_group 'borders', 'vedeu/borders'
18
- add_group 'buffers', 'vedeu/buffers'
19
- add_group 'cli', 'vedeu/cli'
20
- add_group 'colours', 'vedeu/colours'
21
- add_group 'configuration', 'vedeu/configuration'
22
- add_group 'cursor', 'vedeu/cursor'
23
- add_group 'distributed', 'vedeu/distributed'
24
- add_group 'dsl', 'vedeu/dsl'
25
- add_group 'events', 'vedeu/events'
26
- add_group 'geometry', 'vedeu/geometry'
27
- add_group 'input', 'vedeu/input'
28
- add_group 'log', 'vedeu/log'
29
- add_group 'models', 'vedeu/models'
30
- add_group 'null', 'vedeu/null'
31
- add_group 'output', 'vedeu/output'
32
- add_group 'plugins', 'vedeu/plygins'
33
- add_group 'repositories', 'vedeu/repositories'
34
- add_group 'runtime', 'vedeu/runtime'
35
- add_group 'templating', 'vedeu/templating'
36
- end unless ENV['NO_SIMPLECOV']
14
+ unless ENV['NO_SIMPLECOV']
15
+ SimpleCov.start do
16
+ formatter SimpleCov::Formatter::Console if ENV['CONSOLE_COVERAGE']
17
+ command_name 'MiniTest::Spec'
18
+ add_filter '/test/'
19
+ add_group 'application', 'vedeu/application'
20
+ add_group 'bindings', 'vedeu/bindings'
21
+ add_group 'borders', 'vedeu/borders'
22
+ add_group 'buffers', 'vedeu/buffers'
23
+ add_group 'cli', 'vedeu/cli'
24
+ add_group 'colours', 'vedeu/colours'
25
+ add_group 'configuration', 'vedeu/configuration'
26
+ add_group 'cursor', 'vedeu/cursor'
27
+ add_group 'distributed', 'vedeu/distributed'
28
+ add_group 'dsl', 'vedeu/dsl'
29
+ add_group 'events', 'vedeu/events'
30
+ add_group 'geometry', 'vedeu/geometry'
31
+ add_group 'input', 'vedeu/input'
32
+ add_group 'log', 'vedeu/log'
33
+ add_group 'models', 'vedeu/models'
34
+ add_group 'null', 'vedeu/null'
35
+ add_group 'output', 'vedeu/output'
36
+ add_group 'plugins', 'vedeu/plygins'
37
+ add_group 'repositories', 'vedeu/repositories'
38
+ add_group 'runtime', 'vedeu/runtime'
39
+ add_group 'templating', 'vedeu/templating'
40
+ end
41
+ end
37
42
 
38
43
  module VedeuMiniTestPlugin
39
44
  # def before_setup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-06 00:00:00.000000000 Z
11
+ date: 2015-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -241,7 +241,6 @@ files:
241
241
  - docs/object_graph.md
242
242
  - examples/borders_app.rb
243
243
  - examples/colour_support.sh
244
- - examples/colours_app.rb
245
244
  - examples/configuration_app.rb
246
245
  - examples/drb_app.rb
247
246
  - examples/focus_app.rb
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- lib_dir = File.dirname(__FILE__) + '/../lib'
4
- $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
5
-
6
- require 'vedeu'
7
-
8
- # An example application to demonstrate colours.
9
- #
10
- # If you have cloned this repository from GitHub, you can run this example:
11
- #
12
- # ./examples/colours_app.rb
13
- #
14
- class VedeuColoursApp
15
-
16
- Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
17
-
18
- # Be aware that running an application with debugging enabled will affect
19
- # performance.
20
- Vedeu.configure do
21
- # debug!
22
- log '/tmp/vedeu_colours_app.log'
23
- end
24
-
25
- Vedeu.interface 'colours_256' do
26
- geometry do
27
- centred!
28
- height 16
29
- width 80
30
- end
31
- end
32
-
33
- Vedeu.renders do
34
- view('colours_256') do
35
- lines do
36
- 0.upto(16) do |row|
37
- line do
38
- 0.upto(15) do |column|
39
- code = (row * 15) + column
40
- right "#{code}", width: 5, background: code, foreground: '#ffffff'
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
-
48
- end # VedeuColoursApp