vedeu 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/examples/material_colours_app.rb +25 -0
  3. data/lib/vedeu/all.rb +0 -1
  4. data/lib/vedeu/colours/colour_translator.rb +6 -6
  5. data/lib/vedeu/cursor/cursor.rb +0 -12
  6. data/lib/vedeu/dsl.rb +23 -0
  7. data/lib/vedeu/dsl/border.rb +0 -10
  8. data/lib/vedeu/dsl/composition.rb +1 -19
  9. data/lib/vedeu/dsl/geometry.rb +0 -10
  10. data/lib/vedeu/dsl/group.rb +0 -10
  11. data/lib/vedeu/dsl/interface.rb +0 -20
  12. data/lib/vedeu/dsl/keymap.rb +0 -10
  13. data/lib/vedeu/dsl/line.rb +3 -21
  14. data/lib/vedeu/dsl/menu.rb +0 -10
  15. data/lib/vedeu/dsl/stream.rb +4 -10
  16. data/lib/vedeu/dsl/view.rb +0 -20
  17. data/lib/vedeu/geometry/geometry.rb +0 -13
  18. data/lib/vedeu/geometry/position.rb +11 -0
  19. data/lib/vedeu/models/escape.rb +0 -7
  20. data/lib/vedeu/models/interface.rb +4 -16
  21. data/lib/vedeu/models/views/all.rb +4 -5
  22. data/lib/vedeu/models/views/char.rb +21 -22
  23. data/lib/vedeu/models/views/{chars.rb → collections/chars.rb} +0 -0
  24. data/lib/vedeu/models/views/{lines.rb → collections/lines.rb} +0 -0
  25. data/lib/vedeu/models/views/{streams.rb → collections/streams.rb} +0 -0
  26. data/lib/vedeu/models/views/{view_collection.rb → collections/view_collection.rb} +0 -0
  27. data/lib/vedeu/models/views/composition.rb +17 -19
  28. data/lib/vedeu/models/views/line.rb +19 -31
  29. data/lib/vedeu/models/views/stream.rb +7 -20
  30. data/lib/vedeu/models/views/view.rb +22 -35
  31. data/lib/vedeu/output/html_char.rb +38 -28
  32. data/lib/vedeu/output/presentation/colour.rb +15 -44
  33. data/lib/vedeu/output/presentation/style.rb +7 -14
  34. data/lib/vedeu/output/viewport.rb +0 -3
  35. data/lib/vedeu/output/virtual_terminal.rb +2 -2
  36. data/lib/vedeu/repositories/repository.rb +0 -7
  37. data/lib/vedeu/version.rb +1 -1
  38. data/test/lib/vedeu/buffers/buffer_test.rb +4 -4
  39. data/test/lib/vedeu/colours/colour_translator_test.rb +14 -0
  40. data/test/lib/vedeu/cursor/cursor_test.rb +0 -9
  41. data/test/lib/vedeu/dsl/line_test.rb +15 -13
  42. data/test/lib/vedeu/geometry/geometry_test.rb +0 -13
  43. data/test/lib/vedeu/geometry/position_test.rb +18 -0
  44. data/test/lib/vedeu/models/escape_test.rb +0 -8
  45. data/test/lib/vedeu/models/interface_test.rb +0 -12
  46. data/test/lib/vedeu/models/views/char_test.rb +4 -23
  47. data/test/lib/vedeu/models/views/{chars_test.rb → collections/chars_test.rb} +0 -0
  48. data/test/lib/vedeu/models/views/{lines_test.rb → collections/lines_test.rb} +0 -0
  49. data/test/lib/vedeu/models/views/{streams_test.rb → collections/streams_test.rb} +0 -0
  50. data/test/lib/vedeu/models/views/collections/view_collection_test.rb +22 -0
  51. data/test/lib/vedeu/models/views/composition_test.rb +23 -17
  52. data/test/lib/vedeu/models/views/line_test.rb +13 -42
  53. data/test/lib/vedeu/models/views/stream_test.rb +4 -33
  54. data/test/lib/vedeu/output/html_char_test.rb +16 -39
  55. data/test/lib/vedeu/output/presentation/colour_test.rb +63 -60
  56. data/test/lib/vedeu/output/presentation/style_test.rb +30 -29
  57. data/test/lib/vedeu/output/presentation_test.rb +1 -1
  58. data/test/lib/vedeu/output/renderers/html_test.rb +4 -8
  59. data/test/lib/vedeu/output/renderers/json_test.rb +37 -3
  60. data/test/lib/vedeu/output/wordwrap_test.rb +4 -4
  61. data/test/lib/vedeu/repositories/repository_test.rb +0 -26
  62. data/test/lib/vedeu/templating/view_template_test.rb +8 -8
  63. metadata +13 -17
  64. data/lib/vedeu/geometry/position_index.rb +0 -68
  65. data/lib/vedeu/models/interface_collection.rb +0 -9
  66. data/test/lib/vedeu/geometry/position_index_test.rb +0 -82
  67. data/test/lib/vedeu/models/interface_collection_test.rb +0 -18
