vedeu 0.6.1 → 0.6.2
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 +2 -13
- data/lib/vedeu/api.rb +9 -9
- data/lib/vedeu/application/application_view.rb +3 -5
- data/lib/vedeu/bindings/bindings.rb +5 -1
- data/lib/vedeu/bindings/focus.rb +0 -5
- data/lib/vedeu/bindings/refresh.rb +0 -5
- data/lib/vedeu/bindings/system.rb +1 -6
- data/lib/vedeu/colours/all.rb +17 -0
- data/lib/vedeu/colours/background.rb +32 -28
- data/lib/vedeu/colours/backgrounds.rb +13 -9
- data/lib/vedeu/colours/colour.rb +106 -102
- data/lib/vedeu/colours/foreground.rb +32 -28
- data/lib/vedeu/colours/foregrounds.rb +13 -9
- data/lib/vedeu/colours/repository.rb +70 -0
- data/lib/vedeu/colours/translator.rb +267 -0
- data/lib/vedeu/configuration/api.rb +10 -7
- data/lib/vedeu/configuration/configuration.rb +2 -1
- data/lib/vedeu/dsl/border.rb +15 -2
- data/lib/vedeu/dsl/composition.rb +6 -4
- data/lib/vedeu/dsl/geometry.rb +14 -7
- data/lib/vedeu/dsl/group.rb +2 -2
- data/lib/vedeu/dsl/interface.rb +5 -3
- data/lib/vedeu/dsl/keymap.rb +9 -7
- data/lib/vedeu/dsl/line.rb +7 -4
- data/lib/vedeu/dsl/menu.rb +3 -0
- data/lib/vedeu/dsl/presentation.rb +20 -10
- data/lib/vedeu/dsl/shared.rb +4 -4
- data/lib/vedeu/dsl/stream.rb +2 -2
- data/lib/vedeu/dsl/text.rb +11 -5
- data/lib/vedeu/dsl/use.rb +2 -2
- data/lib/vedeu/dsl/view.rb +8 -6
- data/lib/vedeu/events/aliases.rb +91 -0
- data/lib/vedeu/events/all.rb +15 -0
- data/lib/vedeu/events/collection.rb +13 -0
- data/lib/vedeu/events/event.rb +244 -239
- data/lib/vedeu/events/repository.rb +30 -0
- data/lib/vedeu/events/trigger.rb +68 -64
- data/lib/vedeu/exceptions.rb +65 -54
- data/lib/vedeu/geometry/coordinate.rb +3 -1
- data/lib/vedeu/geometry/grid.rb +2 -4
- data/lib/vedeu/input/editor/all.rb +2 -1
- data/lib/vedeu/input/editor/{virtual_cursor.rb → cursor.rb} +10 -10
- data/lib/vedeu/input/editor/document.rb +7 -7
- data/lib/vedeu/input/editor/insert.rb +70 -0
- data/lib/vedeu/input/editor/line.rb +4 -16
- data/lib/vedeu/input/editor/lines.rb +2 -16
- data/lib/vedeu/input/input_translator.rb +2 -2
- data/lib/vedeu/input/key.rb +2 -2
- data/lib/vedeu/internal_api.rb +6 -6
- data/lib/vedeu/log/lockless_log_device.rb +0 -74
- data/lib/vedeu/models/focus.rb +3 -3
- data/lib/vedeu/models/interface.rb +3 -3
- data/lib/vedeu/models/menu.rb +2 -2
- 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 +6 -7
- data/lib/vedeu/output/presentation/colour.rb +23 -21
- data/lib/vedeu/output/renderers/renderer_options.rb +2 -4
- data/lib/vedeu/output/text.rb +1 -1
- data/lib/vedeu/output/wordwrap.rb +18 -7
- data/lib/vedeu/plugins/plugin.rb +2 -2
- data/lib/vedeu/refresh/refresh_buffer.rb +3 -3
- data/lib/vedeu/refresh/refresh_group.rb +3 -3
- data/lib/vedeu/repositories/repository.rb +7 -6
- data/lib/vedeu/runtime/application.rb +1 -1
- data/lib/vedeu/runtime/main_loop.rb +3 -3
- data/lib/vedeu/runtime/router.rb +14 -11
- data/lib/vedeu/templating/helpers.rb +5 -5
- data/lib/vedeu/templating/template.rb +4 -4
- 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/application/application_view_test.rb +1 -1
- data/test/lib/vedeu/colours/background_test.rb +93 -89
- data/test/lib/vedeu/colours/backgrounds_test.rb +11 -7
- data/test/lib/vedeu/colours/colour_test.rb +155 -151
- data/test/lib/vedeu/colours/foreground_test.rb +93 -89
- data/test/lib/vedeu/colours/foregrounds_test.rb +11 -7
- data/test/lib/vedeu/colours/repository_test.rb +97 -0
- data/test/lib/vedeu/colours/translator_test.rb +173 -0
- data/test/lib/vedeu/configuration/api_test.rb +4 -4
- data/test/lib/vedeu/dsl/border_test.rb +12 -0
- data/test/lib/vedeu/dsl/composition_test.rb +3 -3
- data/test/lib/vedeu/dsl/geometry_test.rb +11 -0
- data/test/lib/vedeu/dsl/group_test.rb +2 -2
- data/test/lib/vedeu/dsl/interface_test.rb +4 -4
- data/test/lib/vedeu/dsl/keymap_test.rb +8 -4
- data/test/lib/vedeu/dsl/line_test.rb +6 -3
- data/test/lib/vedeu/dsl/menu_test.rb +6 -0
- data/test/lib/vedeu/dsl/presentation_test.rb +16 -3
- data/test/lib/vedeu/dsl/stream_test.rb +1 -1
- data/test/lib/vedeu/dsl/text_test.rb +7 -0
- data/test/lib/vedeu/dsl/view_test.rb +3 -3
- data/test/lib/vedeu/events/aliases_test.rb +144 -0
- data/test/lib/vedeu/events/collection_test.rb +22 -0
- data/test/lib/vedeu/events/event_test.rb +84 -80
- data/test/lib/vedeu/events/repository_test.rb +28 -0
- data/test/lib/vedeu/events/trigger_test.rb +41 -37
- data/test/lib/vedeu/geometry/grid_test.rb +4 -4
- data/test/lib/vedeu/input/editor/{virtual_cursor_test.rb → cursor_test.rb} +3 -3
- data/test/lib/vedeu/input/editor/insert_test.rb +36 -0
- data/test/lib/vedeu/input/key_test.rb +1 -1
- data/test/lib/vedeu/models/cell_test.rb +1 -1
- data/test/lib/vedeu/models/focus_test.rb +4 -2
- data/test/lib/vedeu/models/menu_test.rb +1 -1
- data/test/lib/vedeu/models/views/char_test.rb +8 -4
- data/test/lib/vedeu/models/views/line_test.rb +4 -4
- data/test/lib/vedeu/models/views/stream_test.rb +3 -3
- data/test/lib/vedeu/models/views/view_test.rb +1 -1
- data/test/lib/vedeu/output/html_char_test.rb +4 -2
- data/test/lib/vedeu/output/presentation/colour_test.rb +5 -5
- data/test/lib/vedeu/output/presentation_test.rb +4 -4
- data/test/lib/vedeu/output/renderers/json_test.rb +4 -2
- data/test/lib/vedeu/plugins/plugin_test.rb +1 -1
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +1 -1
- data/test/lib/vedeu/refresh/refresh_group_test.rb +1 -1
- data/test/lib/vedeu/repositories/repository_test.rb +2 -2
- data/test/lib/vedeu/runtime/router_test.rb +6 -6
- data/test/lib/vedeu/templating/decoder_test.rb +2 -3
- data/test/lib/vedeu/templating/encoder_test.rb +2 -3
- data/test/lib/vedeu/templating/helpers_test.rb +6 -6
- data/test/lib/vedeu/templating/template_test.rb +2 -2
- data/test/lib/vedeu/templating/view_template_test.rb +13 -7
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -3
- metadata +24 -19
- data/lib/vedeu/colours/colour_translator.rb +0 -260
- data/lib/vedeu/colours/colours.rb +0 -66
- data/lib/vedeu/events/event_aliases.rb +0 -87
- data/lib/vedeu/events/event_collection.rb +0 -9
- data/lib/vedeu/events/events.rb +0 -26
- data/test/lib/vedeu/colours/colour_translator_test.rb +0 -169
- data/test/lib/vedeu/colours/colours_test.rb +0 -93
- data/test/lib/vedeu/events/event_aliases_test.rb +0 -140
- data/test/lib/vedeu/events/event_collection_test.rb +0 -18
- data/test/lib/vedeu/events/events_test.rb +0 -24
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Events
|
6
|
+
|
7
|
+
describe Collection do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Events::Collection }
|
10
|
+
let(:instance) { described.new }
|
11
|
+
|
12
|
+
it { described.superclass.must_equal(Vedeu::Collection) }
|
13
|
+
|
14
|
+
describe '#initialize' do
|
15
|
+
it { instance.must_be_instance_of(described) }
|
16
|
+
end
|
17
|
+
|
18
|
+
end # Collection
|
19
|
+
|
20
|
+
end # Events
|
21
|
+
|
22
|
+
end # Vedeu
|
@@ -2,108 +2,112 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Events
|
6
6
|
|
7
|
-
|
8
|
-
let(:instance) { described.new(event_name, closure, options) }
|
9
|
-
let(:event_name) { :some_event }
|
10
|
-
let(:closure) { proc { :event_triggered } }
|
11
|
-
let(:options) { {} }
|
7
|
+
describe Event do
|
12
8
|
|
13
|
-
|
14
|
-
|
9
|
+
let(:described) { Vedeu::Events::Event }
|
10
|
+
let(:instance) { described.new(event_name, closure, options) }
|
11
|
+
let(:event_name) { :some_event }
|
12
|
+
let(:closure) { proc { :event_triggered } }
|
13
|
+
let(:options) { {} }
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
it { subject.must_be_instance_of(TrueClass) }
|
19
|
-
end
|
15
|
+
describe '.bind' do
|
16
|
+
subject { described.bind(event_name, options) { :event_triggered } }
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
context 'when the event is registered' do
|
25
|
-
before { Vedeu.bind(event_name) }
|
26
|
-
after { Vedeu.unbind(event_name) }
|
27
|
-
|
28
|
-
it { subject.must_equal(true) }
|
18
|
+
it { described.must_respond_to(:event) }
|
19
|
+
it { described.must_respond_to(:register) }
|
20
|
+
it { subject.must_be_instance_of(TrueClass) }
|
29
21
|
end
|
30
22
|
|
31
|
-
|
32
|
-
|
23
|
+
describe '.bound?' do
|
24
|
+
subject { described.bound?(event_name) }
|
33
25
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
describe '.unbind' do
|
39
|
-
it { described.must_respond_to(:unbind ) }
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#initialize' do
|
43
|
-
it { instance.must_be_instance_of(described) }
|
44
|
-
it { instance.instance_variable_get('@name').must_equal(event_name) }
|
45
|
-
it { instance.instance_variable_get('@options').must_equal(options) }
|
46
|
-
it { instance.instance_variable_get('@deadline').must_equal(0) }
|
47
|
-
it { instance.instance_variable_get('@executed_at').must_equal(0) }
|
48
|
-
it { instance.instance_variable_get('@now').must_equal(0) }
|
49
|
-
it do
|
50
|
-
instance.instance_variable_get('@repository').must_equal(Vedeu.events)
|
51
|
-
end
|
52
|
-
end
|
26
|
+
context 'when the event is registered' do
|
27
|
+
before { Vedeu.bind(event_name) }
|
28
|
+
after { Vedeu.unbind(event_name) }
|
53
29
|
|
54
|
-
|
55
|
-
|
30
|
+
it { subject.must_equal(true) }
|
31
|
+
end
|
56
32
|
|
57
|
-
|
58
|
-
|
33
|
+
context 'when the event is not registered' do
|
34
|
+
before { Vedeu.unbind(event_name) }
|
59
35
|
|
60
|
-
|
36
|
+
it { subject.must_equal(false) }
|
37
|
+
end
|
61
38
|
end
|
62
39
|
|
63
|
-
|
64
|
-
it {
|
40
|
+
describe '.unbind' do
|
41
|
+
it { described.must_respond_to(:unbind ) }
|
65
42
|
end
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
event.trigger.must_equal(nil)
|
43
|
+
|
44
|
+
describe '#initialize' do
|
45
|
+
it { instance.must_be_instance_of(described) }
|
46
|
+
it { instance.instance_variable_get('@name').must_equal(event_name) }
|
47
|
+
it { instance.instance_variable_get('@options').must_equal(options) }
|
48
|
+
it { instance.instance_variable_get('@deadline').must_equal(0) }
|
49
|
+
it { instance.instance_variable_get('@executed_at').must_equal(0) }
|
50
|
+
it { instance.instance_variable_get('@now').must_equal(0) }
|
51
|
+
it do
|
52
|
+
instance.instance_variable_get('@repository').must_equal(Vedeu.events)
|
53
|
+
end
|
78
54
|
end
|
79
55
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
56
|
+
describe '#bind' do
|
57
|
+
subject { instance.bind }
|
58
|
+
|
59
|
+
context 'when the event name is already registered' do
|
60
|
+
before { Vedeu.bind(:some_event) { :already_registered } }
|
61
|
+
|
62
|
+
it { subject.must_be_instance_of(TrueClass) }
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when the event name is not already registered' do
|
66
|
+
it { subject.must_be_instance_of(TrueClass) }
|
67
|
+
end
|
87
68
|
end
|
88
69
|
|
89
|
-
|
90
|
-
|
91
|
-
|
70
|
+
describe '#trigger' do
|
71
|
+
it 'returns the result of calling the closure when debouncing' do
|
72
|
+
event = described.new(event_name, closure, { debounce: 0.001 })
|
73
|
+
event.trigger.must_equal(nil)
|
74
|
+
sleep 0.0005
|
75
|
+
event.trigger.must_equal(nil)
|
76
|
+
sleep 0.0009
|
77
|
+
event.trigger.must_equal(:event_triggered)
|
78
|
+
sleep 0.0001
|
79
|
+
event.trigger.must_equal(nil)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'returns the result of calling the closure when throttling' do
|
83
|
+
event = described.new(event_name, closure, { delay: 0.001 })
|
84
|
+
event.trigger.must_equal(:event_triggered)
|
85
|
+
sleep 0.0005
|
86
|
+
event.trigger.must_equal(nil)
|
87
|
+
sleep 0.0005
|
88
|
+
event.trigger.must_equal(:event_triggered)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'returns the result of calling the closure with its arguments' do
|
92
|
+
event = described.new(event_name, closure, options)
|
93
|
+
event.trigger.must_equal(:event_triggered)
|
94
|
+
end
|
92
95
|
end
|
93
|
-
end
|
94
96
|
|
95
|
-
|
96
|
-
|
97
|
-
|
97
|
+
describe '#unbind' do
|
98
|
+
context 'when the event exists' do
|
99
|
+
before { Vedeu.bind(:gallium) { :some_action } }
|
98
100
|
|
99
|
-
|
100
|
-
|
101
|
+
it { Vedeu.unbind(:gallium).must_equal(true) }
|
102
|
+
end
|
101
103
|
|
102
|
-
|
103
|
-
|
104
|
+
context 'when the event does not exist' do
|
105
|
+
it { Vedeu.unbind(:gallium).must_equal(false) }
|
106
|
+
end
|
104
107
|
end
|
105
|
-
end
|
106
108
|
|
107
|
-
|
109
|
+
end # Event
|
110
|
+
|
111
|
+
end # Events
|
108
112
|
|
109
113
|
end # Vedeu
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Events
|
6
|
+
|
7
|
+
describe Repository do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Events::Repository }
|
10
|
+
|
11
|
+
it { described.must_respond_to(:events) }
|
12
|
+
|
13
|
+
describe '.reset!' do
|
14
|
+
subject { described.reset! }
|
15
|
+
|
16
|
+
it { described.must_respond_to(:reset) }
|
17
|
+
|
18
|
+
it {
|
19
|
+
described.expects(:new).with(Vedeu::Events::Collection)
|
20
|
+
subject
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
end # Repository
|
25
|
+
|
26
|
+
end # Events
|
27
|
+
|
28
|
+
end # Vedeu
|
@@ -2,59 +2,63 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
|
5
|
+
module Events
|
6
6
|
|
7
|
-
|
8
|
-
let(:instance) { described.new(event_name, args) }
|
9
|
-
let(:event_name) { :_testing_event_ }
|
10
|
-
let(:args) {}
|
7
|
+
describe Trigger do
|
11
8
|
|
12
|
-
|
13
|
-
|
9
|
+
let(:described) { Vedeu::Events::Trigger }
|
10
|
+
let(:instance) { described.new(event_name, args) }
|
11
|
+
let(:event_name) { :_testing_event_ }
|
12
|
+
let(:args) {}
|
14
13
|
|
15
|
-
|
14
|
+
describe '.trigger' do
|
15
|
+
before { Vedeu.bind(event_name) { :_only_one_result_ } }
|
16
16
|
|
17
|
-
|
18
|
-
end
|
17
|
+
subject { described.trigger(event_name) }
|
19
18
|
|
20
|
-
|
21
|
-
it { instance.must_be_instance_of(described) }
|
22
|
-
it { instance.instance_variable_get('@name').must_equal(event_name) }
|
23
|
-
it { instance.instance_variable_get('@args').must_equal([args]) }
|
24
|
-
it do
|
25
|
-
instance.instance_variable_get('@repository').must_equal(Vedeu.events)
|
19
|
+
it { subject.must_equal(:_only_one_result_) }
|
26
20
|
end
|
27
|
-
end
|
28
21
|
|
29
|
-
|
30
|
-
|
22
|
+
describe '#initialize' do
|
23
|
+
it { instance.must_be_instance_of(described) }
|
24
|
+
it { instance.instance_variable_get('@name').must_equal(event_name) }
|
25
|
+
it { instance.instance_variable_get('@args').must_equal([args]) }
|
26
|
+
it do
|
27
|
+
instance.instance_variable_get('@repository').must_equal(Vedeu.events)
|
28
|
+
end
|
29
|
+
end
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
describe '#trigger' do
|
32
|
+
subject { instance.trigger }
|
34
33
|
|
35
|
-
|
34
|
+
context 'when only one result occurs from triggering the event' do
|
35
|
+
let(:event_name) { :_one_result_ }
|
36
36
|
|
37
|
-
|
38
|
-
end
|
37
|
+
before { Vedeu.bind(event_name) { :_only_one_result_ } }
|
39
38
|
|
40
|
-
|
41
|
-
|
39
|
+
it { subject.must_equal(:_only_one_result_) }
|
40
|
+
end
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
Vedeu::Event.register(event_name) { :_result_two_ }
|
46
|
-
}
|
42
|
+
context 'when multiple results occur from triggering an event' do
|
43
|
+
let(:event_name) { :_multiple_results_ }
|
47
44
|
|
48
|
-
|
49
|
-
|
45
|
+
before {
|
46
|
+
Vedeu::Events::Event.register(event_name) { :_result_one_ }
|
47
|
+
Vedeu::Events::Event.register(event_name) { :_result_two_ }
|
48
|
+
}
|
50
49
|
|
51
|
-
|
52
|
-
|
50
|
+
it { subject.must_equal([:_result_one_, :_result_two_]) }
|
51
|
+
end
|
53
52
|
|
54
|
-
|
53
|
+
context 'when the event has not been registered' do
|
54
|
+
let(:event_name) { :_not_found_ }
|
55
|
+
|
56
|
+
it { subject.must_equal([]) }
|
57
|
+
end
|
55
58
|
end
|
56
|
-
end
|
57
59
|
|
58
|
-
|
60
|
+
end # Trigger
|
61
|
+
|
62
|
+
end # Events
|
59
63
|
|
60
64
|
end # Vedeu
|
@@ -17,11 +17,11 @@ module Vedeu
|
|
17
17
|
|
18
18
|
describe '.columns' do
|
19
19
|
context 'when the value is less than 1' do
|
20
|
-
it { proc { Grid.columns(0) }.must_raise(Vedeu::OutOfRange) }
|
20
|
+
it { proc { Grid.columns(0) }.must_raise(Vedeu::Error::OutOfRange) }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when the value is greater than 12' do
|
24
|
-
it { proc { Grid.columns(13) }.must_raise(Vedeu::OutOfRange) }
|
24
|
+
it { proc { Grid.columns(13) }.must_raise(Vedeu::Error::OutOfRange) }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when the value is in range' do
|
@@ -33,11 +33,11 @@ module Vedeu
|
|
33
33
|
|
34
34
|
describe '.rows' do
|
35
35
|
context 'when the value is less than 1' do
|
36
|
-
it { proc { Grid.rows(0) }.must_raise(Vedeu::OutOfRange) }
|
36
|
+
it { proc { Grid.rows(0) }.must_raise(Vedeu::Error::OutOfRange) }
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when the value is greater than 12' do
|
40
|
-
it { proc { Grid.rows(13) }.must_raise(Vedeu::OutOfRange) }
|
40
|
+
it { proc { Grid.rows(13) }.must_raise(Vedeu::Error::OutOfRange) }
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'when the value is in range' do
|
@@ -4,9 +4,9 @@ module Vedeu
|
|
4
4
|
|
5
5
|
module Editor
|
6
6
|
|
7
|
-
describe
|
7
|
+
describe Cursor do
|
8
8
|
|
9
|
-
let(:described) { Vedeu::Editor::
|
9
|
+
let(:described) { Vedeu::Editor::Cursor }
|
10
10
|
let(:instance) { described.new(attributes) }
|
11
11
|
let(:attributes) {
|
12
12
|
{
|
@@ -183,7 +183,7 @@ module Vedeu
|
|
183
183
|
# it { skip }
|
184
184
|
end
|
185
185
|
|
186
|
-
end #
|
186
|
+
end # Cursor
|
187
187
|
|
188
188
|
end # Editor
|
189
189
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Editor
|
6
|
+
|
7
|
+
describe Insert do
|
8
|
+
|
9
|
+
let(:described) { Vedeu::Editor::Insert }
|
10
|
+
let(:instance) { described.new(collection, entity, index, size) }
|
11
|
+
let(:collection) {}
|
12
|
+
let(:entity) {}
|
13
|
+
let(:index) {}
|
14
|
+
let(:size) {}
|
15
|
+
|
16
|
+
describe '#initialize' do
|
17
|
+
it { instance.must_be_instance_of(described) }
|
18
|
+
it { instance.instance_variable_get('@collection').must_equal(collection) }
|
19
|
+
it { instance.instance_variable_get('@entity').must_equal(entity) }
|
20
|
+
it { instance.instance_variable_get('@index').must_equal(index) }
|
21
|
+
it { instance.instance_variable_get('@size').must_equal(size) }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '.into' do
|
25
|
+
subject { described.into(collection, entity, index, size) }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#insert' do
|
29
|
+
it { instance.must_respond_to(:insert) }
|
30
|
+
end
|
31
|
+
|
32
|
+
end # Insert
|
33
|
+
|
34
|
+
end # Editor
|
35
|
+
|
36
|
+
end # Vedeu
|