vedeu 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 059ea4a8cd87f17bcbb219ef8301a54ff5eb10a4
4
- data.tar.gz: 9b88929ff9edc741c3fcc3f10545c2d7c1cfe724
3
+ metadata.gz: 52f99e59a2bd4ab818933894f1954ab87447ca02
4
+ data.tar.gz: 137357a572a617e95530c6300beb880ec541f517
5
5
  SHA512:
6
- metadata.gz: 7c54668ab83878f567eddf5585cd8d09f9da674b864b72bcbeae3d3e55b7bd4cc7e5378615f72056b9419507efe127d6967a1f6febccadc2d9f41d66cb843be4
7
- data.tar.gz: 26d4bdfb02800408c9621666e93f7558457b9c538cc764d2a14ced69ae3eb62073144a1d6e345ab6228f5a666c8d16d5ca00e9db312e327fb581df95e8bfe060
6
+ metadata.gz: 1d9db9d21a9bc04bda9b3039cef7aca59be615c0ac1ed1b0064855420e84a80cf58b978e533e8bb03319165a947a714129384751bef5f3729edcb11d6656d9be
7
+ data.tar.gz: 5e7aaaf8b00d308237e4a46886ef7b61bd1eac408cf091df3f65fbb605d8c2f2687cbd932aa514d1b8a87314ad978dec6fe890a0737d882f60d83cc427d488f0
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.1
3
+ - 2.2.2
4
4
  cache: bundler
5
5
  script: 'bundle exec rake'
6
6
  sudo: false
@@ -31,10 +31,7 @@ module Vedeu
31
31
  Vedeu::Router.goto(controller, action, **args)
32
32
  end
33
33
 
34
- # @todo Remove this aliasing event. (GL 2015-07-26)
35
- Vedeu.bind(:_action_) do |controller, action, **args|
36
- Vedeu.trigger(:_goto_, controller, action, **args)
37
- end
34
+ Vedeu.bind_alias(:_action_, :_goto_)
38
35
  end
39
36
 
40
37
  end # Application
@@ -13,45 +13,57 @@ module Vedeu
13
13
  #
14
14
  # @return [TrueClass]
15
15
  def setup!
16
- cursor_down!
17
- cursor_left!
18
16
  cursor_origin!
19
17
  cursor_position!
20
18
  cursor_reposition!
21
- cursor_right!
22
- cursor_up!
23
- geometry_down!
24
- geometry_left!
25
- geometry_right!
26
- geometry_up!
19
+ down!
20
+ left!
21
+ right!
22
+ up!
27
23
  end
28
24
 
29
25
  private
30
26
 
31
- # Move the cursor down by one character.
27
+ # Move the cursor/view down by one character.
32
28
  #
33
29
  # @example
34
30
  # Vedeu.trigger(:_cursor_down_, name)
31
+ # Vedeu.trigger(:_view_down_, name)
32
+ # Vedeu.trigger(:_geometry_down_, name)
35
33
  #
36
34
  # @return [TrueClass]
37
35
  # @see Vedeu::Move
38
- def cursor_down!
36
+ def down!
39
37
  Vedeu.bind(:_cursor_down_) do |name|
40
38
  Vedeu::Move.by_name(Vedeu::Cursor, :down, name)
41
39
  end
40
+
41
+ Vedeu.bind(:_view_down_) do |name|
42
+ Vedeu::Move.by_name(Vedeu::Geometry, :down, name)
43
+ end
44
+
45
+ Vedeu.bind_alias(:_geometry_down_, :_view_down_)
42
46
  end
43
47
 
44
- # Move the cursor left by one character.
48
+ # Move the cursor/view left by one character.
45
49
  #
46
50
  # @example
47
51
  # Vedeu.trigger(:_cursor_left_, name)
52
+ # Vedeu.trigger(:_view_left_, name)
53
+ # Vedeu.trigger(:_geometry_left_, name)
48
54
  #
49
55
  # @return [TrueClass]
50
56
  # @see Vedeu::Move