@@ -40,14 +40,6 @@ module Vedeu
40
40
  it { instance.must_respond_to(:==) }
41
41
  end
42
42
 
43
- describe '#inspect' do
44
- it { instance.inspect.must_equal(
45
- "<Vedeu::Escape '" \
46
- "\\e[2;6H\\e[?25h" \
47
- "'>"
48
- ) }
49
- end
50
-
51
43
  describe '#position' do
52
44
  it { instance.position.must_be_instance_of(Vedeu::Position) }
53
45
  end
@@ -76,18 +76,6 @@ module Vedeu
76
76
  }
77
77
  end
78
78
 
79
- describe '#inspect' do
80
- subject { instance.inspect }
81
-
82
- it { subject.must_be_instance_of(String) }
83
-
84
- it { subject.must_equal(
85
- "<Vedeu::Interface name: 'hydrogen', group: '', visible: 'true', " \
86
- "zindex: '1'>"
87
- )
88
- }
89
- end
90
-
91
79
  describe '#show' do
92
80
  let(:buffer) { Vedeu::Buffer.new }
93
81
 
@@ -22,10 +22,10 @@ module Vedeu
22
22
  let(:parent) { Vedeu::Views::Line.new(parent_attributes) }
23
23
  let(:parent_attributes) {
24
24
  {
25
- streams: [],
26
- parent: nil,
27
- colour: parent_colour,
28
- style: parent_style,
25
+ value: [],
26
+ parent: nil,
27
+ colour: parent_colour,
28
+ style: parent_style,
29
29
  }
30
30
  }
31
31
  let(:border) { nil }
@@ -73,25 +73,6 @@ module Vedeu
73
73
  end
74
74
  end
75
75
 
76
- describe '#inspect' do
77
- let(:colour) { Vedeu::Colour.new(foreground: '#00ff00',
78
- background: '#005500') }
79
- let(:position) { Vedeu::Position[17, 2] }
80
- let(:style) { Vedeu::Style.new('underline') }
81
-
82
-
83
- subject { instance.inspect }
84
-
85
- it { subject.must_equal(
86
- "<Vedeu::Views::Char '" \
87
- "\\e[17;2H" \
88
- "\\e[38;2;0;255;0m" \
89
- "\\e[48;2;0;85;0m" \
90
- "\\e[4ma" \
91
- "'>"
92
- ) }
93
- end
94
-
95
76
  describe '#position' do
96
77
  subject { instance.position }
97
78
  end
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ module Vedeu
4
+
5
+ module Views
6
+
7
+ describe ViewCollection do
8
+
9
+ let(:described) { Vedeu::Views::ViewCollection }
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 # ViewCollection
19
+
20
+ end # Views
21
+
22
+ end # Vedeu
@@ -10,14 +10,18 @@ module Vedeu
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
13
- views: views,
14
- colour: colour,
15
- style: style,
13
+ client: client,
14
+ colour: colour,
15
+ parent: parent,
16
+ style: style,
17
+ value: _value,
16
18
  }
17
19
  }
18
- let(:views) { [] }
19
- let(:colour) {}
20
- let(:style) {}
20
+ let(:client) {}
21
+ let(:colour) {}
22
+ let(:parent) {}
23
+ let(:style) {}
24
+ let(:_value) {}
21
25
 
22
26
  describe '.build' do
