vedeu 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/README.md +1 -1
- data/docs/api.md +60 -67
- data/docs/configuration.md +8 -5
- data/docs/events.md +31 -15
- data/docs/events/application.md +12 -0
- data/docs/events/document.md +57 -0
- data/docs/events/drb.md +43 -0
- data/docs/events/focus.md +24 -0
- data/docs/events/menu.md +57 -0
- data/docs/events/movement.md +57 -0
- data/docs/events/refresh.md +25 -0
- data/docs/events/system.md +90 -0
- data/docs/events/visibility.md +68 -0
- data/lib/vedeu.rb +2 -2
- data/lib/vedeu/all.rb +3 -2
- data/lib/vedeu/api.rb +18 -18
- data/lib/vedeu/application/controller.rb +1 -1
- data/lib/vedeu/application/helper.rb +1 -1
- data/lib/vedeu/application/view.rb +1 -1
- data/lib/vedeu/bindings/application.rb +1 -12
- data/lib/vedeu/bindings/bindings.rb +3 -1
- data/lib/vedeu/bindings/document.rb +9 -62
- data/lib/vedeu/bindings/drb.rb +12 -56
- data/lib/vedeu/bindings/focus.rb +3 -28
- data/lib/vedeu/bindings/menus.rb +10 -66
- data/lib/vedeu/bindings/movement.rb +4 -69
- data/lib/vedeu/bindings/refresh.rb +3 -33
- data/lib/vedeu/bindings/system.rb +14 -100
- data/lib/vedeu/bindings/visibility.rb +20 -71
- data/lib/vedeu/borders/all.rb +4 -3
- data/lib/vedeu/borders/border.rb +39 -33
- data/lib/vedeu/borders/dsl.rb +40 -33
- data/lib/vedeu/borders/null.rb +2 -2
- data/lib/vedeu/borders/render.rb +29 -24
- data/lib/vedeu/borders/repository.rb +2 -2
- data/lib/vedeu/buffers/all.rb +8 -7
- data/lib/vedeu/buffers/buffer.rb +47 -39
- data/lib/vedeu/buffers/null.rb +2 -2
- data/lib/vedeu/buffers/refresh.rb +4 -3
- data/lib/vedeu/buffers/virtual_buffer.rb +122 -118
- data/lib/vedeu/buffers/virtual_buffers.rb +62 -56
- data/lib/vedeu/colours/background.rb +2 -1
- data/lib/vedeu/colours/colour.rb +21 -19
- data/lib/vedeu/colours/foreground.rb +2 -1
- data/lib/vedeu/colours/repository.rb +6 -5
- data/lib/vedeu/colours/translator.rb +39 -35
- data/lib/vedeu/configuration/api.rb +59 -51
- data/lib/vedeu/configuration/cli.rb +9 -7
- data/lib/vedeu/configuration/configuration.rb +41 -32
- data/lib/vedeu/cursors/cursor.rb +1 -1
- data/lib/vedeu/cursors/refresh.rb +20 -16
- data/lib/vedeu/distributed/server.rb +8 -6
- data/lib/vedeu/distributed/subprocess.rb +90 -86
- data/lib/vedeu/distributed/uri.rb +4 -3
- data/lib/vedeu/dsl/composition.rb +2 -2
- data/lib/vedeu/dsl/group.rb +4 -4
- data/lib/vedeu/dsl/interface.rb +5 -5
- data/lib/vedeu/dsl/presentation.rb +2 -2
- data/lib/vedeu/dsl/text.rb +1 -1
- data/lib/vedeu/editor/cropper.rb +4 -4
- data/lib/vedeu/editor/cursor.rb +6 -4
- data/lib/vedeu/editor/document.rb +20 -18
- data/lib/vedeu/editor/editor.rb +2 -2
- data/lib/vedeu/editor/line.rb +10 -5
- data/lib/vedeu/editor/lines.rb +2 -2
- data/lib/vedeu/internal_api.rb +4 -4
- data/lib/vedeu/models/focus.rb +197 -191
- data/lib/vedeu/models/group.rb +171 -159
- data/lib/vedeu/models/groups.rb +14 -10
- data/lib/vedeu/models/interface.rb +116 -110
- data/lib/vedeu/models/interfaces.rb +24 -20
- data/lib/vedeu/models/toggleable.rb +4 -4
- data/lib/vedeu/models/views/char.rb +1 -1
- data/lib/vedeu/models/views/composition.rb +1 -1
- data/lib/vedeu/models/views/line.rb +1 -1
- data/lib/vedeu/models/views/stream.rb +1 -1
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/null/interface.rb +1 -1
- data/lib/vedeu/null/view.rb +1 -1
- data/lib/vedeu/output/clear/named_interface.rb +1 -1
- data/lib/vedeu/output/compressor.rb +78 -73
- data/lib/vedeu/output/direct.rb +61 -57
- data/lib/vedeu/output/output.rb +34 -29
- data/lib/vedeu/output/{presentation.rb → presentation/presentation.rb} +2 -1
- data/lib/vedeu/output/presentation/style.rb +64 -18
- data/lib/vedeu/output/presentation/styles.rb +39 -0
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/output/renderers/json.rb +2 -1
- data/lib/vedeu/output/renderers/terminal.rb +3 -3
- data/lib/vedeu/output/renderers/text.rb +3 -3
- data/lib/vedeu/output/text.rb +186 -180
- data/lib/vedeu/output/wordwrap.rb +142 -138
- data/lib/vedeu/refresh/refresh.rb +2 -2
- data/lib/vedeu/templating/helpers.rb +11 -6
- data/lib/vedeu/templating/view_template.rb +1 -1
- data/lib/vedeu/terminal/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/borders/render_test.rb +1 -1
- data/test/lib/vedeu/buffers/buffer_test.rb +16 -14
- data/test/lib/vedeu/buffers/virtual_buffer_test.rb +105 -101
- data/test/lib/vedeu/buffers/virtual_buffers_test.rb +43 -39
- data/test/lib/vedeu/colours/colour_test.rb +4 -4
- data/test/lib/vedeu/cursors/cursor_test.rb +2 -2
- data/test/lib/vedeu/cursors/repository_test.rb +3 -3
- data/test/lib/vedeu/distributed/subprocess_test.rb +33 -29
- data/test/lib/vedeu/dsl/group_test.rb +3 -3
- data/test/lib/vedeu/dsl/interface_test.rb +6 -5
- data/test/lib/vedeu/dsl/line_test.rb +4 -2
- data/test/lib/vedeu/dsl/presentation_test.rb +2 -2
- data/test/lib/vedeu/dsl/text_test.rb +8 -8
- data/test/lib/vedeu/editor/document_test.rb +10 -6
- data/test/lib/vedeu/input/keymap_test.rb +1 -10
- data/test/lib/vedeu/models/focus_test.rb +177 -170
- data/test/lib/vedeu/models/group_test.rb +99 -95
- data/test/lib/vedeu/models/groups_test.rb +13 -9
- data/test/lib/vedeu/models/interface_test.rb +93 -87
- data/test/lib/vedeu/models/interfaces_test.rb +24 -20
- data/test/lib/vedeu/models/views/char_test.rb +2 -2
- data/test/lib/vedeu/models/views/line_test.rb +11 -7
- data/test/lib/vedeu/models/views/stream_test.rb +1 -1
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_group_test.rb +1 -1
- data/test/lib/vedeu/output/clear/named_interface_test.rb +3 -1
- data/test/lib/vedeu/output/compressor_test.rb +126 -122
- data/test/lib/vedeu/output/direct_test.rb +49 -43
- data/test/lib/vedeu/output/output_test.rb +35 -31
- data/test/lib/vedeu/output/{presentation_test.rb → presentation/presentation_test.rb} +11 -7
- data/test/lib/vedeu/output/presentation/style_test.rb +88 -48
- data/test/lib/vedeu/output/presentation/styles_test.rb +84 -0
- data/test/lib/vedeu/output/text_test.rb +109 -105
- data/test/lib/vedeu/output/viewport_test.rb +3 -1
- data/test/lib/vedeu/output/wordwrap_test.rb +209 -205
- data/test/lib/vedeu/refresh/refresh_test.rb +3 -1
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/view_template_test.rb +1 -1
- metadata +17 -8
- data/lib/vedeu/output/style.rb +0 -76
- data/test/lib/vedeu/output/style_test.rb +0 -120
@@ -2,143 +2,147 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
let(:described) { Vedeu::VirtualBuffer }
|
8
|
-
let(:instance) { described.new(height, width, renderer) }
|
9
|
-
let(:height) { 3 }
|
10
|
-
let(:width) { 3 }
|
11
|
-
let(:renderer) { Vedeu::Renderers::HTML.new }
|
12
|
-
|
13
|
-
describe '#initialize' do
|
14
|
-
it { instance.must_be_instance_of(described) }
|
15
|
-
it { instance.instance_variable_get('@height').must_equal(3) }
|
16
|
-
it { instance.instance_variable_get('@width').must_equal(3) }
|
17
|
-
it { instance.instance_variable_get('@renderer').must_equal(renderer) }
|
18
|
-
end
|
19
|
-
|
20
|
-
describe 'accessors' do
|
21
|
-
it { instance.must_respond_to(:renderer) }
|
22
|
-
it { instance.must_respond_to(:renderer=) }
|
23
|
-
it { instance.must_respond_to(:height) }
|
24
|
-
it { instance.must_respond_to(:width) }
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '.output' do
|
28
|
-
let(:data) {}
|
29
|
-
|
30
|
-
before do
|
31
|
-
Vedeu.stubs(:width).returns(3)
|
32
|
-
Vedeu.stubs(:height).returns(3)
|
33
|
-
end
|
5
|
+
module Buffers
|
34
6
|
|
35
|
-
|
7
|
+
describe VirtualBuffer do
|
36
8
|
|
37
|
-
|
38
|
-
|
9
|
+
let(:described) { Vedeu::Buffers::VirtualBuffer }
|
10
|
+
let(:instance) { described.new(height, width, renderer) }
|
11
|
+
let(:height) { 3 }
|
12
|
+
let(:width) { 3 }
|
13
|
+
let(:renderer) { Vedeu::Renderers::HTML.new }
|
39
14
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
15
|
+
describe '#initialize' do
|
16
|
+
it { instance.must_be_instance_of(described) }
|
17
|
+
it { instance.instance_variable_get('@height').must_equal(3) }
|
18
|
+
it { instance.instance_variable_get('@width').must_equal(3) }
|
19
|
+
it { instance.instance_variable_get('@renderer').must_equal(renderer) }
|
44
20
|
end
|
45
21
|
|
46
|
-
|
22
|
+
describe 'accessors' do
|
23
|
+
it { instance.must_respond_to(:renderer) }
|
24
|
+
it { instance.must_respond_to(:renderer=) }
|
25
|
+
it { instance.must_respond_to(:height) }
|
26
|
+
it { instance.must_respond_to(:width) }
|
27
|
+
end
|
47
28
|
|
48
|
-
|
49
|
-
|
50
|
-
it { subject.flatten.size.must_equal(9) }
|
51
|
-
end
|
29
|
+
describe '.output' do
|
30
|
+
let(:data) {}
|
52
31
|
|
53
|
-
|
54
|
-
|
32
|
+
before do
|
33
|
+
Vedeu.stubs(:width).returns(3)
|
34
|
+
Vedeu.stubs(:height).returns(3)
|
35
|
+
end
|
55
36
|
|
56
|
-
|
57
|
-
let(:y) { 1 }
|
58
|
-
let(:x) { 5 }
|
37
|
+
subject { described.output(data) }
|
59
38
|
|
60
|
-
it { subject.
|
39
|
+
it { subject.must_be_instance_of(Array) }
|
61
40
|
end
|
62
41
|
|
63
|
-
|
64
|
-
|
65
|
-
|
42
|
+
describe '#cells' do
|
43
|
+
before do
|
44
|
+
Vedeu.stubs(:width).returns(3)
|
45
|
+
Vedeu.stubs(:height).returns(3)
|
46
|
+
end
|
66
47
|
|
67
|
-
|
68
|
-
end
|
48
|
+
subject { instance.cells }
|
69
49
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
it { subject.must_equal([]) }
|
50
|
+
it { subject.must_be_instance_of(Array) }
|
51
|
+
it { subject.size.must_equal(3) }
|
52
|
+
it { subject.flatten.size.must_equal(9) }
|
75
53
|
end
|
76
54
|
|
77
|
-
|
78
|
-
|
79
|
-
let(:x) { 2 }
|
55
|
+
describe '#read' do
|
56
|
+
subject { instance.read(y, x) }
|
80
57
|
|
81
|
-
|
82
|
-
|
83
|
-
|
58
|
+
context 'when x is out of bounds' do
|
59
|
+
let(:y) { 1 }
|
60
|
+
let(:x) { 5 }
|
84
61
|
|
85
|
-
|
86
|
-
|
87
|
-
end
|
62
|
+
it { subject.must_equal([]) }
|
63
|
+
end
|
88
64
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
Vedeu.stubs(:height).returns(3)
|
93
|
-
end
|
65
|
+
context 'when y is out of bounds' do
|
66
|
+
let(:y) { 5 }
|
67
|
+
let(:x) { 1 }
|
94
68
|
|
95
|
-
|
69
|
+
it { subject.must_equal([]) }
|
70
|
+
end
|
96
71
|
|
97
|
-
|
98
|
-
|
72
|
+
context 'when both x and y are out of bounds' do
|
73
|
+
let(:y) { 5 }
|
74
|
+
let(:x) { 5 }
|
99
75
|
|
100
|
-
|
101
|
-
|
76
|
+
it { subject.must_equal([]) }
|
77
|
+
end
|
102
78
|
|
103
|
-
|
79
|
+
context 'when x and y are in bounds' do
|
80
|
+
let(:y) { 0 }
|
81
|
+
let(:x) { 2 }
|
104
82
|
|
105
|
-
|
106
|
-
|
83
|
+
it { subject.must_be_instance_of(Vedeu::Models::Cell) }
|
84
|
+
end
|
85
|
+
end
|
107
86
|
|
108
|
-
|
109
|
-
|
87
|
+
describe '#output' do
|
88
|
+
it { instance.must_respond_to(:output) }
|
89
|
+
end
|
110
90
|
|
111
|
-
|
91
|
+
describe '#render' do
|
92
|
+
before do
|
93
|
+
Vedeu.stubs(:width).returns(3)
|
94
|
+
Vedeu.stubs(:height).returns(3)
|
95
|
+
end
|
112
96
|
|
113
|
-
|
114
|
-
let(:y) { 1 }
|
115
|
-
let(:x) { 5 }
|
97
|
+
subject { instance.render }
|
116
98
|
|
117
|
-
it { subject.
|
99
|
+
it { subject.must_be_instance_of(String) }
|
118
100
|
end
|
119
101
|
|
120
|
-
|
121
|
-
|
122
|
-
|
102
|
+
describe '#reset' do
|
103
|
+
subject { instance.reset }
|
104
|
+
|
105
|
+
it { subject.must_be_instance_of(Array) }
|
123
106
|
|
124
|
-
it {
|
107
|
+
it { instance.must_respond_to(:clear) }
|
125
108
|
end
|
126
109
|
|
127
|
-
|
128
|
-
let(:
|
129
|
-
let(:x) { 5 }
|
110
|
+
describe '#write' do
|
111
|
+
let(:data) { Vedeu::Views::Char.new(value: 'a') }
|
130
112
|
|
131
|
-
|
132
|
-
|
113
|
+
subject { instance.write(y, x, data) }
|
114
|
+
|
115
|
+
context 'when x is out of bounds' do
|
116
|
+
let(:y) { 1 }
|
117
|
+
let(:x) { 5 }
|
118
|
+
|
119
|
+
it { subject.must_equal(false) }
|
120
|
+
end
|
121
|
+
|
122
|
+
context 'when y is out of bounds' do
|
123
|
+
let(:y) { 5 }
|
124
|
+
let(:x) { 1 }
|
133
125
|
|
134
|
-
|
135
|
-
|
136
|
-
let(:x) { 2 }
|
126
|
+
it { subject.must_equal(false) }
|
127
|
+
end
|
137
128
|
|
138
|
-
|
129
|
+
context 'when both x and y are out of bounds' do
|
130
|
+
let(:y) { 5 }
|
131
|
+
let(:x) { 5 }
|
132
|
+
|
133
|
+
it { subject.must_equal(false) }
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'when x and y are in bounds' do
|
137
|
+
let(:y) { 0 }
|
138
|
+
let(:x) { 2 }
|
139
|
+
|
140
|
+
it { subject.must_equal(true) }
|
141
|
+
end
|
139
142
|
end
|
140
|
-
end
|
141
143
|
|
142
|
-
|
144
|
+
end # VirtualBuffer
|
145
|
+
|
146
|
+
end # Buffers
|
143
147
|
|
144
148
|
end # Vedeu
|
@@ -2,68 +2,72 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Buffers
|
6
6
|
|
7
|
-
|
7
|
+
describe VirtualBuffers do
|
8
8
|
|
9
|
-
|
9
|
+
let(:described) { Vedeu::Buffers::VirtualBuffers }
|
10
10
|
|
11
|
-
|
12
|
-
subject { described.retrieve }
|
11
|
+
before { described.clear }
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
13
|
+
describe '#retrieve' do
|
14
|
+
subject { described.retrieve }
|
17
15
|
|
18
|
-
|
19
|
-
|
16
|
+
context 'when no buffers are stored' do
|
17
|
+
it { subject.must_be_instance_of(NilClass) }
|
18
|
+
end
|
20
19
|
|
21
|
-
|
20
|
+
context 'when buffers are stored' do
|
21
|
+
let(:buffer) { [[Vedeu::Views::Char.new]] }
|
22
22
|
|
23
|
-
|
23
|
+
before { described.store(buffer) }
|
24
24
|
|
25
|
-
|
25
|
+
it { subject.must_be_instance_of(Array) }
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
it { subject.must_equal(buffer) }
|
28
|
+
|
29
|
+
it 'removes the stored buffer from the storage' do
|
30
|
+
described.size.must_equal(1)
|
31
|
+
subject
|
32
|
+
described.size.must_equal(0)
|
33
|
+
end
|
31
34
|
end
|
32
35
|
end
|
33
|
-
end
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
+
describe '#store' do
|
38
|
+
let(:data) { :data }
|
37
39
|
|
38
|
-
|
40
|
+
subject { described.store(data) }
|
39
41
|
|
40
|
-
|
42
|
+
it { subject.must_be_instance_of(Array) }
|
41
43
|
|
42
|
-
|
44
|
+
it { subject.must_equal([:data]) }
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
it 'adds the buffer (data) to the storage' do
|
47
|
+
described.size.must_equal(0)
|
48
|
+
subject
|
49
|
+
described.size.must_equal(1)
|
50
|
+
end
|
48
51
|
end
|
49
|
-
end
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
+
describe '#size' do
|
54
|
+
subject { described.size }
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
+
it { subject.must_be_instance_of(Fixnum) }
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#clear' do
|
60
|
+
subject { described.clear }
|
56
61
|
|
57
|
-
|
58
|
-
subject { described.clear }
|
62
|
+
it { subject.must_be_instance_of(Array) }
|
59
63
|
|
60
|
-
|
64
|
+
it { subject.must_be_empty }
|
61
65
|
|
62
|
-
|
66
|
+
it { described.must_respond_to(:reset) }
|
67
|
+
end
|
63
68
|
|
64
|
-
|
65
|
-
end
|
69
|
+
end # VirtualBuffers
|
66
70
|
|
67
|
-
end #
|
71
|
+
end # Buffers
|
68
72
|
|
69
73
|
end # Vedeu
|
@@ -170,9 +170,9 @@ module Vedeu
|
|
170
170
|
describe '#background=' do
|
171
171
|
let(:_value) { '#000000' }
|
172
172
|
|
173
|
-
subject { instance.background
|
173
|
+
subject { instance.public_send(:background=, _value) }
|
174
174
|
|
175
|
-
it { subject.
|
175
|
+
it { subject.must_be_instance_of(Vedeu::Colours::Background) }
|
176
176
|
end
|
177
177
|
|
178
178
|
describe '#eql?' do
|
@@ -192,9 +192,9 @@ module Vedeu
|
|
192
192
|
describe '#foreground=' do
|
193
193
|
let(:_value) { '#ff0000' }
|
194
194
|
|
195
|
-
subject { instance.foreground
|
195
|
+
subject { instance.public_send(:foreground=, _value) }
|
196
196
|
|
197
|
-
it { subject.
|
197
|
+
it { subject.must_be_instance_of(Vedeu::Colours::Foreground) }
|
198
198
|
end
|
199
199
|
|
200
200
|
describe '#to_s' do
|
@@ -79,7 +79,7 @@ module Vedeu
|
|
79
79
|
}
|
80
80
|
|
81
81
|
before do
|
82
|
-
Vedeu::Output.stubs(:render).
|
82
|
+
Vedeu::Output::Output.stubs(:render).
|
83
83
|
with(hide_cursor).returns(hide_cursor)
|
84
84
|
end
|
85
85
|
|
@@ -205,7 +205,7 @@ module Vedeu
|
|
205
205
|
}
|
206
206
|
|
207
207
|
before do
|
208
|
-
Vedeu::Output.stubs(:render).
|
208
|
+
Vedeu::Output::Output.stubs(:render).
|
209
209
|
with(show_cursor).returns(show_cursor)
|
210
210
|
end
|
211
211
|
|
@@ -15,9 +15,9 @@ module Vedeu
|
|
15
15
|
|
16
16
|
context 'when there are cursors are defined' do
|
17
17
|
before do
|
18
|
-
Vedeu::Focus.reset
|
18
|
+
Vedeu::Models::Focus.reset
|
19
19
|
Vedeu.cursors.reset
|
20
|
-
Vedeu::Focus.add('Vedeu.cursor')
|
20
|
+
Vedeu::Models::Focus.add('Vedeu.cursor')
|
21
21
|
Vedeu::Cursors::Cursor.new(name: 'Vedeu.cursor').store
|
22
22
|
end
|
23
23
|
|
@@ -26,7 +26,7 @@ module Vedeu
|
|
26
26
|
|
27
27
|
context 'when there are no cursors defined' do
|
28
28
|
before do
|
29
|
-
Vedeu::Focus.reset
|
29
|
+
Vedeu::Models::Focus.reset
|
30
30
|
Vedeu.cursors.reset
|
31
31
|
end
|
32
32
|
|
@@ -2,43 +2,47 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Distributed
|
6
6
|
|
7
|
-
|
8
|
-
let(:instance) { described.new(application) }
|
9
|
-
let(:application) {}
|
7
|
+
describe Subprocess do
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
instance.instance_variable_get('@application').must_equal(application)
|
15
|
-
end
|
16
|
-
it { instance.instance_variable_get('@pid').must_equal(nil) }
|
17
|
-
end
|
9
|
+
let(:described) { Vedeu::Distributed::Subprocess }
|
10
|
+
let(:instance) { described.new(application) }
|
11
|
+
let(:application) {}
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
describe '#initialize' do
|
14
|
+
it { instance.must_be_instance_of(described) }
|
15
|
+
it do
|
16
|
+
instance.instance_variable_get('@application').must_equal(application)
|
17
|
+
end
|
18
|
+
it { instance.instance_variable_get('@pid').must_equal(nil) }
|
19
|
+
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
describe '.execute!' do
|
22
|
+
it { described.must_respond_to(:execute!) }
|
23
|
+
end
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
Process.stubs(:kill)
|
30
|
-
File.stubs(:unlink)
|
25
|
+
describe '#execute!' do
|
26
|
+
it { instance.must_respond_to(:execute!) }
|
31
27
|
end
|
32
28
|
|
33
|
-
|
29
|
+
describe '#kill' do
|
30
|
+
before do
|
31
|
+
Process.stubs(:kill)
|
32
|
+
File.stubs(:unlink)
|
33
|
+
end
|
34
|
+
|
35
|
+
subject { instance.kill }
|
36
|
+
|
37
|
+
it {
|
38
|
+
Process.expects(:kill)
|
39
|
+
File.expects(:unlink)
|
40
|
+
subject
|
41
|
+
}
|
42
|
+
end
|
34
43
|
|
35
|
-
|
36
|
-
Process.expects(:kill)
|
37
|
-
File.expects(:unlink)
|
38
|
-
subject
|
39
|
-
}
|
40
|
-
end
|
44
|
+
end # Subprocess
|
41
45
|
|
42
|
-
end #
|
46
|
+
end # Distributed
|
43
47
|
|
44
48
|
end # Vedeu
|