vedeu 0.4.19 → 0.4.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,12 +23,16 @@ module Vedeu
23
23
  end
24
24
  end
25
25
 
26
+ describe '.restart' do
27
+ subject { described.restart(configuration) }
28
+
29
+ it { subject.must_be_instance_of(Array) }
30
+ end
31
+
26
32
  describe '.start' do
27
33
  subject { described.start(configuration) }
28
34
 
29
35
  it { subject.must_be_instance_of(Array) }
30
-
31
- it { described.must_respond_to(:restart) }
32
36
  end
33
37
 
34
38
  describe '.stop' do
@@ -9,8 +9,12 @@ module Vedeu
9
9
  let(:described) { Vedeu::Distributed::Client }
10
10
  let(:instance) { described.new(uri) }
11
11
  let(:uri) { 'druby://localhost:21420' }
12
+ let(:server) {}
12
13
 
13
- before { $stdout.stubs(:puts) }
14
+ before do
15
+ $stdout.stubs(:puts)
16
+ DRbObject.stubs(:new_with_uri).returns(server)
17
+ end
14
18
 
15
19
  describe 'alias methods' do
16
20
  it { instance.must_respond_to(:read) }
@@ -26,8 +30,19 @@ module Vedeu
26
30
  subject { described.connect(uri) }
27
31
 
28
32
  context 'when the DRb server is not available or not enabled' do
33
+ before { DRbObject.stubs(:new_with_uri).raises(DRb::DRbConnError) }
34
+
29
35
  it { subject.must_equal(:drb_connection_error) }
30
36
  end
37
+
38
+ context 'when the URI is incorrect for connecting' do
39
+ before { DRbObject.stubs(:new_with_uri).raises(DRb::DRbBadURI) }
40
+
41
+ it { subject.must_equal(:drb_bad_uri) }
42
+ end
43
+
44
+ context 'when the DRb server is available' do
45
+ end
31
46
  end
32
47
 
33
48
  describe '#input' do
@@ -36,24 +51,39 @@ module Vedeu
36
51
  subject { instance.input(data) }
37
52
 
38
53
  context 'when the DRb server is not available or not enabled' do
54
+ before { DRbObject.stubs(:new_with_uri).raises(DRb::DRbConnError) }
55
+
39
56
  it { subject.must_equal(:drb_connection_error) }
40
57
  end
58
+
59
+ context 'when the DRb server is available' do
60
+ end
41
61
  end
42
62
 
43
63
  describe '#output' do
44
64
  subject { instance.output }
45
65
 
46
66
  context 'when the DRb server is not available or not enabled' do
67
+ before { DRbObject.stubs(:new_with_uri).raises(DRb::DRbConnError) }
68
+
47
69
  it { subject.must_equal(:drb_connection_error) }
48
70
  end
71
+
72
+ context 'when the DRb server is available' do
73
+ end
49
74
  end
50
75
 
51
76
  describe '#shutdown' do
52
77
  subject { instance.shutdown }
53
78
 
54
79
  context 'when the DRb server is not available or not enabled' do
80
+ before { DRbObject.stubs(:new_with_uri).raises(DRb::DRbConnError) }
81
+
55
82
  it { subject.must_equal(:drb_connection_error) }
56
83
  end
84
+
85
+ context 'when the DRb server is available' do
86
+ end
57
87
  end
58
88
 
59
89
  end # Client
@@ -10,6 +10,14 @@ describe Fixnum do
10
10
  end
11
11
  end
12
12
 
13
+ describe '#rows' do
14
+ it 'returns the height if the value is in range' do
15
+ IO.console.stub :winsize, [25, 60] do
16
+ 1.rows.must_equal(2)
17
+ end
18
+ end
19
+ end
20
+
13
21
  end # Fixnum
14
22
 
15
23
  module Vedeu
@@ -43,6 +51,34 @@ module Vedeu
43
51
  end
44
52
  end
45
53
 