23
27
  subject {
@@ -31,7 +35,18 @@ module Vedeu
31
35
 
32
36
  describe '#initialize' do
33
37
  it { instance.must_be_instance_of(described) }
34
- it { instance.instance_variable_get('@views').must_equal(views) }
38
+ it { instance.instance_variable_get('@client').must_equal(client) }
39
+ it { instance.instance_variable_get('@colour').must_equal(colour) }
40
+ it { instance.instance_variable_get('@parent').must_equal(parent) }
41
+ it { instance.instance_variable_get('@style').must_equal(style) }
42
+ it { instance.instance_variable_get('@value').must_equal(_value) }
43
+ end
44
+
45
+ describe 'accessors' do
46
+ it { instance.must_respond_to(:attributes) }
47
+ it { instance.must_respond_to(:parent) }
48
+ it { instance.must_respond_to(:value) }
49
+ it { instance.must_respond_to(:views) }
35
50
  end
36
51
 
37
52
  describe '#add' do
@@ -39,20 +54,11 @@ module Vedeu
39
54
 
40
55
  subject { instance.add(child) }
41
56
 
42
- it { subject.must_be_instance_of(Vedeu::Views::ViewCollection) }
43
- end
44
-
45
- describe '#views' do
46
- subject { instance.views }
57
+ it { instance.must_respond_to(:<<) }
47
58
 
48
59
  it { subject.must_be_instance_of(Vedeu::Views::ViewCollection) }
49
60
  end
50
61
 
51
- describe '#parent' do
52
- subject { instance.parent }
53
-
54
- it { subject.must_be_instance_of(NilClass) }
55
- end
56
62
 
57
63
  end # Composition
58
64
 
@@ -10,13 +10,13 @@ module Vedeu
10
10
  let(:instance) { described.new(attributes) }
11
11
  let(:attributes) {
12
12
  {
13
- streams: streams,
14
- parent: parent,
15
- colour: colour,
16
- style: style,
13
+ value: _value,
14
+ parent: parent,
15
+ colour: colour,
16
+ style: style,
17
17
  }
18
18
  }
19
- let(:streams) {
19
+ let(:_value) {
20
20
  [
21
21
  Vedeu::Views::Stream.new(value: 'Something interesting ',
22
22
  parent: streams_parent,
@@ -34,10 +34,10 @@ module Vedeu
34
34
  }
35
35
 
36
36
  let(:streams_parent) {
37
- Vedeu::Views::Line.new(streams: nil,
38
- parent: parent,
39
- colour: colour,
40
- style: style)
37
+ Vedeu::Views::Line.new(value: nil,
38
+ parent: parent,
39
+ colour: colour,
40
+ style: style)
41
41
  }
42
42
 
43
43
  let(:parent) { Vedeu::Views::View.new(name: 'Vedeu::Line') }
@@ -48,21 +48,20 @@ module Vedeu
48
48
 
49
49
  describe '#initialize' do
50
50
  it { instance.must_be_instance_of(described) }
51
- it { instance.instance_variable_get('@streams').must_equal(streams) }
51
+ it { instance.instance_variable_get('@value').must_equal(_value) }
52
52
  it { instance.instance_variable_get('@parent').must_equal(parent) }
53
53
  end
54
54
 
55
55
  describe 'accessors' do
56
+ it { instance.must_respond_to(:attributes) }
56
57
  it { instance.must_respond_to(:parent) }
57
58
  it { instance.must_respond_to(:parent=) }
58
- it { instance.must_respond_to(:attributes) }
59
59
  end
60
60
 
61
61
  describe '#add' do
62
62
  subject { instance.add(child) }
63
63
 
64
64
  it { instance.must_respond_to(:add) }
65
-
66
65
  it { instance.must_respond_to(:<<) }
67
66
  end
68
67
 
@@ -72,7 +71,7 @@ module Vedeu
72
71
  it { subject.must_be_instance_of(Array) }
73
72
 
74
73
  context 'when there is no content' do
75
- let(:streams) { [] }
74
+ let(:_value) { [] }
76
75
 
77
76
  it { subject.must_equal([]) }
78
77
  end
@@ -82,20 +81,6 @@ module Vedeu
82
81
  end
83
82
  end
84
83
 
85
- describe '#empty?' do
86
- subject { instance.empty? }
87
-
88
- context 'when there is no content' do
89
- let(:streams) { [] }
90
-
91
- it { subject.must_be_instance_of(TrueClass) }
92
- end
93
-
94
- context 'when there is content' do
95
- it { subject.must_be_instance_of(FalseClass) }
96
- end
97
- end
98
-
99
84
  describe '#eql?' do
100
85
  let(:other) { instance }
101
86
 
@@ -104,26 +89,12 @@ module Vedeu
104
89
  it { subject.must_equal(true) }
105
90
 
106
91
  context 'when different to other' do
107
- let(:other) { described.new(streams: [:other]) }
92
+ let(:other) { described.new(value: [:other]) }
108
93
 
109
94
  it { subject.must_equal(false) }
110
95
  end
111
96
  end
112
97
 
113
- describe '#name' do
114
- subject { instance.name }
115
-
116
- context 'when a parent is defined' do
117
- it { subject.must_be_instance_of(String) }
118
- end
119
-
120
- context 'when a parent is not defined' do
121
- before { instance.stubs(:parent) }
122
-
123
- it { subject.must_be_instance_of(NilClass) }
124
- end
125
- end
126
-
127
98
  describe '#size' do
128
99
  subject { instance.size }
129
100
 
@@ -18,10 +18,10 @@ module Vedeu
18
18
  }
19
19
  let(:_value) { 'Some text' }
20
20
  let(:parent) {
21
- Vedeu::Views::Line.new(streams: [],
22
- parent: line_parent,
23
- colour: parent_colour,
24
- style: style)
21
+ Vedeu::Views::Line.new(value: [],
22
+ parent: line_parent,
23
+ colour: parent_colour,
24
+ style: style)
25
25
  }
26
26
  let(:parent_colour) {
27
27
  Vedeu::Colour.new(background: '#0000ff', foreground: '#ffff00')
@@ -43,7 +43,6 @@ module Vedeu
43
43
  it { instance.must_respond_to(:parent=) }
44
44
  it { instance.must_respond_to(:value) }
45
45
  it { instance.must_respond_to(:content) }
46
- it { instance.must_respond_to(:data) }
47
46
  it { instance.must_respond_to(:text) }
48
47
  it { instance.must_respond_to(:value=) }
49
48
  it { instance.must_respond_to(:attributes) }
@@ -77,20 +76,6 @@ module Vedeu
77
76
  end
78
77
  end
79
78
 
80
- describe '#empty?' do
81
- subject { instance.empty? }
82
-
83
- context 'when there is no content' do
84
- let(:_value) { '' }
85
-
86
- it { subject.must_equal(true) }
87
- end
88
-
89
- context 'when there is content' do
90
- it { subject.must_equal(false) }
91
- end
92
- end
93
-
94
79
  describe '#eql?' do
95
80
  let(:other) { described.new(attributes) }
96
81
 
@@ -107,20 +92,6 @@ module Vedeu
107
92
  end
108
93
  end
109
94
 
110
- describe '#name' do
111
- subject { instance.name }
112
-
113
- context 'when a parent is defined' do
114
- it { subject.must_be_instance_of(String) }
115
- end
116
-
117
- context 'when a parent is not defined' do
118
- before { instance.stubs(:parent) }
119
-
120
- it { subject.must_be_instance_of(NilClass) }
121
- end
122
- end
123
-
124
95
  describe '#size' do
125
96
  subject { instance.size }
126
97
 
@@ -47,9 +47,13 @@ module Vedeu
47
47
  }
48
48
 
49
49
  it { subject.must_equal(
50
- "<td style='background:#220022;color:#aadd00;" \
51
- "border:1px #220022 solid;border-top:1px #aadd00 solid;" \
52
- "border-left:1px #aadd00 solid;'>&nbsp;</td>"
50
+ "<td style='" \
51
+ "border:1px #220022 solid;" \
52
+ "background:#220022;" \
53
+ "color:#aadd00;" \
54
+ "border-top:1px #aadd00 solid;" \
55
+ "border-left:1px #aadd00 solid;" \
56
+ "'>&nbsp;</td>"
53
57
  ) }
54
58
  end
55
59
 
@@ -60,46 +64,22 @@ module Vedeu
60
64
  }
61
65
 
62
66
  it { subject.must_equal(
63
- "<td style='background:#002222;color:#dd2200;" \
64
- "border:1px #002222 solid;border-top:1px #dd2200 solid;" \
65
- "border-left:1px #dd2200 solid;'>&nbsp;</td>"
67
+ "<td style='" \
68
+ "border:1px #002222 solid;" \
69
+ "background:#002222;" \
70
+ "color:#dd2200;" \
71
+ "border-top:1px #dd2200 solid;" \
72
+ "border-left:1px #dd2200 solid;" \
73
+ "'>&nbsp;</td>"
66
74
  ) }
67
75
  end
68
76
 
69
77
  context 'when there is no parent colour' do
70
- it { subject.must_equal(
71
- "<td style='background:#000;color:#222;border:1px #000 solid;" \
72
- "border-top:1px #222 solid;border-left:1px #222 solid;'>" \
73
- "&nbsp;</td>"
74
- ) }
78
+ it { subject.must_equal("<td style=''>&nbsp;</td>") }
75
79
  end
76
80
  end
77
81
  end
78
82
 
79
- grey = '1px #222 solid'
80
- {
81
- top_horizontal: "border-top:#{grey};",
82
- left_vertical: "border-left:#{grey};",
83
- right_vertical: "border-right:#{grey};",
84
- bottom_horizontal: "border-bottom:#{grey};",
85
- top_left: "border-top:#{grey};border-left:#{grey};",
86
- top_right: "border-top:#{grey};border-right:#{grey};",
87
- bottom_left: "border-bottom:#{grey};border-left:#{grey};",
88
- bottom_right: "border-bottom:#{grey};border-right:#{grey};",
89
- horizontal: '',
90
- vertical: ''
91
- }.each do |border_style, result|
92
- context "when there is a border (#{border_style.inspect})" do
93
- let(:border) { border_style }
94
-
95
- it { subject.must_equal(
96
- "<td style='background:#000;color:#222;border:1px #000 solid;" +
97
- result +
98
- "'>&nbsp;</td>"
99
- ) }
100
- end
101
- end
102
-
103
83
  context 'when there is no border' do
104
84
  context 'when there is no value' do
105
85
  it { subject.must_equal('<td>&nbsp;</td>') }
@@ -114,10 +94,7 @@ module Vedeu
114
94
  context 'when there is a value' do
115
95
  let(:_value) { 'a' }
116
96
 
117
- it { subject.must_equal(
118
- "<td style='background:#000;color:#222;" \
119
- "border:1px #000 solid;'>a</td>"
120
- ) }
97
+ it { subject.must_equal("<td style=''>a</td>") }
121
98
  end
122
99
  end
123
100
  end
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  module Vedeu
4
4
 
5
- class ParentPresentationTestClass
5
+ class ParentPresentationColourTestClass
6
6
  include Vedeu::Presentation
7
7
 
8
8
  def parent
@@ -12,22 +12,20 @@ module Vedeu
12
12
  def attributes
13
13
  {
14
14
  colour: { background: '#330000', foreground: '#00aadd' },
15
- style: ['bold']
16
15
  }
17
16
  end
18
17
  end
19
18
 
20
- class PresentationTestClass
19
+ class PresentationColourTestClass
20
+
21
21
  include Vedeu::Presentation
22
22
 
23
23
  attr_reader :attributes
24
+ attr_reader :parent
24
25
 
25
26
  def initialize(attributes = {})
26
27
  @attributes = attributes
27
- end
28
-
29
- def parent
30
- Vedeu::ParentPresentationTestClass.new
28
+ @parent = @attributes[:parent]
31
29
  end
32
30
 
33
31
  end # PresentationTestClass
@@ -36,28 +34,44 @@ module Vedeu
36
34
 
37
35
  describe Colour do
38
36
 
39
- let(:includer) { Vedeu::PresentationTestClass.new(attributes) }
37
+ let(:includer) { Vedeu::PresentationColourTestClass.new(attributes) }
40
38
  let(:attributes) {
41
39
  {
42
- colour: { background: background, foreground: foreground },
43
- style: ['bold']
40
+ colour: colour,
41
+ parent: parent
42
+ }
43
+ }
44
+ let(:colour) {
45
+ {
46
+ background: background,
47
+ foreground: foreground
44
48
  }
45
49
  }
46
50
  let(:background) { '#000033' }
47
51
  let(:foreground) { '#aadd00' }
52
+ let(:parent) { Vedeu::ParentPresentationColourTestClass.new }
48
53
 
49
54
  describe '#background' do
50
55
  subject { includer.background }
51
56
 
52
57
  it { subject.must_be_instance_of(Vedeu::Background) }
53
- it { subject.colour.must_equal('#000033') }
54
58
 
55
- context 'no background value' do
56
- let(:attributes) { {} }
57
- let(:background) {}
59
+ context 'when a colour is not set' do
60
+ let(:colour) {}
61
+
62
+ context 'when a parent is not available' do
63
+ let(:parent) {}
64
+
65
+ it { subject.colour.must_equal('') }
66
+ end
58
67
 
59
- it { subject.must_be_instance_of(Vedeu::Background) }
60
- it { subject.colour.must_equal('#330000') }
68
+ context 'when a parent is available' do
69
+ it { subject.colour.must_equal('#330000') }
70
+ end
71
+ end
72
+
73
+ context 'when a colour is set' do
74
+ it { subject.colour.must_equal('#000033') }
61
75
  end
62
76
  end
63
77
 
@@ -79,12 +93,22 @@ module Vedeu
79
93
  it { subject.must_be_instance_of(Vedeu::Foreground) }
80
94
  it { subject.colour.must_equal('#aadd00') }
81
95
 
82
- context 'no foreground value' do
83
- let(:attributes) { {} }
84
- let(:foreground) {}
96
+ context 'when a colour is not set' do
97
+ let(:colour) {}
98
+
99
+ context 'when a parent is not available' do
100
+ let(:parent) {}
85
101
 
86
- it { subject.must_be_instance_of(Vedeu::Foreground) }
87
- it { subject.colour.must_equal('#00aadd') }
102
+ it { subject.colour.must_equal('') }
103
+ end
104
+
105
+ context 'when a parent is available' do
106
+ it { subject.colour.must_equal('#00aadd') }
107
+ end
108
+ end
109
+
110
+ context 'when a colour is set' do
111
+ it { subject.colour.must_equal('#aadd00') }
88
112
  end
89
113
  end
90
114
 
@@ -100,60 +124,39 @@ module Vedeu
100
124
  it { subject.must_equal('#123456') }
101
125
  end
102
126
 
103
- describe '#parent_background' do
104
- subject { includer.parent_background }
105
-
106
- it { subject.must_be_instance_of(Vedeu::Background) }
107
- it { subject.colour.must_equal('#330000') }
108
-
109
- context 'when no parent colour is set' do
110
- before { includer.stubs(:parent).returns(nil) }
127
+ describe '#colour' do
128
+ subject { includer.colour }
111
129
 
112
- it { subject.colour.must_equal('') }
113
- end
114
- end
130
+ it { subject.must_be_instance_of(Vedeu::Colour) }
115
131
 
116
- describe '#parent_colour' do
117
- subject { includer.parent_colour }
132
+ context 'when a colour is not set' do
133
+ let(:colour) {}
118
134
 
119
- context 'when a parent is available' do
120
- it { subject.must_be_instance_of(Vedeu::Colour) }
121
- it { subject.background.must_be_instance_of(Vedeu::Background) }
122
- it { subject.foreground.must_be_instance_of(Vedeu::Foreground) }
123
- end
135
+ context 'when a parent is not available' do
136
+ let(:parent) {}
124
137
 
125
- context 'when a parent is not available' do
126
- before { includer.stubs(:parent).returns(nil) }
138
+ it { subject.background.colour.must_equal('') }
139
+ it { subject.foreground.colour.must_equal('') }
140
+ end
127
141
 
128
- it { subject.must_equal(nil) }
142
+ context 'when a parent is available' do
143
+ it { subject.background.colour.must_equal('#330000') }
144
+ it { subject.foreground.colour.must_equal('#00aadd') }
145
+ end
129
146
  end
130
- end
131
147
 
132
- describe '#parent_foreground' do
133
- subject { includer.parent_foreground }
134
-
135
- it { subject.must_be_instance_of(Vedeu::Foreground) }
136
- it { subject.colour.must_equal('#00aadd') }
137
-
138
- context 'when no parent colour is set' do
139
- before { includer.stubs(:parent).returns(nil) }
140
-
141
- it { subject.colour.must_equal('') }
148
+ context 'when a colour is set' do
149
+ it { subject.background.colour.must_equal('#000033') }
150
+ it { subject.foreground.colour.must_equal('#aadd00') }
142
151
  end
143
152
  end
144
153
 
145
- describe '#colour' do
146
- subject { includer.colour }
147
-
148
- it { subject.must_be_instance_of(Vedeu::Colour) }
149
- end
150
-
151
154
  describe '#colour=' do
152
155
  let(:colour) {
153
156
  Vedeu::Colour.new(foreground: '#00ff00', background: '#000000')
154
157
  }
155
158
 
156
- subject { includer.colour = (colour) }
159
+ subject { includer.colour=(colour) }
157
160
 
158
161
  it { subject.must_be_instance_of(Vedeu::Colour) }
159
162
  end