51
- def cursor_left!
57
+ def left!
52
58
  Vedeu.bind(:_cursor_left_) do |name|
53
59
  Vedeu::Move.by_name(Vedeu::Cursor, :left, name)
54
60
  end
61
+
62
+ Vedeu.bind(:_view_left_) do |name|
63
+ Vedeu::Move.by_name(Vedeu::Geometry, :left, name)
64
+ end
65
+
66
+ Vedeu.bind_alias(:_geometry_left_, :_view_left_)
55
67
  end
56
68
 
57
69
  # This event moves the cursor to the interface origin; the top left corner
@@ -99,94 +111,46 @@ module Vedeu
99
111
  end
100
112
  end
101
113
 
102
- # Move the cursor right by one character.
114
+ # Move the cursor/view right by one character.
103
115
  #
104
116
  # @example
105
117
  # Vedeu.trigger(:_cursor_right_, name)
118
+ # Vedeu.trigger(:_view_right_, name)
119
+ # Vedeu.trigger(:_geometry_right_, name)
106
120
  #
107
121
  # @return [TrueClass]
108
122
  # @see Vedeu::Move
109
- def cursor_right!
123
+ def right!
110
124
  Vedeu.bind(:_cursor_right_) do |name|
111
125
  Vedeu::Move.by_name(Vedeu::Cursor, :right, name)
112
126
  end
113
- end
114
-
115
- # Move the cursor up by one character.
116
- #
117
- # @example
118
- # Vedeu.trigger(:_cursor_up, name)
119
- #
120
- # @return [TrueClass]
121
- # @see Vedeu::Move
122
- def cursor_up!
123
- Vedeu.bind(:_cursor_up_) do |name|
124
- Vedeu::Move.by_name(Vedeu::Cursor, :up, name)
125
- end
126
- end
127
-
128
- # Move the geometry down by one character.
129
- #
130
- # @example
131
- # Vedeu.trigger(:_geometry_down_, name)
132
- # Vedeu.trigger(:_view_down_, name)
133
- #
134
- # @return [TrueClass]
135
- # @see Vedeu::Move
136
- def geometry_down!
137
- Vedeu.bind(:_geometry_down_) do |name|
138
- Vedeu::Move.by_name(Vedeu::Geometry, :down, name)
139
- end
140
-
141
- Vedeu.bind_alias(:_view_down_, :_geometry_down_)
142
- end
143
-
144
- # Move the geometry left by one character.
145
- #
146
- # @example
147
- # Vedeu.trigger(:_geometry_left_, name)
148
- # Vedeu.trigger(:_view_left_, name)
149
- #
150
- # @return [TrueClass]
151
- # @see Vedeu::Move
152
- def geometry_left!
153
- Vedeu.bind(:_geometry_left_) do |name|
154
- Vedeu::Move.by_name(Vedeu::Geometry, :left, name)
155
- end
156
127
 
157
- Vedeu.bind_alias(:_view_left_, :_geometry_left_)
158
- end
159
-
160
- # Move the geometry right by one character.
161
- #
162
- # @example
163
- # Vedeu.trigger(:_geometry_right_, name)
164
- # Vedeu.trigger(:_view_right_, name)
165
- #
166
- # @return [TrueClass]
167
- # @see Vedeu::Move
168
- def geometry_right!
169
- Vedeu.bind(:_geometry_right_) do |name|
128
+ Vedeu.bind(:_view_right_) do |name|
170
129
  Vedeu::Move.by_name(Vedeu::Geometry, :right, name)
171
130
  end
172
131
 
173
- Vedeu.bind_alias(:_view_right_, :_geometry_right_)
132
+ Vedeu.bind_alias(:_geometry_right_, :_view_right_)
174
133
  end
175
134
 
176
- # Move the geometry up by one character.
135
+ # Move the cursor/view up by one character.
177
136
  #
178
137
  # @example
179
- # Vedeu.trigger(:_geometry_up_, name)
138
+ # Vedeu.trigger(:_cursor_up, name)
180
139
  # Vedeu.trigger(:_view_up_, name)