54
+ describe '#height' do
55
+ subject { instance.height }
56
+
57
+ it { subject.must_equal(2) }
58
+ end
59
+
60
+ describe '.rows' do
61
+ context 'when the value is less than 1' do
62
+ it { proc { Grid.rows(0) }.must_raise(OutOfRange) }
63
+ end
64
+
65
+ context 'when the value is greater than 12' do
66
+ it { proc { Grid.rows(13) }.must_raise(OutOfRange) }
67
+ end
68
+
69
+ context 'when the value is in range' do
70
+ it 'returns the value of the row' do
71
+ Grid.rows(7).must_equal(14)
72
+ end
73
+ end
74
+ end
75
+
76
+ describe '#width' do
77
+ subject { instance.width }
78
+
79
+ it { subject.must_equal(6) }
80
+ end
81
+
46
82
  end # Grid
47
83
 
48
84
  end # Vedeu
@@ -9,29 +9,33 @@ module Vedeu
9
9
  let(:attributes) {
10
10
  {
11
11
  client: client,
12
- name: _name,
12
+ colour: colour,
13
+ delay: delay,
14
+ group: group,
13
15
  lines: lines,
16
+ name: _name,
14
17
  parent: parent,
15
- colour: colour,
16
18
  style: style,
17
19
  visible: visible,
18
20
  }
19
21
  }
20
22
  let(:client) {}
21
- let(:_name) { 'hydrogen' }
23
+ let(:colour) {}
24
+ let(:delay) { 0.0 }
25
+ let(:group) { '' }
22
26
  let(:lines) { [] }
27
+ let(:_name) { 'hydrogen' }
23
28
  let(:parent) {}
24
- let(:colour) {}
29
+ let(:repository) { Vedeu.interfaces }
25
30
  let(:style) {}
26
31
  let(:visible) { true }
27
- let(:repository) { Vedeu.interfaces }
28
32
 
29
33
  describe '#initialize' do
30
34
  subject { instance }
31
35
 
32
36
  it { subject.instance_variable_get('@client').must_equal(client) }
33
- it { subject.instance_variable_get('@delay').must_equal(0.0) }
34
- it { subject.instance_variable_get('@group').must_equal('') }
37
+ it { subject.instance_variable_get('@delay').must_equal(delay) }
38
+ it { subject.instance_variable_get('@group').must_equal(group) }
35
39
  it { subject.instance_variable_get('@lines').must_equal(lines) }
36
40
  it { subject.instance_variable_get('@name').must_equal(_name) }
37
41
  it { subject.instance_variable_get('@parent').must_equal(parent) }
@@ -53,6 +57,20 @@ module Vedeu
53
57
  end
54
58
  end
55
59
 
60
+ describe '#group?' do
61
+ subject { instance.group? }
62
+
63
+ context 'when the interface belongs to a group' do
64
+ let(:group) { 'interfaces' }
65
+
66
+ it { subject.must_equal(true) }
67
+ end
68
+
69
+ context 'when the interface does not belong to a group' do
70
+ it { subject.must_equal(false) }
71
+ end
72
+ end
73
+
56
74
  describe '#render' do
57
75
  let(:clear) { mock('Vedeu::Clear') }
58
76
  let(:border) { mock('Vedeu::Border') }
@@ -0,0 +1,46 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Null
6
+
7
+ describe Buffer do
8
+
9
+ let(:described) { Vedeu::Null::Buffer }
10
+ let(:instance) { described.new(_name) }
11
+ let(:_name) { 'null_buffer' }
12
+
13
+ describe '#initialize' do
14
+ it { instance.must_be_instance_of(described) }
15
+ it { instance.instance_variable_get('@name').must_equal(_name) }
16
+ end
17
+
18
+ describe '#clear' do
19
+ subject { instance.clear }
20
+
21
+ it { subject.must_be_instance_of(NilClass) }
22
+ end
23
+
24
+ describe '#hide' do
25
+ subject { instance.hide }
26
+
27
+ it { subject.must_be_instance_of(NilClass) }
28
+ end
29
+
30
+ describe '#render' do
31
+ subject { instance.render }
32
+
33
+ it { subject.must_be_instance_of(NilClass) }
34
+ end
35
+
36
+ describe '#show' do
37
+ subject { instance.show }
38
+
39
+ it { subject.must_be_instance_of(NilClass) }
40
+ end
41
+
42
+ end # Buffer
43
+
44
+ end # Null
45
+
46
+ end # Vedeu
@@ -51,6 +51,14 @@ module Vedeu
51
51
  # end
