vedeu 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -1
- data/lib/vedeu/application/controller.rb +2 -2
- data/lib/vedeu/bindings.rb +1 -1
- data/lib/vedeu/bindings/application.rb +2 -2
- data/lib/vedeu/bindings/drb.rb +8 -8
- data/lib/vedeu/bindings/menus.rb +11 -11
- data/lib/vedeu/bindings/movement.rb +12 -12
- data/lib/vedeu/bindings/system.rb +18 -18
- data/lib/vedeu/bindings/visibility.rb +9 -9
- data/lib/vedeu/colours/colour.rb +1 -1
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +8 -3
- data/lib/vedeu/dsl/interface.rb +41 -17
- data/lib/vedeu/log/debug.rb +5 -1
- data/lib/vedeu/log/log.rb +1 -0
- data/lib/vedeu/models/interface.rb +3 -2
- data/lib/vedeu/plugins.rb +1 -1
- data/lib/vedeu/runtime/bootstrap.rb +0 -3
- data/lib/vedeu/runtime/launcher.rb +3 -2
- data/lib/vedeu/runtime/router.rb +49 -47
- data/lib/vedeu/{traps.rb → runtime/traps.rb} +0 -0
- data/lib/vedeu/templating/decoder.rb +4 -2
- data/lib/vedeu/templating/encoder.rb +4 -2
- data/lib/vedeu/templating/view_template.rb +35 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_view_test.rb +1 -1
- data/test/lib/vedeu/application/controller_test.rb +4 -0
- data/test/lib/vedeu/bindings_test.rb +2 -0
- data/test/lib/vedeu/borders/border_test.rb +28 -40
- data/test/lib/vedeu/borders/borders_test.rb +0 -2
- data/test/lib/vedeu/borders/render_border_test.rb +11 -13
- data/test/lib/vedeu/buffers/buffer_test.rb +12 -5
- data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -2
- data/test/lib/vedeu/cli/generator/application_test.rb +9 -9
- data/test/lib/vedeu/cli/generator/view_test.rb +10 -7
- data/test/lib/vedeu/cli/main_test.rb +4 -4
- data/test/lib/vedeu/colours/colour_translator_test.rb +2 -4
- data/test/lib/vedeu/common_test.rb +8 -0
- data/test/lib/vedeu/configuration/configuration_test.rb +4 -4
- data/test/lib/vedeu/cursor/cursors_test.rb +4 -4
- data/test/lib/vedeu/cursor/move_test.rb +11 -8
- data/test/lib/vedeu/cursor/refresh_cursor_test.rb +12 -12
- data/test/lib/vedeu/cursor/reposition_test.rb +7 -11
- data/test/lib/vedeu/distributed/client_test.rb +4 -4
- data/test/lib/vedeu/distributed/server_test.rb +4 -5
- data/test/lib/vedeu/dsl/border_test.rb +2 -2
- data/test/lib/vedeu/dsl/composition_test.rb +5 -4
- data/test/lib/vedeu/dsl/geometry_test.rb +6 -4
- data/test/lib/vedeu/dsl/interface_test.rb +9 -27
- data/test/lib/vedeu/dsl/use_test.rb +2 -2
- data/test/lib/vedeu/events/trigger_test.rb +2 -2
- data/test/lib/vedeu/geometry/coordinate_test.rb +9 -9
- data/test/lib/vedeu/geometry/geometry_test.rb +8 -2
- data/test/lib/vedeu/geometry/position_validator_test.rb +11 -14
- data/test/lib/vedeu/input/input_test.rb +5 -5
- data/test/lib/vedeu/input/keymap_test.rb +2 -2
- data/test/lib/vedeu/log/timer_test.rb +2 -2
- data/test/lib/vedeu/models/focus_test.rb +20 -25
- data/test/lib/vedeu/models/interface_test.rb +2 -2
- data/test/lib/vedeu/models/interfaces_test.rb +7 -5
- data/test/lib/vedeu/models/line_test.rb +0 -5
- data/test/lib/vedeu/models/menu_test.rb +0 -2
- data/test/lib/vedeu/null/geometry_test.rb +1 -4
- data/test/lib/vedeu/output/clear/named_interface_test.rb +2 -2
- data/test/lib/vedeu/output/esc_test.rb +7 -4
- data/test/lib/vedeu/output/output_test.rb +3 -6
- data/test/lib/vedeu/output/refresh_test.rb +2 -2
- data/test/lib/vedeu/output/renderers/file_test.rb +1 -3
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -3
- data/test/lib/vedeu/output/renderers/json_test.rb +1 -3
- data/test/lib/vedeu/output/renderers_test.rb +2 -2
- data/test/lib/vedeu/output/viewport_test.rb +70 -71
- data/test/lib/vedeu/repositories/model_test.rb +0 -19
- data/test/lib/vedeu/repositories/repository_test.rb +8 -8
- data/test/lib/vedeu/runtime/application_test.rb +2 -2
- data/test/lib/vedeu/runtime/launcher_test.rb +7 -7
- data/test/lib/vedeu/runtime/router_test.rb +33 -33
- data/test/lib/vedeu/{traps_test.rb → runtime/traps_test.rb} +2 -2
- data/test/lib/vedeu/templating/decoder_test.rb +1 -0
- data/test/lib/vedeu/templating/encoder_test.rb +1 -0
- data/test/lib/vedeu/templating/template_test.rb +8 -1
- data/test/lib/vedeu/templating/view_template_test.rb +108 -22
- data/test/lib/vedeu/terminal_mode_test.rb +2 -2
- data/test/lib/vedeu/terminal_test.rb +6 -6
- data/test/support/helpers/model_test_class.rb +19 -0
- metadata +5 -17
- data/test/support/templates/background.erb +0 -1
- data/test/support/templates/colour.erb +0 -1
- data/test/support/templates/foreground.erb +0 -1
- data/test/support/templates/multiple.erb +0 -2
- data/test/support/templates/plain.erb +0 -1
- data/test/support/templates/style.erb +0 -1
@@ -9,10 +9,7 @@ module Vedeu
|
|
9
9
|
let(:output) {}
|
10
10
|
let(:drb) { false }
|
11
11
|
|
12
|
-
before
|
13
|
-
Vedeu::Configuration.stubs(:drb?).returns(drb)
|
14
|
-
Vedeu.renderers.stubs(:render)
|
15
|
-
end
|
12
|
+
before { Vedeu::Configuration.stubs(:drb?).returns(drb) }
|
16
13
|
|
17
14
|
describe '#initialize' do
|
18
15
|
it { instance.must_be_instance_of(described) }
|
@@ -28,10 +25,10 @@ module Vedeu
|
|
28
25
|
let(:drb) { true }
|
29
26
|
let(:virtual_buffer) { [] }
|
30
27
|
|
31
|
-
before
|
28
|
+
before {
|
32
29
|
# Vedeu::Renderers::HTML.stubs(:to_file)
|
33
30
|
Vedeu::VirtualBuffer.stubs(:retrieve).returns(virtual_buffer)
|
34
|
-
|
31
|
+
}
|
35
32
|
|
36
33
|
it {
|
37
34
|
Vedeu.expects(:trigger).with(:_drb_store_output_, output)
|
@@ -8,13 +8,11 @@ module Vedeu
|
|
8
8
|
let(:instance) { described.new(interface) }
|
9
9
|
let(:interface) { Vedeu.interfaces.by_name('lithium') }
|
10
10
|
let(:visibility) { true }
|
11
|
+
let(:geometry) { Vedeu::Geometry.new(height: 3, width: 3) }
|
11
12
|
|
12
|
-
before
|
13
|
+
before {
|
14
|
+
Vedeu.geometries.stubs(:by_name).returns(geometry)
|
13
15
|
Vedeu.interface 'lithium' do
|
14
|
-
geometry do
|
15
|
-
height 3
|
16
|
-
width 3
|
17
|
-
end
|
18
16
|
lines do
|
19
17
|
line 'barium'
|
20
18
|
line 'carbon'
|
@@ -23,9 +21,10 @@ module Vedeu
|
|
23
21
|
line 'nickel'
|
24
22
|
line 'osmium'
|
25
23
|
end
|
24
|
+
style nil
|
26
25
|
visible(visibility)
|
27
26
|
end
|
28
|
-
|
27
|
+
}
|
29
28
|
after { Vedeu.interfaces.reset }
|
30
29
|
|
31
30
|
describe '#initialize' do
|
@@ -60,9 +59,9 @@ module Vedeu
|
|
60
59
|
let(:x) { 1 }
|
61
60
|
let(:y) { 1 }
|
62
61
|
|
63
|
-
before
|
62
|
+
before {
|
64
63
|
interface.stubs(:cursor).returns(cursor)
|
65
|
-
|
64
|
+
}
|
66
65
|
|
67
66
|
subject { instance.render }
|
68
67
|
|
@@ -104,15 +103,15 @@ module Vedeu
|
|
104
103
|
|
105
104
|
it 'scrolls the content the correct position' do
|
106
105
|
subject.must_equal(
|
107
|
-
"\e[1;
|
108
|
-
"\e[1;
|
109
|
-
"\e[1;
|
110
|
-
"\e[2;
|
111
|
-
"\e[2;
|
112
|
-
"\e[2;
|
113
|
-
"\e[3;
|
114
|
-
"\e[3;
|
115
|
-
"\e[3;
|
106
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
107
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
108
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
109
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
110
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
111
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
112
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
113
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
114
|
+
"\e[3;3H\e[39m\e[49ml"
|
116
115
|
)
|
117
116
|
end
|
118
117
|
end
|
@@ -124,15 +123,15 @@ module Vedeu
|
|
124
123
|
|
125
124
|
it "renders the visible content" do
|
126
125
|
subject.must_equal(
|
127
|
-
"\e[1;
|
128
|
-
"\e[1;
|
129
|
-
"\e[1;
|
130
|
-
"\e[2;
|
131
|
-
"\e[2;
|
132
|
-
"\e[2;
|
133
|
-
"\e[3;
|
134
|
-
"\e[3;
|
135
|
-
"\e[3;
|
126
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
127
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
128
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
129
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
130
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
131
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
132
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
133
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
134
|
+
"\e[3;3H\e[39m\e[49ml"
|
136
135
|
)
|
137
136
|
end
|
138
137
|
end
|
@@ -143,15 +142,15 @@ module Vedeu
|
|
143
142
|
|
144
143
|
it "is cropped to show only that which fits" do
|
145
144
|
subject.must_equal(
|
146
|
-
"\e[1;
|
147
|
-
"\e[1;
|
148
|
-
"\e[1;
|
149
|
-
"\e[2;
|
150
|
-
"\e[2;
|
151
|
-
"\e[2;
|
152
|
-
"\e[3;
|
153
|
-
"\e[3;
|
154
|
-
"\e[3;
|
145
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
146
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
147
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
148
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
149
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
150
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
151
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
152
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
153
|
+
"\e[3;3H\e[39m\e[49ml"
|
155
154
|
)
|
156
155
|
end
|
157
156
|
end
|
@@ -164,15 +163,15 @@ module Vedeu
|
|
164
163
|
|
165
164
|
it 'scrolls the content the correct position' do
|
166
165
|
subject.must_equal(
|
167
|
-
"\e[1;
|
168
|
-
"\e[1;
|
169
|
-
"\e[1;
|
170
|
-
"\e[2;
|
171
|
-
"\e[2;
|
172
|
-
"\e[2;
|
173
|
-
"\e[3;
|
174
|
-
"\e[3;
|
175
|
-
"\e[3;
|
166
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
167
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
168
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
169
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
170
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
171
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
172
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
173
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
174
|
+
"\e[3;3H\e[39m\e[49ml"
|
176
175
|
)
|
177
176
|
end
|
178
177
|
end
|
@@ -183,15 +182,15 @@ module Vedeu
|
|
183
182
|
|
184
183
|
it "scrolls the content the correct position" do
|
185
184
|
subject.must_equal(
|
186
|
-
"\e[1;
|
187
|
-
"\e[1;
|
188
|
-
"\e[1;
|
189
|
-
"\e[2;
|
190
|
-
"\e[2;
|
191
|
-
"\e[2;
|
192
|
-
"\e[3;
|
193
|
-
"\e[3;
|
194
|
-
"\e[3;
|
185
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
186
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
187
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
188
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
189
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
190
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
191
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
192
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
193
|
+
"\e[3;3H\e[39m\e[49ml"
|
195
194
|
)
|
196
195
|
end
|
197
196
|
end
|
@@ -204,15 +203,15 @@ module Vedeu
|
|
204
203
|
|
205
204
|
it "renders the visible content" do
|
206
205
|
subject.must_equal(
|
207
|
-
"\e[1;
|
208
|
-
"\e[1;
|
209
|
-
"\e[1;
|
210
|
-
"\e[2;
|
211
|
-
"\e[2;
|
212
|
-
"\e[2;
|
213
|
-
"\e[3;
|
214
|
-
"\e[3;
|
215
|
-
"\e[3;
|
206
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
207
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
208
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
209
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
210
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
211
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
212
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
213
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
214
|
+
"\e[3;3H\e[39m\e[49ml"
|
216
215
|
)
|
217
216
|
end
|
218
217
|
end
|
@@ -223,15 +222,15 @@ module Vedeu
|
|
223
222
|
|
224
223
|
it "is cropped to show only that which fits" do
|
225
224
|
subject.must_equal(
|
226
|
-
"\e[1;
|
227
|
-
"\e[1;
|
228
|
-
"\e[1;
|
229
|
-
"\e[2;
|
230
|
-
"\e[2;
|
231
|
-
"\e[2;
|
232
|
-
"\e[3;
|
233
|
-
"\e[3;
|
234
|
-
"\e[3;
|
225
|
+
"\e[1;1H\e[39m\e[49mb\n" \
|
226
|
+
"\e[1;2H\e[39m\e[49ma\n" \
|
227
|
+
"\e[1;3H\e[39m\e[49mr\n" \
|
228
|
+
"\e[2;1H\e[39m\e[49mc\n" \
|
229
|
+
"\e[2;2H\e[39m\e[49ma\n" \
|
230
|
+
"\e[2;3H\e[39m\e[49mr\n" \
|
231
|
+
"\e[3;1H\e[39m\e[49mh\n" \
|
232
|
+
"\e[3;2H\e[39m\e[49me\n" \
|
233
|
+
"\e[3;3H\e[39m\e[49ml"
|
235
234
|
)
|
236
235
|
end
|
237
236
|
end
|
@@ -2,25 +2,6 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
module DSL
|
6
|
-
|
7
|
-
class ModelTestClass
|
8
|
-
|
9
|
-
include Vedeu::DSL::Presentation
|
10
|
-
|
11
|
-
def initialize(model, client = nil)
|
12
|
-
@model = model
|
13
|
-
@client = client
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
attr_reader :model
|
19
|
-
|
20
|
-
end # ModelTestClass
|
21
|
-
|
22
|
-
end # DSL
|
23
|
-
|
24
5
|
describe Model do
|
25
6
|
|
26
7
|
let(:described) { ModelTestClass }
|
@@ -179,21 +179,21 @@ module Vedeu
|
|
179
179
|
end
|
180
180
|
|
181
181
|
describe '#inspect' do
|
182
|
+
before { Vedeu.interfaces.reset }
|
183
|
+
|
182
184
|
subject { instance.inspect }
|
183
185
|
|
184
186
|
it { subject.must_be_instance_of(String) }
|
185
187
|
|
186
188
|
context 'when there are no models stored in the repository' do
|
187
|
-
before { instance.reset }
|
188
|
-
|
189
189
|
it { subject.must_equal("<Vedeu::Repository: []>") }
|
190
190
|
end
|
191
191
|
|
192
192
|
context 'when there are models stored in the repository' do
|
193
|
-
before
|
193
|
+
before {
|
194
194
|
Vedeu.interface('hydrogen') {}
|
195
195
|
Vedeu.interface('helium') {}
|
196
|
-
|
196
|
+
}
|
197
197
|
after { Vedeu.interfaces.reset }
|
198
198
|
|
199
199
|
subject { Vedeu.interfaces.inspect }
|
@@ -239,20 +239,20 @@ module Vedeu
|
|
239
239
|
end
|
240
240
|
|
241
241
|
context 'when the model is not registered' do
|
242
|
-
before
|
242
|
+
before {
|
243
243
|
instance.reset
|
244
244
|
instance.store(Vedeu::TestModel.new('zinc'))
|
245
|
-
|
245
|
+
}
|
246
246
|
|
247
247
|
it { subject.must_be_instance_of(FalseClass) }
|
248
248
|
end
|
249
249
|
|
250
250
|
context 'when the model is registered' do
|
251
|
-
before
|
251
|
+
before {
|
252
252
|
instance.reset
|
253
253
|
instance.store(Vedeu::TestModel.new('gadolinium'))
|
254
254
|
instance.store(Vedeu::TestModel.new('francium'))
|
255
|
-
|
255
|
+
}
|
256
256
|
|
257
257
|
it 'returns the storage with the model removed' do
|
258
258
|
subject.size.must_equal(1)
|
@@ -8,10 +8,10 @@ module Vedeu
|
|
8
8
|
let(:instance) { described.new(configuration) }
|
9
9
|
let(:configuration) { Vedeu.configuration }
|
10
10
|
|
11
|
-
before
|
11
|
+
before {
|
12
12
|
configuration.stubs(:drb?).returns(false)
|
13
13
|
Terminal.stubs(:open).returns([''])
|
14
|
-
|
14
|
+
}
|
15
15
|
|
16
16
|
describe '#initialize' do
|
17
17
|
it { instance.must_be_instance_of(described) }
|
@@ -7,13 +7,6 @@ module Vedeu
|
|
7
7
|
let(:described) { Vedeu::Launcher }
|
8
8
|
let(:instance) { described.new }
|
9
9
|
|
10
|
-
before do
|
11
|
-
Configuration.stubs(:configure)# .returns(test_configuration)
|
12
|
-
Application.stubs(:start)
|
13
|
-
Kernel.stubs(:exit)
|
14
|
-
Kernel.stubs(:puts)
|
15
|
-
end
|
16
|
-
|
17
10
|
describe '#initialize' do
|
18
11
|
it { instance.must_be_instance_of(described) }
|
19
12
|
it { instance.instance_variable_get('@argv').must_equal([]) }
|
@@ -39,6 +32,13 @@ module Vedeu
|
|
39
32
|
end
|
40
33
|
|
41
34
|
describe '#execute!' do
|
35
|
+
before {
|
36
|
+
Configuration.stubs(:configure)# .returns(test_configuration)
|
37
|
+
Application.stubs(:start)
|
38
|
+
Kernel.stubs(:exit)
|
39
|
+
Kernel.stubs(:puts)
|
40
|
+
}
|
41
|
+
|
42
42
|
subject { instance.execute! }
|
43
43
|
|
44
44
|
it 'returns 0 for successful execution' do
|
@@ -20,23 +20,23 @@ module Vedeu
|
|
20
20
|
before { described.reset! }
|
21
21
|
|
22
22
|
describe '.add_controller' do
|
23
|
-
let(:
|
23
|
+
let(:controller) {}
|
24
24
|
let(:klass) { "SomeController" }
|
25
25
|
|
26
|
-
subject { described.add_controller(
|
26
|
+
subject { described.add_controller(controller, klass) }
|
27
27
|
|
28
28
|
context 'when a name is not given' do
|
29
29
|
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'when a name is given' do
|
33
|
-
let(:
|
33
|
+
let(:controller) { :some_controller }
|
34
34
|
|
35
35
|
context 'when the controller is registered' do
|
36
|
-
before
|
37
|
-
described.add_controller(
|
38
|
-
described.add_action(
|
39
|
-
|
36
|
+
before {
|
37
|
+
described.add_controller(controller, '')
|
38
|
+
described.add_action(controller, :show_basket)
|
39
|
+
}
|
40
40
|
after { described.reset! }
|
41
41
|
|
42
42
|
it {
|
@@ -63,29 +63,29 @@ module Vedeu
|
|
63
63
|
end
|
64
64
|
|
65
65
|
describe '.add_action' do
|
66
|
-
let(:
|
67
|
-
let(:
|
66
|
+
let(:controller) {}
|
67
|
+
let(:action) {}
|
68
68
|
|
69
|
-
subject { described.add_action(
|
69
|
+
subject { described.add_action(controller, action) }
|
70
70
|
|
71
71
|
context 'when the controller is not given' do
|
72
|
-
let(:
|
72
|
+
let(:action) { :some_action }
|
73
73
|
|
74
74
|
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
75
75
|
end
|
76
76
|
|
77
77
|
context 'when the name is not given' do
|
78
|
-
let(:
|
78
|
+
let(:controller) { :some_controller }
|
79
79
|
|
80
80
|
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'when the controller and name is given' do
|
84
|
-
let(:
|
85
|
-
let(:
|
84
|
+
let(:controller) { :some_controller }
|
85
|
+
let(:action) { :some_action }
|
86
86
|
|
87
87
|
context 'when the controller is registered' do
|
88
|
-
before { described.add_controller(
|
88
|
+
before { described.add_controller(controller, 'SomeController') }
|
89
89
|
after { described.reset! }
|
90
90
|
|
91
91
|
it {
|
@@ -114,8 +114,8 @@ module Vedeu
|
|
114
114
|
end
|
115
115
|
|
116
116
|
describe '.goto' do
|
117
|
-
let(:
|
118
|
-
let(:
|
117
|
+
let(:controller) { :some_controller }
|
118
|
+
let(:action) { :some_action }
|
119
119
|
let(:args) {
|
120
120
|
{
|
121
121
|
customer_id: 7,
|
@@ -123,16 +123,16 @@ module Vedeu
|
|
123
123
|
}
|
124
124
|
}
|
125
125
|
|
126
|
-
subject { described.goto(
|
126
|
+
subject { described.goto(controller, action, **args) }
|
127
127
|
|
128
128
|
it { described.must_respond_to(:action) }
|
129
129
|
|
130
130
|
context 'when the controller is registered' do
|
131
131
|
context 'when the controller klass is defined' do
|
132
|
-
before
|
133
|
-
described.add_controller(
|
134
|
-
described.add_action(
|
135
|
-
|
132
|
+
before {
|
133
|
+
described.add_controller(controller, 'Vedeu::SomeController')
|
134
|
+
described.add_action(controller, action)
|
135
|
+
}
|
136
136
|
after { described.reset! }
|
137
137
|
|
138
138
|
it {
|
@@ -149,20 +149,20 @@ module Vedeu
|
|
149
149
|
end
|
150
150
|
|
151
151
|
context 'when the action is not defined for this controller' do
|
152
|
-
let(:
|
152
|
+
let(:action) { :undefined_action }
|
153
153
|
|
154
|
-
before
|
155
|
-
described.add_controller(
|
156
|
-
|
154
|
+
before {
|
155
|
+
described.add_controller(controller, 'Vedeu::SomeController')
|
156
|
+
}
|
157
157
|
|
158
158
|
it { proc { subject }.must_raise(Vedeu::ActionNotFound) }
|
159
159
|
end
|
160
160
|
|
161
161
|
context 'when the controller klass is not defined' do
|
162
|
-
before
|
163
|
-
described.add_controller(
|
164
|
-
described.add_action(
|
165
|
-
|
162
|
+
before {
|
163
|
+
described.add_controller(controller, '')
|
164
|
+
described.add_action(controller, action)
|
165
|
+
}
|
166
166
|
after { described.reset! }
|
167
167
|
|
168
168
|
it { proc { subject }.must_raise(Vedeu::MissingRequired) }
|
@@ -175,12 +175,12 @@ module Vedeu
|
|
175
175
|
end
|
176
176
|
|
177
177
|
describe '.registered' do
|
178
|
-
let(:
|
178
|
+
let(:controller) { :some_controller }
|
179
179
|
|
180
|
-
subject { described.registered?(
|
180
|
+
subject { described.registered?(controller) }
|
181
181
|
|
182
182
|
context 'when the controller is registered' do
|
183
|
-
before { described.add_controller(
|
183
|
+
before { described.add_controller(controller, "SomeController") }
|
184
184
|
after { described.reset! }
|
185
185
|
|
186
186
|
it { subject.must_equal(true) }
|