140
+ # Vedeu.trigger(:_geometry_up_, name)
181
141
  #
182
142
  # @return [TrueClass]
183
143
  # @see Vedeu::Move
184
- def geometry_up!
185
- Vedeu.bind(:_geometry_up_) do |name|
144
+ def up!
145
+ Vedeu.bind(:_cursor_up_) do |name|
146
+ Vedeu::Move.by_name(Vedeu::Cursor, :up, name)
147
+ end
148
+
149
+ Vedeu.bind(:_view_up_) do |name|
186
150
  Vedeu::Move.by_name(Vedeu::Geometry, :up, name)
187
151
  end
188
152
 
189
- Vedeu.bind_alias(:_view_up_, :_geometry_up_)
153
+ Vedeu.bind_alias(:_geometry_up_, :_view_up_)
190
154
  end
191
155
 
192
156
  end # Movement
@@ -141,7 +141,7 @@ module Vedeu
141
141
  #
142
142
  # @return [String]
143
143
  def named
144
- ["\e[", named_codes, 'm'].join
144
+ "\e[#{named_codes}m"
145
145
  end
146
146
 
147
147
  # Returns a boolean indicating whether the colour provided is a valid named
@@ -164,7 +164,7 @@ module Vedeu
164
164
  #
165
165
  # @return [String]
166
166
  def numbered
167
- [numbered_prefix, css_to_numbered, 'm'].join
167
+ "#{numbered_prefix}#{css_to_numbered}m"
168
168
  end
169
169
 
170
170
  # Returns a boolean indicated whether the colour is a valid HTML/CSS colour.
@@ -80,10 +80,10 @@ module Vedeu
80
80
  # @return [String]
81
81
  def to_s
82
82
  if block_given?
83
- [sequence, yield, sequence].join
83
+ "#{position}#{yield}#{position}#{visibility}"
84
84
 
85
85
  else
86
- sequence
86
+ "#{position}#{visibility}"
87
87
 
88
88
  end
89
89
  end
@@ -139,13 +139,6 @@ module Vedeu
139
139
  }
140
140
  end
141
141
 
142
- # Returns the escape sequence to position the cursor and set its visibility.
143
- #
144
- # @return [String]
145
- def sequence
146
- [position, visibility].join
147
- end
148
-
149
142
  # Returns the escape sequence for setting the visibility of the cursor.
150
143
  #
151
144
  # @return [String]
@@ -32,7 +32,7 @@ module Vedeu
32
32
  #
33
33
  # @return [String] The host and port as a single value.
34
34
  def to_s
35
- ['druby://', host, ':', port].join
35
+ "druby://#{host}:#{port}"
36
36
  end
37
37
  alias_method :to_str, :to_s
38
38
 
@@ -75,18 +75,14 @@ module Vedeu
75
75
  #
76
76
  # @return [Fixnum]
77
77
  def y_position
78
- value = if oy <= 0
79
- y
80
-
81
- elsif oy > yn_index
82
- yn
83
-
84
- else
85
- y_range[oy]
86
-
87
- end
88
-
89
- validate_y(value)
78
+ pos = case
79
+ when oy <= 0 then y
80
+ when oy > yn_index then yn
81
+ else
82
+ y_range[oy]
83
+ end
84
+
85
+ validate_y(pos)
90
86
  end
91
87
 
92
88
  # Returns the x coordinate for a given index.
@@ -100,18 +96,14 @@ module Vedeu
100
96
  #
101
97
  # @return [Fixnum]
102
98
  def x_position
103
- value = if ox <= 0
104
- x
105
-
106
- elsif ox > xn_index
107
- xn
108
-
109
- else
110
- x_range[ox]
111
-
112
- end
113
-
114
- validate_x(value)
99
+ pos = case
100
+ when ox <= 0 then x
101
+ when ox > xn_index then xn
102
+ else
103
+ x_range[ox]
104
+ end
105
+
106
+ validate_x(pos)
115
107
  end
116
108
 
117
109
  protected
@@ -159,9 +151,13 @@ module Vedeu
159
151
  #
