vedeu 0.0.25 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -9
- data/Rakefile +0 -10
- data/bin/composition +1 -1
- data/examples/single_interface_app.rb +7 -4
- data/lib/vedeu.rb +19 -48
- data/lib/vedeu/application.rb +8 -7
- data/lib/vedeu/configuration.rb +4 -4
- data/lib/vedeu/input/input.rb +3 -0
- data/lib/vedeu/launcher.rb +3 -0
- data/lib/vedeu/models/background.rb +13 -0
- data/lib/vedeu/models/coercions.rb +21 -0
- data/lib/vedeu/models/colour.rb +22 -0
- data/lib/vedeu/{repository → models}/command.rb +2 -0
- data/lib/vedeu/models/composition.rb +30 -0
- data/lib/vedeu/models/foreground.rb +13 -0
- data/lib/vedeu/models/interface.rb +62 -0
- data/lib/vedeu/models/interface_collection.rb +24 -0
- data/lib/vedeu/models/line.rb +22 -0
- data/lib/vedeu/models/line_collection.rb +27 -0
- data/lib/vedeu/models/presentation.rb +13 -0
- data/lib/vedeu/models/stream.rb +21 -0
- data/lib/vedeu/models/stream_collection.rb +27 -0
- data/lib/vedeu/models/style_collection.rb +23 -0
- data/lib/vedeu/output/interface_renderer.rb +62 -0
- data/lib/vedeu/output/output.rb +6 -5
- data/lib/vedeu/process/process.rb +15 -31
- data/lib/vedeu/repository/command_repository.rb +13 -14
- data/lib/vedeu/repository/interface_repository.rb +12 -13
- data/lib/vedeu/repository/repository.rb +2 -0
- data/lib/vedeu/{output → support}/cursor.rb +2 -0
- data/lib/vedeu/support/esc.rb +112 -0
- data/lib/vedeu/support/events.rb +21 -0
- data/lib/vedeu/support/geometry.rb +66 -0
- data/lib/vedeu/support/parser.rb +27 -0
- data/lib/vedeu/support/terminal.rb +31 -134
- data/lib/vedeu/{output → support}/translator.rb +12 -8
- data/lib/vedeu/{output → support}/wordwrap.rb +2 -4
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application_test.rb +7 -2
- data/test/lib/vedeu/configuration_test.rb +13 -8
- data/test/lib/vedeu/input/input_test.rb +2 -1
- data/test/lib/vedeu/launcher_test.rb +7 -2
- data/test/lib/vedeu/models/background_test.rb +35 -0
- data/test/lib/vedeu/models/colour_test.rb +71 -0
- data/test/lib/vedeu/models/command_test.rb +109 -0
- data/test/lib/vedeu/models/composition_test.rb +187 -0
- data/test/lib/vedeu/models/foreground_test.rb +35 -0
- data/test/lib/vedeu/models/interface_collection_test.rb +57 -0
- data/test/lib/vedeu/models/interface_test.rb +220 -0
- data/test/lib/vedeu/models/line_collection_test.rb +69 -0
- data/test/lib/vedeu/models/line_test.rb +76 -0
- data/test/lib/vedeu/models/presentation_test.rb +8 -0
- data/test/lib/vedeu/models/stream_collection_test.rb +57 -0
- data/test/lib/vedeu/models/stream_test.rb +76 -0
- data/test/lib/vedeu/models/style_collection_test.rb +22 -0
- data/test/lib/vedeu/output/interface_renderer_test.rb +12 -0
- data/test/lib/vedeu/output/output_test.rb +15 -30
- data/test/lib/vedeu/process/process_test.rb +22 -44
- data/test/lib/vedeu/repository/command_repository_test.rb +22 -16
- data/test/lib/vedeu/repository/interface_repository_test.rb +62 -14
- data/test/lib/vedeu/repository/repository_test.rb +1 -0
- data/test/lib/vedeu/repository/storage_test.rb +13 -6
- data/test/lib/vedeu/{output → support}/cursor_test.rb +1 -0
- data/test/lib/vedeu/support/esc_test.rb +348 -0
- data/test/lib/vedeu/support/events_test.rb +37 -0
- data/test/lib/vedeu/support/exit_test.rb +1 -0
- data/test/lib/vedeu/support/geometry_test.rb +131 -0
- data/test/lib/vedeu/support/parser_test.rb +56 -0
- data/test/lib/vedeu/support/queue_test.rb +1 -0
- data/test/lib/vedeu/support/terminal_test.rb +1 -119
- data/test/lib/vedeu/{output → support}/translator_test.rb +17 -12
- data/test/lib/vedeu/{output → support}/wordwrap_test.rb +1 -0
- data/test/lib/vedeu/version_test.rb +1 -0
- data/test/lib/vedeu_test.rb +1 -0
- data/{lib/vedeu/repository → test/support}/dummy_command.rb +0 -0
- data/{lib/vedeu/repository → test/support}/dummy_interface.rb +0 -0
- data/test/support/json/int1_lin1_str1.json +10 -0
- data/test/support/json/int1_lin1_str3.json +18 -0
- data/test/support/json/int1_lin2_str1.json +17 -0
- data/test/support/json/int1_lin2_str3.json +33 -0
- data/test/support/json/int1_lin2_str3_styles.json +43 -0
- data/test/support/json/int2_lin1_str1.json +20 -0
- data/test/support/json/int2_lin1_str3.json +36 -0
- data/test/support/json/int2_lin2_str1.json +34 -0
- data/test/support/json/int2_lin2_str3.json +66 -0
- data/test/support/json/int2_lin2_str3_styles.json +158 -0
- data/test/support/output_1.json +9 -0
- data/test/support/output_1.rb +14 -0
- data/test/support/output_2.json +1 -0
- data/test/support/output_2.rb +19 -0
- data/test/test_helper.rb +0 -2
- data/vedeu.gemspec +0 -3
- metadata +98 -150
- data/config/cucumber.yml +0 -8
- data/documentation/composition.ebnf +0 -7
- data/documentation/diagram/ColourDirective.png +0 -0
- data/documentation/diagram/Directive.png +0 -0
- data/documentation/diagram/Interface.png +0 -0
- data/documentation/diagram/Output.png +0 -0
- data/documentation/diagram/PositionDirective.png +0 -0
- data/documentation/diagram/Stream.png +0 -0
- data/documentation/diagram/StyleDirective.png +0 -0
- data/documentation/diagram/rr-1.35.837.png +0 -0
- data/documentation/index.html +0 -325
- data/features/getting_started.feature +0 -10
- data/features/step_definitions/vedeu_steps.rb +0 -11
- data/features/support/env.rb +0 -12
- data/lib/vedeu/output/background.rb +0 -27
- data/lib/vedeu/output/base.rb +0 -57
- data/lib/vedeu/output/buffer/composition.rb +0 -24
- data/lib/vedeu/output/buffer/formatting.rb +0 -25
- data/lib/vedeu/output/buffer/interface.rb +0 -14
- data/lib/vedeu/output/buffer/line.rb +0 -14
- data/lib/vedeu/output/buffer/stream.rb +0 -14
- data/lib/vedeu/output/buffer/style.rb +0 -11
- data/lib/vedeu/output/colour.rb +0 -39
- data/lib/vedeu/output/compositor.rb +0 -72
- data/lib/vedeu/output/directive.rb +0 -63
- data/lib/vedeu/output/esc.rb +0 -61
- data/lib/vedeu/output/foreground.rb +0 -27
- data/lib/vedeu/output/geometry.rb +0 -71
- data/lib/vedeu/output/layer.rb +0 -9
- data/lib/vedeu/output/menu.rb +0 -26
- data/lib/vedeu/output/position.rb +0 -35
- data/lib/vedeu/output/style.rb +0 -38
- data/lib/vedeu/repository/interface.rb +0 -62
- data/lib/vedeu/support/json_parser.rb +0 -25
- data/lib/vedeu/support/options.rb +0 -4
- data/test/lib/vedeu/output/background_test.rb +0 -67
- data/test/lib/vedeu/output/base_test.rb +0 -8
- data/test/lib/vedeu/output/buffer/composition_test.rb +0 -57
- data/test/lib/vedeu/output/buffer/formatting_test.rb +0 -9
- data/test/lib/vedeu/output/buffer/interface_test.rb +0 -38
- data/test/lib/vedeu/output/buffer/line_test.rb +0 -64
- data/test/lib/vedeu/output/buffer/stream_test.rb +0 -61
- data/test/lib/vedeu/output/buffer/style_test.rb +0 -8
- data/test/lib/vedeu/output/colour_test.rb +0 -104
- data/test/lib/vedeu/output/compositor_test.rb +0 -247
- data/test/lib/vedeu/output/directive_test.rb +0 -82
- data/test/lib/vedeu/output/esc_test.rb +0 -175
- data/test/lib/vedeu/output/foreground_test.rb +0 -67
- data/test/lib/vedeu/output/geometry_test.rb +0 -190
- data/test/lib/vedeu/output/layer_test.rb +0 -35
- data/test/lib/vedeu/output/menu_test.rb +0 -13
- data/test/lib/vedeu/output/position_test.rb +0 -48
- data/test/lib/vedeu/output/style_test.rb +0 -132
- data/test/lib/vedeu/repository/command_test.rb +0 -73
- data/test/lib/vedeu/repository/dummy_command_test.rb +0 -27
- data/test/lib/vedeu/repository/dummy_interface_test.rb +0 -7
- data/test/lib/vedeu/repository/interface_test.rb +0 -79
- data/test/lib/vedeu/support/json_parser_test.rb +0 -45
- data/test/support/composition.json +0 -47
- data/test/support/composition.rb +0 -5
- data/test/support/composition.xml +0 -36
- data/test/support/multi_interface.json +0 -34
- data/test/support/single_interface.json +0 -19
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
require_relative '../../../../lib/vedeu/support/events'
|
3
|
+
|
4
|
+
module Vedeu
|
5
|
+
describe Events do
|
6
|
+
let(:described_class) { Events }
|
7
|
+
let(:described_instance) { described_class.new }
|
8
|
+
|
9
|
+
describe '#initialize' do
|
10
|
+
let(:subject) { described_instance }
|
11
|
+
|
12
|
+
it 'returns an Events instance' do
|
13
|
+
subject.must_be_instance_of(Events)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'sets an instance variable' do
|
17
|
+
subject.instance_variable_get('@handlers')
|
18
|
+
.must_be_instance_of(Hash)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#on' do
|
23
|
+
let(:subject) { described_instance.on(event) { :do_something } }
|
24
|
+
let(:event) { :some_event }
|
25
|
+
|
26
|
+
it 'returns the handlers value' do
|
27
|
+
subject.must_be_instance_of(Array)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#trigger' do
|
32
|
+
let(:subject) { described_instance.trigger(event, args) }
|
33
|
+
let(:event) { :some_event }
|
34
|
+
let(:args) {}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
require_relative '../../../../lib/vedeu/support/geometry'
|
3
|
+
require_relative '../../../../lib/vedeu/models/interface'
|
4
|
+
|
5
|
+
module Vedeu
|
6
|
+
describe Geometry do
|
7
|
+
let(:described_class) { Geometry }
|
8
|
+
let(:described_instance) { described_class.new(interface, index) }
|
9
|
+
let(:interface) { Interface.new(attributes) }
|
10
|
+
let(:attributes) {
|
11
|
+
{
|
12
|
+
name: 'dummy',
|
13
|
+
lines: [],
|
14
|
+
colour: {
|
15
|
+
foreground: '#ff0000',
|
16
|
+
background: '#000000'
|
17
|
+
},
|
18
|
+
width: 7,
|
19
|
+
height: 3
|
20
|
+
}
|
21
|
+
}
|
22
|
+
let(:index) { 0 }
|
23
|
+
|
24
|
+
before do
|
25
|
+
Terminal.stubs(:width).returns(40)
|
26
|
+
Terminal.stubs(:height).returns(25)
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#origin' do
|
30
|
+
it 'returns a String' do
|
31
|
+
described_instance.origin.must_be_instance_of(String)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns the origin for the interface' do
|
35
|
+
described_instance.origin.must_equal("\e[1;1H")
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when the index is provided' do
|
39
|
+
let(:index) { 3 }
|
40
|
+
|
41
|
+
it 'returns the line position relative to the origin' do
|
42
|
+
described_instance.origin.must_equal("\e[4;1H")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when the interface is at a custom position' do
|
47
|
+
let(:attributes) { { y: 6, x: 3 }}
|
48
|
+
|
49
|
+
it 'returns the origin for the interface' do
|
50
|
+
described_instance.origin.must_equal("\e[6;3H")
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when the index is provided' do
|
54
|
+
let(:index) { 3 }
|
55
|
+
|
56
|
+
it 'returns the line position relative to the origin' do
|
57
|
+
described_instance.origin.must_equal("\e[9;3H")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#max_y' do
|
64
|
+
let(:subject) { described_instance.max_y }
|
65
|
+
|
66
|
+
it 'returns a Fixnum' do
|
67
|
+
subject.must_be_instance_of(Fixnum)
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'when the value is greater than the available terminal size' do
|
71
|
+
it 'clips the value to the terminal size' do
|
72
|
+
subject.must_equal(4)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'when the value is less than the available size' do
|
77
|
+
let(:attributes) { { y: 20, height: 4 } }
|
78
|
+
|
79
|
+
it 'returns the value' do
|
80
|
+
subject.must_equal(24)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#max_x' do
|
86
|
+
let(:subject) { described_instance.max_x }
|
87
|
+
|
88
|
+
it 'returns a Fixnum' do
|
89
|
+
subject.must_be_instance_of(Fixnum)
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'when the value is greater than the available terminal size' do
|
93
|
+
it 'clips the value to the terminal size' do
|
94
|
+
subject.must_equal(8)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'when the value is less than the available size' do
|
99
|
+
let(:attributes) { { x: 17, width: 21 } }
|
100
|
+
|
101
|
+
it 'returns the value' do
|
102
|
+
subject.must_equal(38)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe '#virtual_x' do
|
108
|
+
let(:subject) { described_instance.virtual_x }
|
109
|
+
|
110
|
+
it 'returns a Fixnum' do
|
111
|
+
subject.must_be_instance_of(Fixnum)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'returns the value' do
|
115
|
+
subject.must_equal(1)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe '#virtual_y' do
|
120
|
+
let(:subject) { described_instance.virtual_y }
|
121
|
+
|
122
|
+
it 'returns a Fixnum' do
|
123
|
+
subject.must_be_instance_of(Fixnum)
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'returns the value' do
|
127
|
+
subject.must_equal(1)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
require_relative '../../../../lib/vedeu/support/parser'
|
3
|
+
|
4
|
+
module Vedeu
|
5
|
+
describe Parser do
|
6
|
+
let(:described_class) { Parser }
|
7
|
+
let(:subject) { described_class.new(output) }
|
8
|
+
let(:output) { File.read('test/support/output_1.json') }
|
9
|
+
|
10
|
+
describe '#initialize' do
|
11
|
+
let(:subject) { described_class.new(output) }
|
12
|
+
|
13
|
+
it 'returns a Parser instance' do
|
14
|
+
subject.must_be_instance_of(Parser)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'sets an instance variable' do
|
18
|
+
subject.instance_variable_get("@output").must_equal(output)
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'when the instance variable is nil' do
|
22
|
+
let(:output) {}
|
23
|
+
|
24
|
+
it 'set the instance variable to empty string' do
|
25
|
+
subject.instance_variable_get("@output").must_equal('')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# describe '#parse' do
|
31
|
+
# let(:subject) { described_class.parse(output) }
|
32
|
+
|
33
|
+
# it 'returns a Composition' do
|
34
|
+
# subject.must_be_instance_of(Composition)
|
35
|
+
# end
|
36
|
+
|
37
|
+
# context 'when the output is an interface name and a stream' do
|
38
|
+
# it 'returns a composition' do
|
39
|
+
# subject.must_equal('')
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# context 'when the output contains a single interface' do
|
44
|
+
# it 'returns a Composition instance' do
|
45
|
+
# subject.must_be_instance_of(Composition)
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
|
49
|
+
# context 'when the output contains multiple interfaces' do
|
50
|
+
# it 'returns a Composition instance' do
|
51
|
+
# subject.must_be_instance_of(Composition)
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
|
+
require_relative '../../../../lib/vedeu/support/terminal'
|
2
3
|
|
3
4
|
module Vedeu
|
4
5
|
describe Terminal do
|
@@ -81,36 +82,6 @@ module Vedeu
|
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
84
|
-
describe '.close' do
|
85
|
-
let(:subject) { described_class.close }
|
86
|
-
|
87
|
-
it 'returns a String' do
|
88
|
-
subject.must_be_instance_of(String)
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'returns an escape sequence' do
|
92
|
-
subject.must_equal("\e[24;1H \e[24;1H")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '.cooked' do
|
97
|
-
let(:subject) { described_class.cooked(instance) }
|
98
|
-
let(:instance) {}
|
99
|
-
|
100
|
-
it 'returns a NilClass' do
|
101
|
-
subject.must_be_instance_of(NilClass)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe '.raw' do
|
106
|
-
let(:subject) { described_class.raw(instance) }
|
107
|
-
let(:instance) {}
|
108
|
-
|
109
|
-
it 'returns a NilClass' do
|
110
|
-
subject.must_be_instance_of(NilClass)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
85
|
describe '.console' do
|
115
86
|
let(:subject) { described_class.console }
|
116
87
|
|
@@ -118,94 +89,5 @@ module Vedeu
|
|
118
89
|
subject.must_equal(console)
|
119
90
|
end
|
120
91
|
end
|
121
|
-
|
122
|
-
describe '.clear_screen' do
|
123
|
-
let(:subject) { described_class.clear_screen }
|
124
|
-
|
125
|
-
it 'returns a String' do
|
126
|
-
subject.must_be_instance_of(String)
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'returns an escape sequence' do
|
130
|
-
subject.must_equal("\e[2J")
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '.clear_line' do
|
135
|
-
let(:subject) { described_class.clear_line(index) }
|
136
|
-
let(:index) { 0 }
|
137
|
-
|
138
|
-
it 'returns a String' do
|
139
|
-
subject.must_be_instance_of(String)
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'returns an escape sequence' do
|
143
|
-
subject.must_equal("\e[1;1H \e[1;1H")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe '.show_cursor' do
|
148
|
-
let(:subject) { described_class.show_cursor }
|
149
|
-
|
150
|
-
it 'returns a String' do
|
151
|
-
subject.must_be_instance_of(String)
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'returns an escape sequence' do
|
155
|
-
subject.must_equal("\e[?25h")
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
describe '.hide_cursor' do
|
160
|
-
let(:subject) { described_class.hide_cursor }
|
161
|
-
|
162
|
-
it 'returns a String' do
|
163
|
-
subject.must_be_instance_of(String)
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'returns an escape sequence' do
|
167
|
-
subject.must_equal("\e[?25l")
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe '.reset_colours' do
|
172
|
-
let(:subject) { described_class.reset_colours }
|
173
|
-
|
174
|
-
it 'returns a String' do
|
175
|
-
subject.must_be_instance_of(String)
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'returns an escape sequence' do
|
179
|
-
subject.must_equal("\e[0m")
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
describe '#initialize' do
|
184
|
-
let(:subject) { described_class.new }
|
185
|
-
|
186
|
-
it 'returns a Terminal instance' do
|
187
|
-
subject.must_be_instance_of(Terminal)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe '#open' do
|
192
|
-
let(:subject) { described_class.new.open }
|
193
|
-
|
194
|
-
it 'returns a NilClass' do
|
195
|
-
subject.must_be_instance_of(NilClass)
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
describe '#initial_setup!' do
|
200
|
-
let(:subject) { described_class.new.initial_setup! }
|
201
|
-
|
202
|
-
it 'returns a String' do
|
203
|
-
subject.must_be_instance_of(String)
|
204
|
-
end
|
205
|
-
|
206
|
-
it 'returns an escape sequence' do
|
207
|
-
subject.must_equal("\e[1;1H")
|
208
|
-
end
|
209
|
-
end
|
210
92
|
end
|
211
93
|
end
|
@@ -1,12 +1,17 @@
|
|
1
1
|
require_relative '../../../test_helper'
|
2
|
+
require_relative '../../../../lib/vedeu/support/translator'
|
2
3
|
|
3
4
|
module Vedeu
|
4
5
|
describe Translator do
|
5
6
|
let(:described_class) { Translator }
|
6
7
|
let(:html_colour) {}
|
7
8
|
|
8
|
-
|
9
|
-
described_class.new(html_colour)
|
9
|
+
describe '#initialize' do
|
10
|
+
let(:subject) { described_class.new(html_colour) }
|
11
|
+
|
12
|
+
it 'returns a Translator instance' do
|
13
|
+
subject.must_be_instance_of(Translator)
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
describe '#translate' do
|
@@ -28,24 +33,24 @@ module Vedeu
|
|
28
33
|
end
|
29
34
|
|
30
35
|
context 'invalid' do
|
31
|
-
it 'returns
|
32
|
-
described_class.translate.must_equal(
|
36
|
+
it 'returns empty string when not present' do
|
37
|
+
described_class.translate.must_equal('')
|
33
38
|
end
|
34
39
|
|
35
|
-
it 'returns
|
36
|
-
described_class.translate(:wrong_type).must_equal(
|
40
|
+
it 'returns empty string when the wrong type!' do
|
41
|
+
described_class.translate(:wrong_type).must_equal('')
|
37
42
|
end
|
38
43
|
|
39
|
-
it 'returns
|
40
|
-
described_class.translate('345678').must_equal(
|
44
|
+
it 'returns empty string when invalid format' do
|
45
|
+
described_class.translate('345678').must_equal('')
|
41
46
|
end
|
42
47
|
|
43
|
-
it 'returns
|
44
|
-
described_class.translate('#h11111').must_equal(
|
48
|
+
it 'returns empty string when invalid format' do
|
49
|
+
described_class.translate('#h11111').must_equal('')
|
45
50
|
end
|
46
51
|
|
47
|
-
it 'returns
|
48
|
-
described_class.translate('#1111').must_equal(
|
52
|
+
it 'returns empty string when invalid format' do
|
53
|
+
described_class.translate('#1111').must_equal('')
|
49
54
|
end
|
50
55
|
end
|
51
56
|
end
|