vedeu 0.4.7 → 0.4.8
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.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -2
- data/lib/vedeu/api.rb +1 -0
- data/lib/vedeu/application.rb +2 -4
- data/lib/vedeu/bindings.rb +13 -13
- data/lib/vedeu/configuration/api.rb +6 -9
- data/lib/vedeu/configuration/cli.rb +4 -7
- data/lib/vedeu/cursor/all.rb +2 -2
- data/lib/vedeu/cursor/{move_cursor.rb → move.rb} +6 -6
- data/lib/vedeu/cursor/refresh_cursor.rb +7 -4
- data/lib/vedeu/cursor/{toggle_cursor.rb → toggle.rb} +6 -8
- data/lib/vedeu/debug.rb +2 -0
- data/lib/vedeu/distributed/client.rb +1 -2
- data/lib/vedeu/distributed/server.rb +1 -1
- data/lib/vedeu/distributed/subprocess.rb +3 -2
- data/lib/vedeu/distributed/test_application.rb +2 -4
- data/lib/vedeu/dsl/all.rb +2 -0
- data/lib/vedeu/dsl/components/geometry.rb +45 -10
- data/lib/vedeu/dsl/interface.rb +1 -1
- data/lib/vedeu/events/event.rb +22 -14
- data/lib/vedeu/events/trigger.rb +6 -3
- data/lib/vedeu/geometry/all.rb +6 -1
- data/lib/vedeu/geometry/area.rb +151 -0
- data/lib/vedeu/geometry/canvas.rb +79 -0
- data/lib/vedeu/geometry/centre.rb +83 -0
- data/lib/vedeu/geometry/{content_geometry.rb → content.rb} +3 -3
- data/lib/vedeu/geometry/dimension.rb +81 -0
- data/lib/vedeu/{models → geometry}/geometry.rb +32 -0
- data/lib/vedeu/geometry/grid.rb +1 -2
- data/lib/vedeu/geometry/index_position.rb +3 -11
- data/lib/vedeu/geometry/limit.rb +1 -1
- data/lib/vedeu/geometry/position.rb +5 -0
- data/lib/vedeu/geometry/position_index.rb +3 -5
- data/lib/vedeu/geometry/position_validator.rb +1 -4
- data/lib/vedeu/input/input.rb +1 -2
- data/lib/vedeu/input/mapper.rb +2 -4
- data/lib/vedeu/launcher.rb +1 -1
- data/lib/vedeu/main_loop.rb +2 -0
- data/lib/vedeu/models/all.rb +1 -1
- data/lib/vedeu/models/cell.rb +68 -0
- data/lib/vedeu/models/interface.rb +4 -2
- data/lib/vedeu/output/all.rb +0 -1
- data/lib/vedeu/output/border.rb +6 -6
- data/lib/vedeu/output/clear.rb +6 -5
- data/lib/vedeu/output/colour.rb +1 -1
- data/lib/vedeu/output/esc.rb +2 -2
- data/lib/vedeu/output/output.rb +1 -3
- data/lib/vedeu/output/style.rb +2 -2
- data/lib/vedeu/output/text.rb +17 -1
- data/lib/vedeu/output/translator.rb +1 -8
- data/lib/vedeu/output/virtual_terminal.rb +3 -3
- data/lib/vedeu/output/wordwrap.rb +1 -1
- data/lib/vedeu/repositories/model.rb +1 -1
- data/lib/vedeu/repositories/repository.rb +1 -1
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/trace.rb +5 -3
- data/test/lib/vedeu/cursor/{move_cursor_test.rb → move_test.rb} +22 -22
- data/test/lib/vedeu/cursor/{toggle_cursor_test.rb → toggle_test.rb} +6 -6
- data/test/lib/vedeu/dsl/components/geometry_test.rb +14 -2
- data/test/lib/vedeu/geometry/area_test.rb +99 -0
- data/test/lib/vedeu/geometry/canvas_test.rb +66 -0
- data/test/lib/vedeu/geometry/centre_test.rb +58 -0
- data/test/lib/vedeu/geometry/{content_geometry_test.rb → content_test.rb} +3 -3
- data/test/lib/vedeu/geometry/dimension_test.rb +99 -0
- data/test/lib/vedeu/{models → geometry}/geometry_test.rb +0 -0
- data/test/lib/vedeu/geometry/index_position_test.rb +3 -9
- data/test/lib/vedeu/geometry/position_index_test.rb +2 -2
- data/test/lib/vedeu/geometry/position_test.rb +6 -0
- data/test/lib/vedeu/models/cell_test.rb +66 -0
- data/test/lib/vedeu/output/virtual_terminal_test.rb +25 -25
- data/vedeu.gemspec +3 -3
- metadata +34 -22
- data/lib/vedeu/output/char_builder.rb +0 -36
- data/test/lib/vedeu/output/char_builder_test.rb +0 -50
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Area do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Area }
|
8
|
+
let(:instance) { described.new(y: y, yn: yn, x: x, xn: xn) }
|
9
|
+
let(:y) { 4 }
|
10
|
+
let(:yn) { 9 }
|
11
|
+
let(:x) { 6 }
|
12
|
+
let(:xn) { 21 }
|
13
|
+
|
14
|
+
describe 'accessors and aliases' do
|
15
|
+
it { instance.must_respond_to(:y) }
|
16
|
+
it { instance.must_respond_to(:yn) }
|
17
|
+
it { instance.must_respond_to(:x) }
|
18
|
+
it { instance.must_respond_to(:xn) }
|
19
|
+
it { instance.must_respond_to(:top) }
|
20
|
+
it { instance.must_respond_to(:bottom) }
|
21
|
+
it { instance.must_respond_to(:left) }
|
22
|
+
it { instance.must_respond_to(:right) }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#initialize' do
|
26
|
+
it { instance.must_be_instance_of(Vedeu::Area) }
|
27
|
+
it { instance.instance_variable_get('@y').must_equal(y) }
|
28
|
+
it { instance.instance_variable_get('@yn').must_equal(yn) }
|
29
|
+
it { instance.instance_variable_get('@x').must_equal(x) }
|
30
|
+
it { instance.instance_variable_get('@xn').must_equal(xn) }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.from_dimensions' do
|
34
|
+
let(:y_yn) { [5, 8] }
|
35
|
+
let(:x_xn) { [15, 25] }
|
36
|
+
|
37
|
+
subject { described.from_dimensions(y_yn: y_yn, x_xn: x_xn) }
|
38
|
+
|
39
|
+
it { subject.must_be_instance_of(Vedeu::Area) }
|
40
|
+
it { subject.instance_variable_get('@y').must_equal(5) }
|
41
|
+
it { subject.instance_variable_get('@yn').must_equal(8) }
|
42
|
+
it { subject.instance_variable_get('@x').must_equal(15) }
|
43
|
+
it { subject.instance_variable_get('@xn').must_equal(25) }
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '.from_height_and_width' do
|
47
|
+
let(:height) { 5 }
|
48
|
+
let(:width) { 15 }
|
49
|
+
|
50
|
+
subject { described.from_height_and_width(height: height, width: width) }
|
51
|
+
|
52
|
+
it { subject.must_be_instance_of(Vedeu::Area) }
|
53
|
+
it { subject.instance_variable_get('@y').must_equal(1) }
|
54
|
+
it { subject.instance_variable_get('@yn').must_equal(5) }
|
55
|
+
it { subject.instance_variable_get('@x').must_equal(1) }
|
56
|
+
it { subject.instance_variable_get('@xn').must_equal(15) }
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '.from_points' do
|
60
|
+
subject { described.from_points(y: y, yn: yn, x: x, xn: xn) }
|
61
|
+
|
62
|
+
it { subject.must_be_instance_of(Vedeu::Area) }
|
63
|
+
it { subject.instance_variable_get('@y').must_equal(y) }
|
64
|
+
it { subject.instance_variable_get('@yn').must_equal(yn) }
|
65
|
+
it { subject.instance_variable_get('@x').must_equal(x) }
|
66
|
+
it { subject.instance_variable_get('@xn').must_equal(xn) }
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#centre' do
|
70
|
+
subject { instance.centre }
|
71
|
+
|
72
|
+
it { subject.must_be_instance_of(Array) }
|
73
|
+
it { subject.must_equal([6, 13]) }
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#centre' do
|
77
|
+
subject { instance.centre }
|
78
|
+
|
79
|
+
it { subject.must_be_instance_of(Array) }
|
80
|
+
it { subject.must_equal([6, 13]) }
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#centre_y' do
|
84
|
+
subject { instance.centre_y }
|
85
|
+
|
86
|
+
it { subject.must_be_instance_of(Fixnum) }
|
87
|
+
it { subject.must_equal(6) }
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#centre_x' do
|
91
|
+
subject { instance.centre_x }
|
92
|
+
|
93
|
+
it { subject.must_be_instance_of(Fixnum) }
|
94
|
+
it { subject.must_equal(13) }
|
95
|
+
end
|
96
|
+
|
97
|
+
end # Area
|
98
|
+
|
99
|
+
end # Vedeu
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Canvas do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Canvas }
|
8
|
+
let(:instance) { described.canvas }
|
9
|
+
let(:yn) { 25 }
|
10
|
+
let(:xn) { 80 }
|
11
|
+
|
12
|
+
before { instance.configure(yn, xn) }
|
13
|
+
|
14
|
+
describe '.canvas' do
|
15
|
+
it { instance.must_be_instance_of(Vedeu::Canvas) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#configure' do
|
19
|
+
it { instance.must_be_instance_of(Vedeu::Canvas) }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#c' do
|
23
|
+
it { instance.c.must_equal([13, 40]) }
|
24
|
+
it { instance.must_respond_to(:centre) }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#cy' do
|
28
|
+
it { instance.cy.must_equal(13) }
|
29
|
+
it { instance.must_respond_to(:centre_y) }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#cx' do
|
33
|
+
it { instance.cx.must_equal(40) }
|
34
|
+
it { instance.must_respond_to(:centre_x) }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#o' do
|
38
|
+
it { instance.o.must_equal(1) }
|
39
|
+
it { instance.must_respond_to(:origin) }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#y' do
|
43
|
+
it { instance.y.must_equal(1) }
|
44
|
+
it { instance.must_respond_to(:top) }
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#yn' do
|
48
|
+
it { instance.yn.must_equal(25) }
|
49
|
+
it { instance.must_respond_to(:bottom) }
|
50
|
+
it { instance.must_respond_to(:height) }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#x' do
|
54
|
+
it { instance.x.must_equal(1) }
|
55
|
+
it { instance.must_respond_to(:left) }
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#xn' do
|
59
|
+
it { instance.xn.must_equal(80) }
|
60
|
+
it { instance.must_respond_to(:right) }
|
61
|
+
it { instance.must_respond_to(:width) }
|
62
|
+
end
|
63
|
+
|
64
|
+
end # Canvas
|
65
|
+
|
66
|
+
end # Vedeu
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Centre do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Centre }
|
8
|
+
let(:instance) { described.new(attributes) }
|
9
|
+
let(:attributes) {
|
10
|
+
{
|
11
|
+
v: v,
|
12
|
+
vn: vn,
|
13
|
+
value: value,
|
14
|
+
}
|
15
|
+
}
|
16
|
+
let(:v) { 2 }
|
17
|
+
let(:vn) { 47 }
|
18
|
+
let(:value) { 30 }
|
19
|
+
|
20
|
+
describe '#initialize' do
|
21
|
+
it { instance.must_be_instance_of(Vedeu::Centre) }
|
22
|
+
it { instance.instance_variable_get('@v').must_equal(v) }
|
23
|
+
it { instance.instance_variable_get('@vn').must_equal(vn) }
|
24
|
+
it { instance.instance_variable_get('@value').must_equal(value) }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#centre' do
|
28
|
+
subject { instance.centre }
|
29
|
+
|
30
|
+
it { subject.must_be_instance_of(Fixnum) }
|
31
|
+
|
32
|
+
context 'when the value is given' do
|
33
|
+
it { subject.must_equal(15) }
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when the value is not given' do
|
37
|
+
let(:value) {}
|
38
|
+
|
39
|
+
it { subject.must_equal(24) }
|
40
|
+
|
41
|
+
context 'when either v or vn is missing' do
|
42
|
+
let(:vn) {}
|
43
|
+
|
44
|
+
it { proc { subject }.must_raise(InvalidSyntax) }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when vn < v' do
|
48
|
+
let(:vn) { 15 }
|
49
|
+
let(:v) { 32 }
|
50
|
+
|
51
|
+
it { proc { subject }.must_raise(InvalidSyntax) }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end # Centre
|
57
|
+
|
58
|
+
end # Vedeu
|
@@ -2,9 +2,9 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Content do
|
6
6
|
|
7
|
-
let(:described) { Vedeu::
|
7
|
+
let(:described) { Vedeu::Content }
|
8
8
|
let(:instance) { described.new(interface) }
|
9
9
|
let(:interface) {
|
10
10
|
Vedeu.interface 'content_geometry' do
|
@@ -93,6 +93,6 @@ module Vedeu
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
end #
|
96
|
+
end # Content
|
97
97
|
|
98
98
|
end # Vedeu
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Dimension do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Dimension }
|
8
|
+
let(:instance) { described.new(attributes) }
|
9
|
+
let(:attributes) {
|
10
|
+
{
|
11
|
+
d: d,
|
12
|
+
dn: dn,
|
13
|
+
d_dn: d_dn,
|
14
|
+
default: default
|
15
|
+
}
|
16
|
+
}
|
17
|
+
let(:d) {}
|
18
|
+
let(:dn) {}
|
19
|
+
let(:d_dn) {}
|
20
|
+
let(:default) {}
|
21
|
+
|
22
|
+
describe '#initialize' do
|
23
|
+
it { instance.must_be_instance_of(Vedeu::Dimension) }
|
24
|
+
it { instance.instance_variable_get('@d').must_equal(d) }
|
25
|
+
it { instance.instance_variable_get('@dn').must_equal(dn) }
|
26
|
+
it { instance.instance_variable_get('@d_dn').must_equal(d_dn) }
|
27
|
+
it { instance.instance_variable_get('@default').must_equal(default) }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '.pair' do
|
31
|
+
let(:d) { 5 }
|
32
|
+
let(:dn) { 8 }
|
33
|
+
|
34
|
+
subject { described.pair(attributes) }
|
35
|
+
|
36
|
+
it { subject.must_be_instance_of(Array) }
|
37
|
+
it { subject.must_equal([5, 8]) }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#d1' do
|
41
|
+
subject { instance.d1 }
|
42
|
+
|
43
|
+
it { subject.must_be_instance_of(Fixnum) }
|
44
|
+
|
45
|
+
context 'when d is given' do
|
46
|
+
let(:d) { 5 }
|
47
|
+
|
48
|
+
it { subject.must_equal(5) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when d is not given' do
|
52
|
+
it { subject.must_equal(1) }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#d2' do
|
57
|
+
subject { instance.d2 }
|
58
|
+
|
59
|
+
context 'when d and dn is given' do
|
60
|
+
let(:d) { 5 }
|
61
|
+
let(:dn) { 8 }
|
62
|
+
|
63
|
+
it { subject.must_equal(8) }
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'when d and d_dn is given' do
|
67
|
+
let(:d) { 5 }
|
68
|
+
let(:d_dn) { 2 }
|
69
|
+
|
70
|
+
it { subject.must_equal(7) }
|
71
|
+
end
|
72
|
+
|
73
|
+
context 'when only d_dn is given' do
|
74
|
+
let(:d_dn) { 6 }
|
75
|
+
|
76
|
+
it { subject.must_equal(6) }
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'when d and a default is given' do
|
80
|
+
let(:d) { 1 }
|
81
|
+
let(:default) { 40 }
|
82
|
+
|
83
|
+
it { subject.must_equal(40) }
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when only a default is given' do
|
87
|
+
let(:default) { 25 }
|
88
|
+
|
89
|
+
it { subject.must_equal(25) }
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'when no default is given' do
|
93
|
+
it { subject.must_equal(nil) }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end # Dimension
|
98
|
+
|
99
|
+
end # Vedeu
|
File without changes
|
@@ -27,21 +27,15 @@ module Vedeu
|
|
27
27
|
describe '.[]' do
|
28
28
|
subject { described[iy, ix] }
|
29
29
|
|
30
|
-
it { subject.must_be_instance_of(
|
31
|
-
it { subject.must_equal([7, 18]) }
|
30
|
+
it { subject.must_be_instance_of(Vedeu::Position) }
|
32
31
|
end
|
33
32
|
|
34
33
|
describe '#[]' do
|
35
34
|
subject { instance.[] }
|
36
35
|
|
37
|
-
it { subject.must_be_instance_of(Array) }
|
38
|
-
it { subject.must_equal([9, 22]) }
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#to_position' do
|
42
|
-
subject { instance.to_position }
|
43
|
-
|
44
36
|
it { subject.must_be_instance_of(Vedeu::Position) }
|
37
|
+
it { subject.y.must_equal(9) }
|
38
|
+
it { subject.x.must_equal(22) }
|
45
39
|
end
|
46
40
|
|
47
41
|
describe '#y' do
|
@@ -17,13 +17,13 @@ module Vedeu
|
|
17
17
|
context 'when y is less than 1' do
|
18
18
|
let(:y) { -3 }
|
19
19
|
|
20
|
-
it { instance.instance_variable_get('@y').must_equal(
|
20
|
+
it { instance.instance_variable_get('@y').must_equal(0) }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when x is less than 1' do
|
24
24
|
let(:x) { -9 }
|
25
25
|
|
26
|
-
it { instance.instance_variable_get('@x').must_equal(
|
26
|
+
it { instance.instance_variable_get('@x').must_equal(0) }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Cell do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Cell }
|
8
|
+
let(:instance) { described.new(attributes) }
|
9
|
+
let(:attributes) {
|
10
|
+
{
|
11
|
+
background: background,
|
12
|
+
foreground: foreground,
|
13
|
+
style: style,
|
14
|
+
value: value,
|
15
|
+
x: x,
|
16
|
+
y: y,
|
17
|
+
}
|
18
|
+
}
|
19
|
+
let(:background) { '#000000' }
|
20
|
+
let(:foreground) {}
|
21
|
+
let(:style) {}
|
22
|
+
let(:value) {}
|
23
|
+
let(:x) {}
|
24
|
+
let(:y) {}
|
25
|
+
|
26
|
+
describe '#initialize' do
|
27
|
+
it { instance.must_be_instance_of(Vedeu::Cell) }
|
28
|
+
it { instance.instance_variable_get('@background').must_equal(background) }
|
29
|
+
it { instance.instance_variable_get('@foreground').must_equal(foreground) }
|
30
|
+
it { instance.instance_variable_get('@style').must_equal(style) }
|
31
|
+
it { instance.instance_variable_get('@value').must_equal(value) }
|
32
|
+
it { instance.instance_variable_get('@x').must_equal(x) }
|
33
|
+
it { instance.instance_variable_get('@y').must_equal(y) }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#==' do
|
37
|
+
let(:other) { instance }
|
38
|
+
|
39
|
+
subject { instance.==(other) }
|
40
|
+
|
41
|
+
it { subject.must_equal(true) }
|
42
|
+
|
43
|
+
context 'when different to other' do
|
44
|
+
let(:other) { described.new({}) }
|
45
|
+
|
46
|
+
it { subject.must_equal(false) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#eql?' do
|
51
|
+
let(:other) { instance }
|
52
|
+
|
53
|
+
subject { instance.eql?(other) }
|
54
|
+
|
55
|
+
it { subject.must_equal(true) }
|
56
|
+
|
57
|
+
context 'when different to other' do
|
58
|
+
let(:other) { described.new({}) }
|
59
|
+
|
60
|
+
it { subject.must_equal(false) }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end # Cell
|
65
|
+
|
66
|
+
end # Vedeu
|
@@ -8,14 +8,14 @@ module Vedeu
|
|
8
8
|
|
9
9
|
let(:described) { Vedeu::VirtualTerminal }
|
10
10
|
let(:instance) { described.new(height, width, renderer) }
|
11
|
-
let(:height) {
|
12
|
-
let(:width) {
|
11
|
+
let(:height) { 3 }
|
12
|
+
let(:width) { 3 }
|
13
13
|
let(:renderer) { Vedeu::HTMLRenderer }
|
14
14
|
|
15
15
|
describe '#initialize' do
|
16
16
|
it { instance.must_be_instance_of(Vedeu::VirtualTerminal) }
|
17
|
-
it { instance.instance_variable_get('@height').must_equal(
|
18
|
-
it { instance.instance_variable_get('@width').must_equal(
|
17
|
+
it { instance.instance_variable_get('@height').must_equal(3) }
|
18
|
+
it { instance.instance_variable_get('@width').must_equal(3) }
|
19
19
|
it { instance.instance_variable_get('@renderer').must_equal(Vedeu::HTMLRenderer) }
|
20
20
|
end
|
21
21
|
|
@@ -36,13 +36,13 @@ module Vedeu
|
|
36
36
|
context '#height' do
|
37
37
|
subject { instance.height }
|
38
38
|
|
39
|
-
it { subject.must_equal(
|
39
|
+
it { subject.must_equal(3) }
|
40
40
|
end
|
41
41
|
|
42
42
|
context '#width' do
|
43
43
|
subject { instance.width }
|
44
44
|
|
45
|
-
it { subject.must_equal(
|
45
|
+
it { subject.must_equal(3) }
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,39 +50,39 @@ module Vedeu
|
|
50
50
|
subject { instance.cells }
|
51
51
|
|
52
52
|
it { subject.must_be_instance_of(Array) }
|
53
|
-
it { subject.size.must_equal(
|
54
|
-
it { subject.flatten.size.must_equal(
|
53
|
+
it { subject.size.must_equal(3) }
|
54
|
+
it { subject.flatten.size.must_equal(9) }
|
55
55
|
end
|
56
56
|
|
57
57
|
describe '#read' do
|
58
58
|
subject { instance.read(y, x) }
|
59
59
|
|
60
60
|
context 'when x is out of bounds' do
|
61
|
-
let(:y) {
|
62
|
-
let(:x) {
|
61
|
+
let(:y) { 1 }
|
62
|
+
let(:x) { 5 }
|
63
63
|
|
64
64
|
it { subject.must_equal([]) }
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'when y is out of bounds' do
|
68
|
-
let(:y) {
|
69
|
-
let(:x) {
|
68
|
+
let(:y) { 5 }
|
69
|
+
let(:x) { 1 }
|
70
70
|
|
71
71
|
it { subject.must_equal([]) }
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'when both x and y are out of bounds' do
|
75
|
-
let(:y) {
|
76
|
-
let(:x) {
|
75
|
+
let(:y) { 5 }
|
76
|
+
let(:x) { 5 }
|
77
77
|
|
78
78
|
it { subject.must_equal([]) }
|
79
79
|
end
|
80
80
|
|
81
81
|
context 'when x and y are in bounds' do
|
82
|
-
let(:y) {
|
83
|
-
let(:x) {
|
82
|
+
let(:y) { 0 }
|
83
|
+
let(:x) { 2 }
|
84
84
|
|
85
|
-
it { subject.must_be_instance_of(Vedeu::
|
85
|
+
it { subject.must_be_instance_of(Vedeu::Cell) }
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -108,29 +108,29 @@ module Vedeu
|
|
108
108
|
subject { instance.write(y, x, data) }
|
109
109
|
|
110
110
|
context 'when x is out of bounds' do
|
111
|
-
let(:y) {
|
112
|
-
let(:x) {
|
111
|
+
let(:y) { 1 }
|
112
|
+
let(:x) { 5 }
|
113
113
|
|
114
114
|
it { subject.must_equal(false) }
|
115
115
|
end
|
116
116
|
|
117
117
|
context 'when y is out of bounds' do
|
118
|
-
let(:y) {
|
119
|
-
let(:x) {
|
118
|
+
let(:y) { 5 }
|
119
|
+
let(:x) { 1 }
|
120
120
|
|
121
121
|
it { subject.must_equal(false) }
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'when both x and y are out of bounds' do
|
125
|
-
let(:y) {
|
126
|
-
let(:x) {
|
125
|
+
let(:y) { 5 }
|
126
|
+
let(:x) { 5 }
|
127
127
|
|
128
128
|
it { subject.must_equal(false) }
|
129
129
|
end
|
130
130
|
|
131
131
|
context 'when x and y are in bounds' do
|
132
|
-
let(:y) {
|
133
|
-
let(:x) {
|
132
|
+
let(:y) { 0 }
|
133
|
+
let(:x) { 2 }
|
134
134
|
|
135
135
|
it { subject.must_equal(true) }
|
136
136
|
end
|
data/vedeu.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'vedeu'
|
7
|
-
spec.version = '0.4.
|
7
|
+
spec.version = '0.4.8'
|
8
8
|
spec.authors = ['Gavin Laking']
|
9
9
|
spec.email = ['gavinlaking@gmail.com']
|
10
10
|
spec.summary = %q{A terminal case of wonderland.}
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency 'aruba', '0.6.2'
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
22
|
spec.add_development_dependency 'cucumber', '1.3.19'
|
23
|
-
spec.add_development_dependency 'guard', '2.12.
|
23
|
+
spec.add_development_dependency 'guard', '2.12.5'
|
24
24
|
spec.add_development_dependency 'guard-bundler', '2.1.0'
|
25
25
|
spec.add_development_dependency 'guard-cucumber', '1.5.4'
|
26
26
|
spec.add_development_dependency 'guard-minitest', '2.4.4'
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'minitest-reporters', '1.0.11'
|
30
30
|
spec.add_development_dependency 'mocha', '1.1.0'
|
31
31
|
spec.add_development_dependency 'pry', '0.10.1'
|
32
|
-
spec.add_development_dependency 'pry-byebug', '3.0
|
32
|
+
spec.add_development_dependency 'pry-byebug', '3.1.0'
|
33
33
|
spec.add_development_dependency 'rake', '10.4.2'
|
34
34
|
spec.add_development_dependency 'ruby-prof', '0.15.6'
|
35
35
|
spec.add_development_dependency 'simplecov', '0.9.2'
|