160
152
  # @return [Fixnum]
161
153
  def yn_index
162
- return 0 if y_indices.empty?
154
+ if height < 1
155
+ 0
156
+
157
+ else
158
+ height - 1
163
159
 
164
- y_indices.last
160
+ end
165
161
  end
166
162
 
167
163
  # Returns the maximum x index for an area.
@@ -172,31 +168,13 @@ module Vedeu
172
168
  #
173
169
  # @return [Fixnum]
174
170
  def xn_index
175
- return 0 if x_indices.empty?
176
-
177
- x_indices.last
178
- end
171
+ if width < 1
172
+ 0
179
173
 
180
- # Returns the same as #y_range, except as indices of an array.
181
- #
182
- # @example
183
- # # height = 4
184
- # y_indices # => [0, 1, 2, 3]
185
- #
186
- # @return [Array]
187
- def y_indices
188
- (0...height).to_a
189
- end
174
+ else
175
+ width - 1
190
176
 
191
- # Returns the same as #x_range, except as indices of an array.
192
- #
193
- # @example
194
- # # width = 10
195
- # x_indices # => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
196
- #
197
- # @return [Array]
198
- def x_indices
199
- (0...width).to_a
177
+ end
200
178
  end
201
179
 
202
180
  # Returns an array with all coordinates from x to xn.
@@ -87,7 +87,7 @@ module Vedeu
87
87
  # @yieldreturn [void] Returns the block wrapped in position escape
88
88
  # sequences.
89
89
  def to_s
90
- return [sequence, yield].join if block_given?
90
+ return "#{sequence}#{yield}" if block_given?
91
91
 
92
92
  sequence
93
93
  end
@@ -95,7 +95,7 @@ module Vedeu
95
95
  #
96
96
  # @return [TrueClass]
97
97
  def log(message:, force: false, type: :info)
98
- output = [message_type(type), message_body(type, message)]
98
+ output = log_entry(type, message)
99
99
 
100
100
  logger.debug(output) if enabled? || force
101
101
 
@@ -106,14 +106,14 @@ module Vedeu
106
106
  #
107
107
  # @return [TrueClass]
108
108
  def log_stdout(type: :info, message:)
109
- $stdout.puts [message_type(type), message_body(type, message)].join
109
+ $stdout.puts log_entry(type, message)
110
110
  end
111
111
 
112
112
  # Write a message to STDERR.
113
113
  #
114
114
  # @return [TrueClass]
115
115
  def log_stderr(type: :info, message:)
116
- $stderr.puts [message_type(type), message_body(type, message)].join
116
+ $stderr.puts log_entry(type, message)
117
117
  end
118
118
 
119
119
  private
@@ -135,7 +135,19 @@ module Vedeu
135
135
  # combined.
136
136
  # @return [String]
137
137
  def formatted_message(message)
138
- [timestamp, message, "\n"].join
138
+ "#{timestamp}#{message}\n"
139
+ end
140
+
141
+ # Returns the message:
142
+ #
143
+ # [type] message
144
+ #
145
+ # @param type [Symbol] The type of log message.
146
+ # @param message [String] The message you wish to emit to the log file,
147
+ # useful for debugging.
148
+ # @return [String]
149
+ def log_entry(type, message)
150
+ "#{message_type(type)}#{message_body(type, message)}"
139
151
  end
140
152
 
141
153
  # Fetches the filename from the configuration.
@@ -42,39 +42,39 @@ module Vedeu
42
42
  def border
43
43
  return '' unless block_given?
44
44
 
45
- [border_on, yield, border_off].join
45
+ "#{border_on}#{yield}#{border_off}"
46
46
  end
47
47
 
48
48
  private
49
49
 
50
50
  # @return [String]
51
51
  def clear
52
- [colour_reset, "\e[2J"].join
52
+ "#{colour_reset}\e[2J"
53
53
  end
54
54
 
55
55
  # @return [String]
56
56
  def clear_line
57
- [colour_reset, "\e[2K"].join
57
+ "#{colour_reset}\e[2K"
58
58
  end