52
52
  end
53
53
 
54
+ describe '.render' do
55
+ let(:args) {}
56
+
57
+ subject { described.render(args) }
58
+
59
+ it { subject.must_be_instance_of(Array) }
60
+ end
61
+
54
62
  describe '.renderer' do
55
63
  let(:renderers) {}
56
64
 
@@ -8,6 +8,10 @@ module Vedeu
8
8
  let(:instance) { described.new(colour) }
9
9
  let(:colour) { '#ff0000' }
10
10
 
11
+ before do
12
+ instance.stubs(:registered?).returns(false)
13
+ end
14
+
11
15
  describe 'alias methods' do
12
16
  it { instance.must_respond_to(:value) }
13
17
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.4.19'
7
+ spec.version = '0.4.20'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = 'A terminal case of wonderland.'
@@ -25,15 +25,15 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'guard-bundler', '2.1.0'
26
26
  spec.add_development_dependency 'guard-cucumber', '1.6.0'
27
27
  spec.add_development_dependency 'guard-minitest', '2.4.4'
28
- spec.add_development_dependency 'inch', '0.5.10'
29
- spec.add_development_dependency 'minitest', '5.6.0'
30
- spec.add_development_dependency 'minitest-reporters', '1.0.11'
28
+ spec.add_development_dependency 'inch', '0.6.2'
29
+ spec.add_development_dependency 'minitest', '5.6.1'
30
+ spec.add_development_dependency 'minitest-reporters', '1.0.16'
31
31
  spec.add_development_dependency 'mocha', '1.1.0'
32
32
  spec.add_development_dependency 'pry', '0.10.1'
33
33
  spec.add_development_dependency 'pry-byebug', '3.1.0'
34
34
  spec.add_development_dependency 'rake', '10.4.2'
35
- spec.add_development_dependency 'rubocop', '0.30.0'
36
- spec.add_development_dependency 'ruby-prof', '0.15.6'
35
+ spec.add_development_dependency 'rubocop', '0.31.0'
36
+ spec.add_development_dependency 'ruby-prof', '0.15.8'
37
37
  spec.add_development_dependency 'simplecov', '0.10.0'
38
38
  spec.add_development_dependency 'simplecov-console', '0.2.0'
39
39
  spec.add_development_dependency 'yard', '0.8.7.6'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.19
4
+ version: 0.4.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -114,42 +114,42 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.5.10
117
+ version: 0.6.2
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.5.10
124
+ version: 0.6.2
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: minitest
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 5.6.0
131
+ version: 5.6.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 5.6.0
138
+ version: 5.6.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: minitest-reporters
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 1.0.11
145
+ version: 1.0.16
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 1.0.11
152
+ version: 1.0.16
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mocha
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -212,28 +212,28 @@ dependencies:
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 0.30.0
215
+ version: 0.31.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 0.30.0
222
+ version: 0.31.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: ruby-prof
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - '='
228
228
  - !ruby/object:Gem::Version
229
- version: 0.15.6
229
+ version: 0.15.8
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - '='
235
235
  - !ruby/object:Gem::Version
236
- version: 0.15.6
236
+ version: 0.15.8
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: simplecov
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -540,6 +540,7 @@ files:
540
540
  - test/lib/vedeu/models/menu_test.rb
541
541
  - test/lib/vedeu/models/stream_test.rb
542
542
  - test/lib/vedeu/null/border_test.rb
543
+ - test/lib/vedeu/null/buffer_test.rb
543
544
  - test/lib/vedeu/null/generic_test.rb
544
545
  - test/lib/vedeu/null/geometry_test.rb
545
546
  - test/lib/vedeu/null/interface_test.rb
@@ -694,6 +695,7 @@ test_files:
694
695
  - test/lib/vedeu/models/menu_test.rb
695
696
  - test/lib/vedeu/models/stream_test.rb
696
697
  - test/lib/vedeu/null/border_test.rb
698
+ - test/lib/vedeu/null/buffer_test.rb
697
699
  - test/lib/vedeu/null/generic_test.rb
698
700
  - test/lib/vedeu/null/geometry_test.rb
699
701
  - test/lib/vedeu/null/interface_test.rb