vedeu 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/events.md +6 -0
- data/examples/{cursor_app/cursor_app.rb → cursor_app.rb} +1 -1
- data/examples/{lines_app/lines_app.rb → lines_app.rb} +1 -1
- data/lib/vedeu.rb +48 -28
- data/lib/vedeu/api/api.rb +8 -95
- data/lib/vedeu/application.rb +6 -2
- data/lib/vedeu/{models → colours}/background.rb +1 -1
- data/lib/vedeu/{models → colours}/colour.rb +0 -0
- data/lib/vedeu/{models → colours}/foreground.rb +2 -2
- data/lib/vedeu/{support/colour_translator.rb → colours/translator.rb} +7 -7
- data/lib/vedeu/input/input.rb +13 -5
- data/lib/vedeu/models/geometry.rb +30 -2
- data/lib/vedeu/models/key.rb +39 -0
- data/lib/vedeu/output/compositor.rb +30 -76
- data/lib/vedeu/output/output.rb +74 -0
- data/lib/vedeu/output/viewport.rb +36 -44
- data/lib/vedeu/repositories/buffers.rb +5 -18
- data/lib/vedeu/repositories/cursors.rb +16 -8
- data/lib/vedeu/repositories/events.rb +96 -9
- data/lib/vedeu/repositories/focus.rb +21 -20
- data/lib/vedeu/repositories/groups.rb +3 -11
- data/lib/vedeu/repositories/interfaces.rb +6 -9
- data/lib/vedeu/repositories/keymaps.rb +8 -3
- data/lib/vedeu/repositories/menus.rb +6 -21
- data/lib/vedeu/{models → repositories/models}/buffer.rb +62 -28
- data/lib/vedeu/{models → repositories/models}/cursor.rb +8 -2
- data/lib/vedeu/{models → repositories/models}/event.rb +7 -0
- data/lib/vedeu/repositories/models/group.rb +56 -0
- data/lib/vedeu/{models → repositories/models}/interface.rb +6 -0
- data/lib/vedeu/{models → repositories/models}/keymap.rb +7 -1
- data/lib/vedeu/{models → repositories/models}/menu.rb +9 -0
- data/lib/vedeu/{models → repositories/models}/offset.rb +8 -1
- data/lib/vedeu/repositories/offsets.rb +17 -12
- data/lib/vedeu/support/bounding_area.rb +127 -0
- data/lib/vedeu/support/common.rb +8 -0
- data/lib/vedeu/support/exceptions.rb +2 -12
- data/lib/vedeu/support/model.rb +14 -0
- data/lib/vedeu/support/refresh.rb +8 -7
- data/lib/vedeu/support/registrar.rb +7 -1
- data/lib/vedeu/support/repository.rb +31 -10
- data/lib/vedeu/support/sentence.rb +67 -0
- data/lib/vedeu/support/terminal.rb +19 -0
- data/lib/vedeu/support/trace.rb +2 -5
- data/test/integration/api/api_test.rb +97 -0
- data/test/integration/api_dsl/dsl_api_test.rb +4 -0
- data/test/integration/api_dsl/dsl_composition_test.rb +4 -0
- data/test/integration/api_dsl/dsl_defined_test.rb +4 -0
- data/test/integration/api_dsl/dsl_helpers_test.rb +4 -0
- data/test/integration/api_dsl/dsl_interface_test.rb +4 -0
- data/test/integration/api_dsl/dsl_keymap.rb +4 -0
- data/test/integration/api_dsl/dsl_line_test.rb +4 -0
- data/test/integration/api_dsl/dsl_menu_test.rb +4 -0
- data/test/integration/api_dsl/dsl_stream_test.rb +138 -0
- data/test/lib/vedeu/api/api_test.rb +1 -25
- data/test/lib/vedeu/api/helpers_test.rb +0 -10
- data/test/lib/vedeu/{models → colours}/background_test.rb +0 -0
- data/test/lib/vedeu/{models → colours}/colour_test.rb +0 -0
- data/test/lib/vedeu/{models → colours}/foreground_test.rb +0 -0
- data/test/lib/vedeu/{support/colour_translator_test.rb → colours/translator_test.rb} +3 -3
- data/test/lib/vedeu/input/input_test.rb +16 -47
- data/test/lib/vedeu/models/geometry_test.rb +46 -0
- data/test/lib/vedeu/models/group_test.rb +99 -0
- data/test/lib/vedeu/models/key_test.rb +41 -0
- data/test/lib/vedeu/output/compositor_test.rb +25 -101
- data/test/lib/vedeu/output/output_test.rb +108 -0
- data/test/lib/vedeu/repositories/buffers_test.rb +0 -8
- data/test/lib/vedeu/repositories/cursors_test.rb +34 -0
- data/test/lib/vedeu/repositories/focus_test.rb +37 -28
- data/test/lib/vedeu/repositories/interfaces_test.rb +1 -1
- data/test/lib/vedeu/repositories/keymaps_test.rb +6 -20
- data/test/lib/vedeu/repositories/menus_test.rb +0 -6
- data/test/lib/vedeu/{models → repositories/models}/buffer_test.rb +24 -27
- data/test/lib/vedeu/{models → repositories/models}/cursor_test.rb +0 -0
- data/test/lib/vedeu/{models → repositories/models}/event_test.rb +0 -0
- data/test/lib/vedeu/{models → repositories/models}/interface_test.rb +0 -0
- data/test/lib/vedeu/{models → repositories/models}/keymap_test.rb +0 -0
- data/test/lib/vedeu/{models → repositories/models}/menu_test.rb +0 -0
- data/test/lib/vedeu/{models → repositories/models}/offset_test.rb +0 -0
- data/test/lib/vedeu/support/bounding_area_test.rb +139 -0
- data/test/lib/vedeu/support/coercions_test.rb +6 -17
- data/test/lib/vedeu/support/grid_test.rb +1 -1
- data/test/lib/vedeu/support/model_test.rb +23 -0
- data/test/lib/vedeu/support/presentation_test.rb +0 -10
- data/test/lib/vedeu/support/refresh_test.rb +2 -2
- data/test/lib/vedeu/support/repository_test.rb +63 -64
- data/test/lib/vedeu/support/sentence_test.rb +48 -0
- data/test/lib/vedeu/support/terminal_test.rb +86 -6
- data/test/support/test_classes/all.rb +5 -0
- data/test/support/test_classes/coercions.rb +16 -0
- data/test/support/test_classes/helpers.rb +19 -0
- data/test/support/test_classes/model.rb +23 -0
- data/test/support/test_classes/presentation.rb +16 -0
- data/test/support/test_classes/repositories.rb +26 -0
- data/test/support/test_modules/all.rb +1 -0
- data/test/support/test_modules/repository.rb +16 -0
- data/test/test_helper.rb +4 -0
- data/vedeu.gemspec +3 -3
- metadata +95 -50
- data/lib/vedeu/output/clear.rb +0 -88
- data/lib/vedeu/output/render.rb +0 -50
- data/lib/vedeu/repositories/positional.rb +0 -23
- data/test/lib/vedeu/output/clear_test.rb +0 -56
- data/test/lib/vedeu/output/render_test.rb +0 -100
- data/test/lib/vedeu/repositories/positional_test.rb +0 -50
@@ -0,0 +1,138 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe 'DSL Stream tests' do
|
4
|
+
|
5
|
+
# describe '#align' do
|
6
|
+
# it ':left' do
|
7
|
+
# Vedeu.view 'test' do
|
8
|
+
# line do
|
9
|
+
# stream do
|
10
|
+
# align :left
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
# end.must_equal({})
|
14
|
+
# end
|
15
|
+
|
16
|
+
# it ':right' do
|
17
|
+
# Vedeu.view 'test' do
|
18
|
+
# line do
|
19
|
+
# stream do
|
20
|
+
# align :right
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
# end.must_equal({})
|
24
|
+
# end
|
25
|
+
|
26
|
+
# it ':centre' do
|
27
|
+
# Vedeu.view 'test' do
|
28
|
+
# line do
|
29
|
+
# stream do
|
30
|
+
# align :centre
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
# end.must_equal({})
|
34
|
+
# end
|
35
|
+
|
36
|
+
# it ':invalid' do
|
37
|
+
# proc { Vedeu.view 'test' do
|
38
|
+
# line do
|
39
|
+
# stream do
|
40
|
+
# align :invalid
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
# end }.must_raise(Vedeu::InvalidSyntax)
|
44
|
+
# end
|
45
|
+
|
46
|
+
# it ':right overriding :centre' do
|
47
|
+
# Vedeu.view 'test' do
|
48
|
+
# line do
|
49
|
+
# stream do
|
50
|
+
# align :centre
|
51
|
+
# align :right
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
# end.must_equal({})
|
55
|
+
# end
|
56
|
+
# end
|
57
|
+
|
58
|
+
# describe '#centre' do
|
59
|
+
# it 'centre' do
|
60
|
+
# Vedeu.view 'test' do
|
61
|
+
# line do
|
62
|
+
# stream do
|
63
|
+
# align centre
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
# end.must_equal({})
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
|
70
|
+
# describe '#left' do
|
71
|
+
# it 'left' do
|
72
|
+
# Vedeu.view 'test' do
|
73
|
+
# line do
|
74
|
+
# stream do
|
75
|
+
# align left
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
# end.must_equal({})
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
|
82
|
+
# describe '#right' do
|
83
|
+
# it 'right' do
|
84
|
+
# Vedeu.view 'test' do
|
85
|
+
# line do
|
86
|
+
# stream do
|
87
|
+
# align right
|
88
|
+
# end
|
89
|
+
# end
|
90
|
+
# end.must_equal({})
|
91
|
+
# end
|
92
|
+
# end
|
93
|
+
|
94
|
+
# describe '#text' do
|
95
|
+
# it 'text' do
|
96
|
+
# Vedeu.view 'test' do
|
97
|
+
# line do
|
98
|
+
# stream do
|
99
|
+
# text 'Some text...'
|
100
|
+
# end
|
101
|
+
# end
|
102
|
+
# end.must_equal({})
|
103
|
+
# end
|
104
|
+
|
105
|
+
# it 'invalid' do
|
106
|
+
# proc { Vedeu.view 'test' do
|
107
|
+
# line do
|
108
|
+
# stream do
|
109
|
+
# text
|
110
|
+
# end
|
111
|
+
# end
|
112
|
+
# end }.must_raise(ArgumentError)
|
113
|
+
# end
|
114
|
+
# end
|
115
|
+
|
116
|
+
# describe '#width' do
|
117
|
+
# it 'width' do
|
118
|
+
# Vedeu.view 'test' do
|
119
|
+
# line do
|
120
|
+
# stream do
|
121
|
+
# width 35
|
122
|
+
# end
|
123
|
+
# end
|
124
|
+
# end.must_equal({})
|
125
|
+
# end
|
126
|
+
|
127
|
+
# it 'invalid' do
|
128
|
+
# proc { Vedeu.view 'test' do
|
129
|
+
# line do
|
130
|
+
# stream do
|
131
|
+
# width
|
132
|
+
# end
|
133
|
+
# end
|
134
|
+
# end }.must_raise(ArgumentError)
|
135
|
+
# end
|
136
|
+
# end
|
137
|
+
|
138
|
+
end
|
@@ -20,14 +20,6 @@ module Vedeu
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe '.event' do
|
24
|
-
it 'delegates to the Events repository' do
|
25
|
-
Events.expects(:add)
|
26
|
-
|
27
|
-
Vedeu.event(:some_event)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
23
|
describe '.focus' do
|
32
24
|
it 'sets the named interface to be focussed' do
|
33
25
|
Vedeu.expects(:trigger).with(:_focus_by_name_, 'plutonium')
|
@@ -36,14 +28,6 @@ module Vedeu
|
|
36
28
|
end
|
37
29
|
end
|
38
30
|
|
39
|
-
describe '.height' do
|
40
|
-
it 'returns the terminal height' do
|
41
|
-
IO.console.stub(:winsize, [24, 40]) do
|
42
|
-
Vedeu.height.must_equal(24)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
31
|
describe '.interface' do
|
48
32
|
it 'creates and stores a new interface' do
|
49
33
|
Vedeu::Buffers.reset
|
@@ -158,7 +142,7 @@ module Vedeu
|
|
158
142
|
|
159
143
|
it 'raises an exception if the interface has not been defined' do
|
160
144
|
proc { Vedeu.use('unknown') }
|
161
|
-
.must_raise(
|
145
|
+
.must_raise(ModelNotFound)
|
162
146
|
end
|
163
147
|
|
164
148
|
it 'returns an instance of the named interface' do
|
@@ -214,14 +198,6 @@ module Vedeu
|
|
214
198
|
end
|
215
199
|
end
|
216
200
|
|
217
|
-
describe '.width' do
|
218
|
-
it 'returns the terminal width' do
|
219
|
-
IO.console.stub(:winsize, [24, 40]) do
|
220
|
-
Vedeu.width.must_equal(40)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
201
|
end # API
|
226
202
|
|
227
203
|
end # Vedeu
|
@@ -4,16 +4,6 @@ module Vedeu
|
|
4
4
|
|
5
5
|
module API
|
6
6
|
|
7
|
-
class HelpersTestClass
|
8
|
-
include Helpers
|
9
|
-
|
10
|
-
attr_accessor :attributes
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@attributes = { colour: {}, streams: [], style: [] }
|
14
|
-
end
|
15
|
-
end # HelpersTestClass
|
16
|
-
|
17
7
|
describe Helpers do
|
18
8
|
|
19
9
|
describe '#background' do
|
File without changes
|
File without changes
|
File without changes
|
@@ -2,16 +2,16 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe Translator do
|
6
6
|
|
7
7
|
describe '#initialize' do
|
8
8
|
it 'returns an instance of itself' do
|
9
9
|
colour = ''
|
10
10
|
|
11
|
-
|
11
|
+
Translator.new(colour).must_be_instance_of(Translator)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
end #
|
15
|
+
end # Translator
|
16
16
|
|
17
17
|
end # Vedeu
|
@@ -3,64 +3,33 @@ require 'test_helper'
|
|
3
3
|
module Vedeu
|
4
4
|
|
5
5
|
describe Input do
|
6
|
+
let(:reader) { mock }
|
7
|
+
let(:keypress) { 'a' }
|
8
|
+
|
9
|
+
before { reader.stubs(:read).returns(keypress) }
|
6
10
|
|
7
11
|
describe '#initialize' do
|
8
12
|
it 'returns an instance of itself' do
|
9
|
-
Input.new.must_be_instance_of(Input)
|
13
|
+
Input.new(reader).must_be_instance_of(Input)
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|
13
17
|
describe '.capture' do
|
14
|
-
|
15
|
-
|
16
|
-
"\t" => :tab,
|
17
|
-
# "\e" => :escape, # handled below in separate test
|
18
|
-
"\e[A" => :up,
|
19
|
-
"\e[B" => :down,
|
20
|
-
"\e[C" => :right,
|
21
|
-
"\e[D" => :left,
|
22
|
-
"\e[5~" => :page_up,
|
23
|
-
"\e[6~" => :page_down,
|
24
|
-
"\e[H" => :home,
|
25
|
-
"\e[3~" => :delete,
|
26
|
-
"\e[F" => :end,
|
27
|
-
"\e[Z" => :shift_tab,
|
28
|
-
"\eOP" => :f1,
|
29
|
-
"\eOQ" => :f2,
|
30
|
-
"\eOR" => :f3,
|
31
|
-
"\eOS" => :f4,
|
32
|
-
"\e[15~" => :f5,
|
33
|
-
"\e[17~" => :f6,
|
34
|
-
"\e[18~" => :f7,
|
35
|
-
"\e[19~" => :f8,
|
36
|
-
"\e[20~" => :f9,
|
37
|
-
"\e[21~" => :f10,
|
38
|
-
"\e[23~" => :f11,
|
39
|
-
"\e[24~" => :f12,
|
40
|
-
"\e[1;2P" => :print_screen,
|
41
|
-
"\e[1;2Q" => :scroll_lock,
|
42
|
-
"\e[1;2R" => :pause_break,
|
43
|
-
"\u007F" => :backspace,
|
44
|
-
"k" => "k"
|
45
|
-
}
|
18
|
+
context 'when the key is not special' do
|
19
|
+
before { Vedeu.stubs(:trigger).returns([false]) }
|
46
20
|
|
47
|
-
|
48
|
-
|
49
|
-
Terminal.stub :input, keypress do
|
50
|
-
Vedeu.stub :trigger, value do
|
51
|
-
Input.capture.must_equal(value)
|
52
|
-
end
|
53
|
-
end
|
21
|
+
it 'triggers an event associated with the key pressed' do
|
22
|
+
Input.capture(reader).must_equal([false])
|
54
23
|
end
|
55
24
|
end
|
56
25
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
26
|
+
context 'when the key is special' do
|
27
|
+
let(:keypress) { "\e" }
|
28
|
+
|
29
|
+
before { Vedeu.stubs(:trigger).raises(ModeSwitch) }
|
30
|
+
|
31
|
+
it 'switches the terminal mode when escape is pressed' do
|
32
|
+
proc { Input.capture(reader) }.must_raise(ModeSwitch)
|
64
33
|
end
|
65
34
|
end
|
66
35
|
end
|
@@ -18,6 +18,29 @@ module Vedeu
|
|
18
18
|
geometry.y.must_equal(17)
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
it 'returns the value of y when just an attribute' do
|
23
|
+
IO.console.stub(:winsize, [25, 80]) do
|
24
|
+
geometry = Geometry.new({ y: 19 })
|
25
|
+
geometry.y.must_equal(19)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#yn' do
|
31
|
+
it 'returns the value of yn when it is a proc' do
|
32
|
+
IO.console.stub(:winsize, [25, 80]) do
|
33
|
+
geometry = Geometry.new({ yn: proc { 17 } })
|
34
|
+
geometry.yn.must_equal(17)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'returns the value of yn when just an attribute' do
|
39
|
+
IO.console.stub(:winsize, [25, 80]) do
|
40
|
+
geometry = Geometry.new({ yn: 19 })
|
41
|
+
geometry.yn.must_equal(19)
|
42
|
+
end
|
43
|
+
end
|
21
44
|
end
|
22
45
|
|
23
46
|
describe '#x' do
|
@@ -27,6 +50,29 @@ module Vedeu
|
|
27
50
|
geometry.x.must_equal(58)
|
28
51
|
end
|
29
52
|
end
|
53
|
+
|
54
|
+
it 'returns the value of x when just an attribute' do
|
55
|
+
IO.console.stub(:winsize, [25, 80]) do
|
56
|
+
geometry = Geometry.new({ x: 64 })
|
57
|
+
geometry.x.must_equal(64)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#xn' do
|
63
|
+
it 'returns the value of xn when it is a proc' do
|
64
|
+
IO.console.stub(:winsize, [25, 80]) do
|
65
|
+
geometry = Geometry.new({ xn: proc { 58 } })
|
66
|
+
geometry.xn.must_equal(58)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'returns the value of xn when just an attribute' do
|
71
|
+
IO.console.stub(:winsize, [25, 80]) do
|
72
|
+
geometry = Geometry.new({ xn: 64 })
|
73
|
+
geometry.xn.must_equal(64)
|
74
|
+
end
|
75
|
+
end
|
30
76
|
end
|
31
77
|
|
32
78
|
describe '#width' do
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Group do
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
it 'returns a Group' do
|
9
|
+
Group.new('organics').must_be_instance_of(Group)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#add' do
|
14
|
+
it 'returns a Group' do
|
15
|
+
Group.new('organics', 'carbon', 'nitrogen').add('oxygen').must_be_instance_of(Group)
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when the member already exists' do
|
19
|
+
it 'does not add the member again but returns a new Group' do
|
20
|
+
group = Group.new('organics', 'nitrogen', 'carbon')
|
21
|
+
new_group = group.add('nitrogen')
|
22
|
+
new_group.members.must_equal(['nitrogen', 'carbon'])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when the member does not exist' do
|
27
|
+
it 'adds the member and returns a new Group' do
|
28
|
+
group = Group.new('organics', 'carbon')
|
29
|
+
new_group = group.add('nitrogen')
|
30
|
+
new_group.members.must_equal(['carbon', 'nitrogen'])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#members' do
|
36
|
+
it 'returns an instance of Array' do
|
37
|
+
Group.new('organics').members.must_be_instance_of(Array)
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when the group has no members' do
|
41
|
+
it 'returns an empty Set' do
|
42
|
+
group = Group.new('organics')
|
43
|
+
group.members.must_be_empty
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when the group has members' do
|
48
|
+
it 'returns a set of members' do
|
49
|
+
group = Group.new('organics', 'nitrogen', 'carbon')
|
50
|
+
group.members.wont_be_empty
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '#name' do
|
56
|
+
it 'returns the specified name for the group' do
|
57
|
+
Group.new('organics').name.must_equal('organics')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#remove' do
|
62
|
+
it 'returns a Group' do
|
63
|
+
group = Group.new('organics')
|
64
|
+
group.members.must_be_empty
|
65
|
+
group.remove('nitrogen').must_be_instance_of(Group)
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'when the member exists' do
|
69
|
+
it 'removes the member and returns a new Group' do
|
70
|
+
group = Group.new('organics', 'nitrogen', 'carbon')
|
71
|
+
new_group = group.remove('nitrogen')
|
72
|
+
new_group.members.wont_include('nitrogen')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context 'when the member does not exist' do
|
77
|
+
it 'returns a new Group' do
|
78
|
+
group = Group.new('organics', 'nitrogen', 'carbon')
|
79
|
+
new_group = group.remove('oxygen')
|
80
|
+
new_group.members.must_equal(['nitrogen', 'carbon'])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#reset' do
|
86
|
+
it 'returns a Group' do
|
87
|
+
Group.new('organics').reset.must_be_instance_of(Group)
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'returns a Group with no members' do
|
91
|
+
group = Group.new('organics', 'nitrogen', 'carbon')
|
92
|
+
new_group = group.reset
|
93
|
+
new_group.members.must_be_empty
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end # Group
|
98
|
+
|
99
|
+
end # Vedeu
|