59
59
 
60
60
  # @return [String]
61
61
  def colour_reset
62
- [fg_reset, bg_reset].join
62
+ "#{fg_reset}#{bg_reset}"
63
63
  end
64
64
 
65
65
  # @return [String]
66
66
  def normal
67
- [underline_off, bold_off, positive].join
67
+ "#{underline_off}#{bold_off}#{positive}"
68
68
  end
69
69
 
70
70
  # @return [String]
71
71
  def screen_init
72
- [reset, clear, hide_cursor].join
72
+ "#{reset}#{clear}#{hide_cursor}"
73
73
  end
74
74
 
75
75
  # @return [String]
76
76
  def screen_exit
77
- [show_cursor, colour_reset, reset, last_character_position, "\n"].join
77
+ "#{show_cursor}#{colour_reset}#{reset}#{last_character_position}\n"
78
78
  end
79
79
 
80
80
  # @return [String]
@@ -30,7 +30,7 @@ module Vedeu
30
30
 
31
31
  # @return [String]
32
32
  def render
33
- [start_tag, tag_style, '>', tag_value, end_tag].join
33
+ "#{start_tag}#{tag_style}>#{tag_value}#{end_tag}"
34
34
  end
35
35
 
36
36
  protected
@@ -66,10 +66,10 @@ module Vedeu
66
66
  when :left_vertical then css('left')
67
67
  when :right_vertical then css('right')
68
68
  when :bottom_horizontal then css('bottom')
69
- when :top_left then [css('top'), css('left')].join
70
- when :top_right then [css('top'), css('right')].join
71
- when :bottom_left then [css('bottom'), css('left')].join
72
- when :bottom_right then [css('bottom'), css('right')].join
69
+ when :top_left then "#{css('top')}#{css('left')}"
70
+ when :top_right then "#{css('top')}#{css('right')}"
71
+ when :bottom_left then "#{css('bottom')}#{css('left')}"
72
+ when :bottom_right then "#{css('bottom')}#{css('right')}"
73
73
  else
74
74
  ''
75
75
  end
@@ -28,7 +28,7 @@ module Vedeu
28
28
  #
29
29
  # @return [String]
30
30
  def render_colour
31
- [colour, yield].join
31
+ "#{colour}#{yield}"
32
32
  end
33
33
 
34
34
  # @return [String]
@@ -47,7 +47,7 @@ module Vedeu
47
47
  #
48
48
  # @return [String]
49
49
  def render_style
50
- [style, yield].join
50
+ "#{style}#{yield}"
51
51
  end
52
52
 
53
53
  end # Presentation
@@ -118,7 +118,7 @@ module Vedeu
118
118
  prune_string(string)
119
119
 
120
120
  else
121
- [prune_string(string), ellipsis].join
121
+ "#{prune_string(string)}#{ellipsis}"
122
122
 
123
123
  end
124
124
  end
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
 
6
6
  end
@@ -15,11 +15,14 @@ module Vedeu
15
15
  it { Vedeu.bound?(:_cursor_reset_).must_equal(true) }
16
16
  it { Vedeu.bound?(:_cursor_right_).must_equal(true) }
17
17
  it { Vedeu.bound?(:_cursor_up_).must_equal(true) }
18
-
19
18
  it { Vedeu.bound?(:_geometry_down_).must_equal(true) }
20
19
  it { Vedeu.bound?(:_geometry_left_).must_equal(true) }
21
20
  it { Vedeu.bound?(:_geometry_right_).must_equal(true) }
22
21
  it { Vedeu.bound?(:_geometry_up_).must_equal(true) }
22
+ it { Vedeu.bound?(:_view_down_).must_equal(true) }
23
+ it { Vedeu.bound?(:_view_left_).must_equal(true) }
24
+ it { Vedeu.bound?(:_view_right_).must_equal(true) }
25
+ it { Vedeu.bound?(:_view_up_).must_equal(true) }
23
26
  end
24
27
 
25
28
  end # Movement
