vedeu 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/all.rb +1 -1
  3. data/lib/vedeu/application/controller.rb +2 -2
  4. data/lib/vedeu/bindings.rb +1 -1
  5. data/lib/vedeu/bindings/application.rb +2 -2
  6. data/lib/vedeu/bindings/drb.rb +8 -8
  7. data/lib/vedeu/bindings/menus.rb +11 -11
  8. data/lib/vedeu/bindings/movement.rb +12 -12
  9. data/lib/vedeu/bindings/system.rb +18 -18
  10. data/lib/vedeu/bindings/visibility.rb +9 -9
  11. data/lib/vedeu/colours/colour.rb +1 -1
  12. data/lib/vedeu/common.rb +1 -1
  13. data/lib/vedeu/dsl/composition.rb +8 -3
  14. data/lib/vedeu/dsl/interface.rb +41 -17
  15. data/lib/vedeu/log/debug.rb +5 -1
  16. data/lib/vedeu/log/log.rb +1 -0
  17. data/lib/vedeu/models/interface.rb +3 -2
  18. data/lib/vedeu/plugins.rb +1 -1
  19. data/lib/vedeu/runtime/bootstrap.rb +0 -3
  20. data/lib/vedeu/runtime/launcher.rb +3 -2
  21. data/lib/vedeu/runtime/router.rb +49 -47
  22. data/lib/vedeu/{traps.rb → runtime/traps.rb} +0 -0
  23. data/lib/vedeu/templating/decoder.rb +4 -2
  24. data/lib/vedeu/templating/encoder.rb +4 -2
  25. data/lib/vedeu/templating/view_template.rb +35 -2
  26. data/lib/vedeu/version.rb +1 -1
  27. data/test/lib/vedeu/application/application_view_test.rb +1 -1
  28. data/test/lib/vedeu/application/controller_test.rb +4 -0
  29. data/test/lib/vedeu/bindings_test.rb +2 -0
  30. data/test/lib/vedeu/borders/border_test.rb +28 -40
  31. data/test/lib/vedeu/borders/borders_test.rb +0 -2
  32. data/test/lib/vedeu/borders/render_border_test.rb +11 -13
  33. data/test/lib/vedeu/buffers/buffer_test.rb +12 -5
  34. data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -2
  35. data/test/lib/vedeu/cli/generator/application_test.rb +9 -9
  36. data/test/lib/vedeu/cli/generator/view_test.rb +10 -7
  37. data/test/lib/vedeu/cli/main_test.rb +4 -4
  38. data/test/lib/vedeu/colours/colour_translator_test.rb +2 -4
  39. data/test/lib/vedeu/common_test.rb +8 -0
  40. data/test/lib/vedeu/configuration/configuration_test.rb +4 -4
  41. data/test/lib/vedeu/cursor/cursors_test.rb +4 -4
  42. data/test/lib/vedeu/cursor/move_test.rb +11 -8
  43. data/test/lib/vedeu/cursor/refresh_cursor_test.rb +12 -12
  44. data/test/lib/vedeu/cursor/reposition_test.rb +7 -11
  45. data/test/lib/vedeu/distributed/client_test.rb +4 -4
  46. data/test/lib/vedeu/distributed/server_test.rb +4 -5
  47. data/test/lib/vedeu/dsl/border_test.rb +2 -2
  48. data/test/lib/vedeu/dsl/composition_test.rb +5 -4
  49. data/test/lib/vedeu/dsl/geometry_test.rb +6 -4
  50. data/test/lib/vedeu/dsl/interface_test.rb +9 -27
  51. data/test/lib/vedeu/dsl/use_test.rb +2 -2
  52. data/test/lib/vedeu/events/trigger_test.rb +2 -2
  53. data/test/lib/vedeu/geometry/coordinate_test.rb +9 -9
  54. data/test/lib/vedeu/geometry/geometry_test.rb +8 -2
  55. data/test/lib/vedeu/geometry/position_validator_test.rb +11 -14
  56. data/test/lib/vedeu/input/input_test.rb +5 -5
  57. data/test/lib/vedeu/input/keymap_test.rb +2 -2
  58. data/test/lib/vedeu/log/timer_test.rb +2 -2
  59. data/test/lib/vedeu/models/focus_test.rb +20 -25
  60. data/test/lib/vedeu/models/interface_test.rb +2 -2
  61. data/test/lib/vedeu/models/interfaces_test.rb +7 -5
  62. data/test/lib/vedeu/models/line_test.rb +0 -5
  63. data/test/lib/vedeu/models/menu_test.rb +0 -2
  64. data/test/lib/vedeu/null/geometry_test.rb +1 -4
  65. data/test/lib/vedeu/output/clear/named_interface_test.rb +2 -2
  66. data/test/lib/vedeu/output/esc_test.rb +7 -4
  67. data/test/lib/vedeu/output/output_test.rb +3 -6
  68. data/test/lib/vedeu/output/refresh_test.rb +2 -2
  69. data/test/lib/vedeu/output/renderers/file_test.rb +1 -3
  70. data/test/lib/vedeu/output/renderers/html_test.rb +1 -3
  71. data/test/lib/vedeu/output/renderers/json_test.rb +1 -3
  72. data/test/lib/vedeu/output/renderers_test.rb +2 -2
  73. data/test/lib/vedeu/output/viewport_test.rb +70 -71
  74. data/test/lib/vedeu/repositories/model_test.rb +0 -19
  75. data/test/lib/vedeu/repositories/repository_test.rb +8 -8
  76. data/test/lib/vedeu/runtime/application_test.rb +2 -2
  77. data/test/lib/vedeu/runtime/launcher_test.rb +7 -7
  78. data/test/lib/vedeu/runtime/router_test.rb +33 -33
  79. data/test/lib/vedeu/{traps_test.rb → runtime/traps_test.rb} +2 -2
  80. data/test/lib/vedeu/templating/decoder_test.rb +1 -0
  81. data/test/lib/vedeu/templating/encoder_test.rb +1 -0
  82. data/test/lib/vedeu/templating/template_test.rb +8 -1
  83. data/test/lib/vedeu/templating/view_template_test.rb +108 -22
  84. data/test/lib/vedeu/terminal_mode_test.rb +2 -2
  85. data/test/lib/vedeu/terminal_test.rb +6 -6
  86. data/test/support/helpers/model_test_class.rb +19 -0
  87. metadata +5 -17
  88. data/test/support/templates/background.erb +0 -1
  89. data/test/support/templates/colour.erb +0 -1
  90. data/test/support/templates/foreground.erb +0 -1
  91. data/test/support/templates/multiple.erb +0 -2
  92. data/test/support/templates/plain.erb +0 -1
  93. 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 do
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 do
28
+ before {
32
29
  # Vedeu::Renderers::HTML.stubs(:to_file)
33
30
  Vedeu::VirtualBuffer.stubs(:retrieve).returns(virtual_buffer)
34
- end
31
+ }
35
32
 