@@ -53,10 +53,17 @@ module Vedeu
53
53
  end
54
54
 
55
55
  describe '#hide' do
56
+ let(:visible) { true }
57
+ let(:hide_cursor) { Vedeu::Escape.new(Vedeu::Esc.hide_cursor) }
58
+
59
+ before {
60
+ Vedeu::Output.stubs(:render).
61
+ with(hide_cursor).returns(hide_cursor)
62
+ }
63
+
56
64
  subject { instance.hide }
57
65
 
58
66
  it { subject.must_be_instance_of(Vedeu::Escape) }
59
- it { subject.to_s.must_equal("\e[?25l") }
60
67
  end
61
68
 
62
69
  describe '#inspect' do
@@ -75,10 +82,17 @@ module Vedeu
75
82
  end
76
83
 
77
84
  describe '#show' do
85
+ let(:visible) { false }
86
+ let(:show_cursor) { Vedeu::Escape.new(Vedeu::Esc.show_cursor) }
87
+
88
+ before {
89
+ Vedeu::Output.stubs(:render).
90
+ with(show_cursor).returns(show_cursor)
91
+ }
92
+
78
93
  subject { instance.show }
79
94
 
80
95
  it { subject.must_be_instance_of(Vedeu::Escape) }
81
- it { subject.to_s.must_equal("\e[?25h") }
82
96
  end
83
97
 
84
98
  describe '#to_s' do
@@ -113,7 +127,7 @@ module Vedeu
113
127
  it 'returns the escape sequence to position and set the visibility ' \
114
128
  'of the cursor and returns to that position after yielding the ' \
115
129
  'block' do
116
- subject.must_equal("\e[8;19H\e[?25h\e[8;19H\e[?25h")
130
+ subject.must_equal("\e[8;19H\e[8;19H\e[?25h")
117
131
  end
118
132
  end
119
133
  end
@@ -15,41 +15,29 @@ module Vedeu
15
15
  let(:x) { 1 }
16
16
  let(:y) { 1 }
17
17
 
18
+ let(:cursor) {
19
+ Vedeu::Cursor.new(name: _name, ox: ox, oy: oy, visible: true, x: x, y: y)
20
+ }
21
+ let(:new_cursor) {
22
+ Vedeu::Cursor.new
23
+ }
24
+ let(:border) {
25
+ Vedeu::Border.new(name: '_name', enabled: enabled)
26
+ }
27
+ let(:enabled) { true }
28
+ let(:geometry) {
29
+ Vedeu::Geometry.new(name: _name, x: 5, xn: 10, y: 5, yn: 10)
30
+ }
31
+
18
32
  before {
19
- Vedeu::Cursor.new(name: 'move_with_border',
20
- ox: ox,
21
- oy: oy,
22
- visible: true,
23
- x: x,
24
- y: y).store
25
- Vedeu::Cursor.new(name: 'move_without_border',
26
- ox: ox,
27
- oy: oy,
28
- visible: true,
29
- x: x,
30
- y: y).store
31
- Vedeu.border 'move_with_border' do
32
- # ...
33
- end
34
- Vedeu.geometry 'move_with_border' do
35
- x 5
36
- xn 10
37
- y 5
38
- yn 10
39
- end
40
- Vedeu.geometry 'move_without_border' do
41
- x 5
42
- xn 10
43
- y 5
44
- yn 10
45
- end
46
33
  IO.console.stubs(:winsize).returns([25, 80])
47
34
  IO.console.stubs(:print)
48
- }
49
- after {
50
- Vedeu.borders.reset
51
- Vedeu.cursors.reset
52
- Vedeu.geometries.reset
35
+
36
+ Vedeu.borders.stubs(:by_name).returns(border)
37
+ Vedeu.cursors.stubs(:by_name).returns(cursor)
38
+ Vedeu.geometries.stubs(:by_name).returns(geometry)
39
+
40
+ Vedeu.stubs(:trigger).with(:_refresh_cursor_, _name)
53
41
  }
54
42
 
55
43
  describe '#initialize' do
@@ -63,11 +51,12 @@ module Vedeu
63
51
  describe '.by_name' do
64
52
  let(:direction) { :down }
65
53
  let(:_name) { 'manganese' }
54
+ let(:oy) { 2 }
55
+ let(:ox) { 3 }
56
+ let(:x) { 8 }
57
+ let(:y) { 7 }
66
58
 
67
- before {
68
- Vedeu::Cursor.new(name: 'manganese', oy: 2, ox: 3, x: 8, y: 7).store
69
- Vedeu.stubs(:focus).returns('neon')
70
- }
59
+ before { Vedeu.stubs(:focus).returns('neon') }
71
60
 
72
61
  subject { described.by_name(entity, direction, _name) }
73
62
 
@@ -115,9 +104,8 @@ module Vedeu
115
104
 
116
105
  it { subject.must_be_instance_of(Vedeu::Cursor) }
117
106
 
118
- it { subject.y.must_equal(2) }
119
-
120
107
  context 'when within the boundary of the interface' do
108
+ let(:enabled) { false }
121
109
  let(:_name) { 'move_without_border' }
122
110
  let(:oy) { 15 }
123
111
 
@@ -127,6 +115,7 @@ module Vedeu
127
115
  end
128
116
 
129
117
  context 'when within the border of the interface' do
118
+ let(:enabled) { true }
130
119
  let(:_name) { 'move_with_border' }
131
120
  let(:oy) { 15 }
132
121
 
@@ -143,9 +132,8 @@ module Vedeu
143
132
 
144
133
  it { subject.must_be_instance_of(Vedeu::Cursor) }
145
134
 
146
- it { subject.x.must_equal(1) }
147
-
148
135
  context 'when within the boundary of the interface' do
136
+ let(:enabled) { false }
149
137
  let(:_name) { 'move_without_border' }
150
138
 
151
139
  it 'does not move past the left of the interface' do
@@ -154,6 +142,7 @@ module Vedeu
154
142
  end
155
143
 
156
144
  context 'when within the border of the interface' do
145
+ let(:enabled) { true }
157
146
  let(:_name) { 'move_with_border' }
158
147
 
159
148
  it 'does not move past the left border' do
@@ -169,9 +158,8 @@ module Vedeu
169
158
 
170
159
  it { subject.must_be_instance_of(Vedeu::Cursor) }
171
160
 
172
- it { subject.x.must_equal(2) }
173
-
174
161
  context 'when within the boundary of the interface' do
162
+ let(:enabled) { false }
175
163
  let(:_name) { 'move_without_border' }
176
164
  let(:ox) { 15 }
177
165
 
@@ -181,6 +169,7 @@ module Vedeu
181
169
  end
182
170
 
183
171
  context 'when within the border of the interface' do
172
+ let(:enabled) { true }
184
173
  let(:_name) { 'move_with_border' }
185
174
  let(:ox) { 15 }
186
175
 
@@ -197,9 +186,8 @@ module Vedeu
197
186
 
198
187
  it { subject.must_be_instance_of(Vedeu::Cursor) }
199
188
 
200
- it { subject.y.must_equal(1) }
201
-
202
189
  context 'when within the boundary of the interface' do
190
+ let(:enabled) { false }
203
191
  let(:_name) { 'move_without_border' }
204
192
 
205
193
  it 'does not move past the top of the interface' do
@@ -208,6 +196,7 @@ module Vedeu
208
196
  end
209
197
 
210
198
  context 'when within the border of the interface' do
199
+ let(:enabled) { true }
211
200
  let(:_name) { 'move_with_border' }
212
201
 
213
202
  it 'does not move past the top border' do
@@ -223,12 +212,8 @@ module Vedeu
223
212
 
224
213
  it { subject.must_be_instance_of(Vedeu::Cursor) }
225
214
 
226
- context 'within the visible area for the console' do
227
- it { subject.x.must_equal(1) }
228
- it { subject.y.must_equal(1) }
229
- end
230
-
231
215
  context 'within the boundary of the interface' do