36
33
  it {
37
34
  Vedeu.expects(:trigger).with(:_drb_store_output_, output)
@@ -6,9 +6,9 @@ module Vedeu
6
6
 
7
7
  let(:described) { Vedeu::Refresh }
8
8
 
9
- before { Vedeu.interfaces.reset }
10
-
11
9
  describe '.all' do
10
+ before { Vedeu.interfaces.reset }
11
+
12
12
  subject { described.all }
13
13
 
14
14
  it { subject.must_be_instance_of(Array) }
@@ -26,9 +26,7 @@ module Vedeu
26
26
  describe '#render' do
27
27
  let(:_time) { Time.new(2015, 4, 12, 20, 05, 00, "+01:00") }
28
28
 
29
- before do
30
- ::File.stubs(:write)
31
- end
29
+ before { ::File.stubs(:write) }
32
30
 
33
31
  subject { instance.render(output) }
34
32
 
@@ -17,9 +17,7 @@ module Vedeu
17
17
  let(:content) { [''] }
18
18
  let(:write_file) { false }
19
19
 
20
- before do
21
- ::File.stubs(:write)
22
- end
20
+ before { ::File.stubs(:write) }
23
21
 
24
22
  describe '#initialize' do
25
23
  it { instance.must_be_instance_of(described) }
@@ -11,9 +11,7 @@ module Vedeu
11
11
  let(:options) { {} }
12
12
  let(:output) {}
13
13
 
14
- before do
15
- ::File.stubs(:write)
16
- end
14
+ before { ::File.stubs(:write) }
17
15
 
18
16
  describe '#initialize' do
19
17
  it { instance.must_be_instance_of(described) }
@@ -57,10 +57,10 @@ module Vedeu
57
57
  describe '.render' do
58
58
  let(:output) {}
59
59
 
60
- before do
60
+ before {
61
61
  Vedeu::Renderers.reset
62
62
  Vedeu::Renderers.renderer(DummyRenderer)
63
- end
63
+ }
64
64
 
65
65
  subject { described.render(output) }
66
66
 
@@ -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 do
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
- end
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 do
62
+ before {
64
63
  interface.stubs(:cursor).returns(cursor)
65
- end
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;1Hb\n" \
108
- "\e[1;2Ha\n" \
109
- "\e[1;3Hr\n" \
110
- "\e[2;1Hc\n" \
111
- "\e[2;2Ha\n" \
112
- "\e[2;3Hr\n" \
113
- "\e[3;1Hh\n" \
114
- "\e[3;2He\n" \
115
- "\e[3;3Hl"
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;1Hb\n" \
128
- "\e[1;2Ha\n" \
129
- "\e[1;3Hr\n" \
130
- "\e[2;1Hc\n" \
131
- "\e[2;2Ha\n" \
132
- "\e[2;3Hr\n" \
133
- "\e[3;1Hh\n" \
134
- "\e[3;2He\n" \
135
- "\e[3;3Hl"
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;1Hb\n" \
147
- "\e[1;2Ha\n" \
148
- "\e[1;3Hr\n" \
149
- "\e[2;1Hc\n" \
150
- "\e[2;2Ha\n" \
151
- "\e[2;3Hr\n" \
152
- "\e[3;1Hh\n" \
153
- "\e[3;2He\n" \
154
- "\e[3;3Hl"
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;1Hb\n" \
168
- "\e[1;2Ha\n" \
169
- "\e[1;3Hr\n" \
170
- "\e[2;1Hc\n" \
171
- "\e[2;2Ha\n" \
172
- "\e[2;3Hr\n" \
173
- "\e[3;1Hh\n" \
174
- "\e[3;2He\n" \
175
- "\e[3;3Hl"
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;1Hb\n" \
187
- "\e[1;2Ha\n" \
188
- "\e[1;3Hr\n" \
189
- "\e[2;1Hc\n" \
190
- "\e[2;2Ha\n" \
191
- "\e[2;3Hr\n" \
192
- "\e[3;1Hh\n" \
193
- "\e[3;2He\n" \
194
- "\e[3;3Hl"
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;1Hb\n" \
208
- "\e[1;2Ha\n" \
209
- "\e[1;3Hr\n" \
210
- "\e[2;1Hc\n" \
211
- "\e[2;2Ha\n" \
212
- "\e[2;3Hr\n" \
213
- "\e[3;1Hh\n" \
214
- "\e[3;2He\n" \
215
- "\e[3;3Hl"
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;1Hb\n" \
227
- "\e[1;2Ha\n" \
228
- "\e[1;3Hr\n" \
229
- "\e[2;1Hc\n" \
230
- "\e[2;2Ha\n" \
231
- "\e[2;3Hr\n" \
232
- "\e[3;1Hh\n" \
233
- "\e[3;2He\n" \
234
- "\e[3;3Hl"
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 do
193
+ before {
194
194
  Vedeu.interface('hydrogen') {}
195
195
  Vedeu.interface('helium') {}
196
- end
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 do
242
+ before {
243
243
  instance.reset
244
244
  instance.store(Vedeu::TestModel.new('zinc'))
245
- end
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 do
251
+ before {
252
252
  instance.reset
253
253
  instance.store(Vedeu::TestModel.new('gadolinium'))
254
254
  instance.store(Vedeu::TestModel.new('francium'))
255
- end
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 do
11
+ before {
12
12
  configuration.stubs(:drb?).returns(false)
13
13
  Terminal.stubs(:open).returns([''])
14
- end
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(:controller_name) {}
23
+ let(:controller) {}
24
24
  let(:klass) { "SomeController" }
25
25
 
26
- subject { described.add_controller(controller_name, klass) }
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(:controller_name) { :some_controller }
33
+ let(:controller) { :some_controller }
34
34
 
35
35
  context 'when the controller is registered' do
36
- before do
37
- described.add_controller(controller_name, '')
38
- described.add_action(controller_name, :show_basket)
39
- end
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(:controller_name) {}
67
- let(:action_name) {}
66
+ let(:controller) {}
67
+ let(:action) {}
68
68
 
69
- subject { described.add_action(controller_name, action_name) }
69
+ subject { described.add_action(controller, action) }
70
70
 
71
71
  context 'when the controller is not given' do
72
- let(:action_name) { :some_action }
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(:controller_name) { :some_controller }
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(:controller_name) { :some_controller }
85
- let(:action_name) { :some_action }
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(controller_name, 'SomeController') }
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(:controller_name) { :some_controller }
118
- let(:action_name) { :some_action }
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(controller_name, action_name, **args) }
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 do
133
- described.add_controller(controller_name, 'Vedeu::SomeController')
134
- described.add_action(controller_name, action_name)
135
- end
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(:action_name) { :undefined_action }
152
+ let(:action) { :undefined_action }
153
153
 
154
- before do
155
- described.add_controller(controller_name, 'Vedeu::SomeController')
156
- end
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 do
163
- described.add_controller(controller_name, '')
164
- described.add_action(controller_name, action_name)
165
- end
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(:controller_name) { :some_controller }
178
+ let(:controller) { :some_controller }
179
179
 
180
- subject { described.registered?(controller_name) }
180
+ subject { described.registered?(controller) }
181
181
 
182
182
  context 'when the controller is registered' do
183
- before { described.add_controller(controller_name, "SomeController") }
183
+ before { described.add_controller(controller, "SomeController") }
184
184
  after { described.reset! }
185
185
 
186
186
  it { subject.must_equal(true) }