216
+ let(:enabled) { false }
232
217
  let(:_name) { 'move_without_border' }
233
218
 
234
219
  it { subject.x.must_equal(5) }
@@ -236,6 +221,7 @@ module Vedeu
236
221
  end
237
222
 
238
223
  context 'within the border of the interface' do
224
+ let(:enabled) { true }
239
225
  let(:_name) { 'move_with_border' }
240
226
 
241
227
  it { subject.x.must_equal(6) }
@@ -6,12 +6,8 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::EventAliases }
8
8
 
9
- before do
10
- Vedeu::EventAliases.reset
11
- end
12
- after do
13
- Vedeu::Bindings.setup!
14
- end
9
+ before { Vedeu::EventAliases.reset }
10
+ after { Vedeu::Bindings.setup! }
15
11
 
16
12
  describe '.add' do
17
13
  let(:alias_name) { :alias_test }
@@ -95,7 +95,6 @@ module Vedeu
95
95
  subject { instance.maximise }
96
96
 
97
97
  it { subject.must_be_instance_of(described) }
98
-
99
98
  it { subject.maximised.must_equal(true) }
100
99
  end
101
100
 
@@ -114,7 +113,6 @@ module Vedeu
114
113
  subject { instance.unmaximise }
115
114
 
116
115
  it { subject.must_be_instance_of(described) }
117
-
118
116
  it { subject.maximised.must_equal(false) }
119
117
  end
120
118
 
@@ -13,7 +13,7 @@ module Vedeu
13
13
  subject { described.log(message: _message, force: force, type: type) }
14
14
 
15
15
  it { subject.must_equal(
16
- ["\e[97m[info] \e[39m", "\e[39mSome message...\e[39m"]
16
+ "\e[97m[info] \e[39m\e[39mSome message...\e[39m"
17
17
  ) }
18
18
  end
19
19
 
@@ -138,12 +138,16 @@ module Vedeu
138
138
  let(:view) { mock('Vedeu::Viewport') }
139
139
 
140
140
  before {
141
+ Vedeu.stubs(:trigger).with(:_hide_cursor_, _name)
142
+
141
143
  Vedeu::Clear::NamedInterface.stubs(:render).returns(:clear)
142
144
 
145
+ Vedeu::Viewport.stubs(:render).returns(:view)
146
+
143
147
  Vedeu.borders.stubs(:by_name).returns(border)
144
148
  border.stubs(:render).returns(:border)
145
- Vedeu::Viewport.stubs(:new).returns(view)
146
- view.stubs(:render).returns(:view)
149
+
150
+ Vedeu.stubs(:trigger).with(:_show_cursor_, _name)
147
151
  }
148
152
 
149
153
  subject { instance.render }
@@ -11,6 +11,8 @@ module Vedeu
11
11
  before {
12
12
  configuration.stubs(:drb?).returns(false)
13
13
  Terminal.stubs(:open).returns([''])
14
+
15
+ Vedeu.stubs(:trigger)
14
16
  }
15
17
 
16
18
  describe '#initialize' do
@@ -71,6 +71,8 @@ module Vedeu
71
71
  end
72
72
 
73
73
  describe '.output' do
74
+ before { IO.console.stubs(:print) }
75
+
74
76
  subject { described.output(*_value) }
75
77
 
76
78
  it { described.must_respond_to(:write) }
@@ -5,11 +5,6 @@ require 'minitest/autorun'
5
5
  require 'minitest/pride' unless ENV['NO_COLOR']
6
6
  require 'minitest/hell'
7
7
 
8
- # Notes: (2015-07-20)
9
- #
10
- # On my MacBookPro 6,2 (Mid-2010), the test speed is around 0.9s to 1.1s.
11
- # On my Raspberry Pi 2 (Early 2015), the test speed is around 6.5s to 7.0s.
12
-
13
8
  # GC.disable # Uncomment to remove ~20ms from test run speed; left uncommented
14
9
  # though makes tests slower over time with 'guard'.
15
10
 
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.2
4
+ version: 0.5.3
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-07-29 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard