vedeu 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +1 -5
 - data/lib/vedeu.rb +6 -6
 - data/lib/vedeu/application.rb +1 -1
 - data/lib/vedeu/{process → input}/input.rb +0 -0
 - data/lib/vedeu/output/background.rb +6 -2
 - data/lib/vedeu/output/base.rb +8 -0
 - data/lib/vedeu/output/compositor.rb +1 -1
 - data/lib/vedeu/output/cursor.rb +49 -53
 - data/lib/vedeu/output/esc.rb +40 -40
 - data/lib/vedeu/output/foreground.rb +6 -2
 - data/lib/vedeu/output/output.rb +19 -0
 - data/lib/vedeu/process/process.rb +1 -1
 - data/lib/vedeu/repository/interface.rb +12 -5
 - data/lib/vedeu/repository/interface_repository.rb +8 -8
 - data/lib/vedeu/{process → support}/event_loop.rb +0 -0
 - data/lib/vedeu/{process → support}/exit.rb +0 -0
 - data/lib/vedeu/{process → support}/queue.rb +4 -0
 - data/lib/vedeu/support/terminal.rb +2 -0
 - data/lib/vedeu/version.rb +1 -1
 - data/test/lib/vedeu/application_test.rb +1 -1
 - data/test/lib/vedeu/{process → input}/input_test.rb +0 -0
 - data/test/lib/vedeu/output/background_test.rb +1 -1
 - data/test/lib/vedeu/output/colour_test.rb +2 -2
 - data/test/lib/vedeu/output/compositor_test.rb +50 -35
 - data/test/lib/vedeu/output/cursor_test.rb +0 -12
 - data/test/lib/vedeu/output/foreground_test.rb +1 -1
 - data/test/lib/vedeu/output/output_test.rb +26 -0
 - data/test/lib/vedeu/process/process_test.rb +7 -3
 - data/test/lib/vedeu/repository/interface_repository_test.rb +4 -10
 - data/test/lib/vedeu/repository/interface_test.rb +4 -6
 - data/test/lib/vedeu/{process → support}/event_loop_test.rb +0 -0
 - data/test/lib/vedeu/{process → support}/exit_test.rb +0 -0
 - data/test/lib/vedeu/{process → support}/queue_test.rb +25 -6
 - data/test/lib/vedeu/support/terminal_test.rb +35 -43
 - metadata +17 -20
 - data/lib/vedeu/output/renderer.rb +0 -21
 - data/lib/vedeu/process/output.rb +0 -25
 - data/test/lib/vedeu/output/renderer_test.rb +0 -37
 - data/test/lib/vedeu/process/output_test.rb +0 -41
 
    
        data/lib/vedeu/version.rb
    CHANGED
    
    
| 
         
            File without changes
         
     | 
| 
         @@ -35,7 +35,7 @@ module Vedeu 
     | 
|
| 
       35 
35 
     | 
    
         
             
                      let(:pair) { [:blue] }
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
                      it 'returns the code for blue on default' do
         
     | 
| 
       38 
     | 
    
         
            -
                        subject.must_equal("\e[38;2;34m\e[48; 
     | 
| 
      
 38 
     | 
    
         
            +
                        subject.must_equal("\e[38;2;34m\e[48;2;49m")
         
     | 
| 
       39 
39 
     | 
    
         
             
                      end
         
     | 
| 
       40 
40 
     | 
    
         
             
                    end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
         @@ -43,7 +43,7 @@ module Vedeu 
     | 
|
| 
       43 
43 
     | 
    
         
             
                      let(:pair) { [nil, :cyan] }
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
                      it 'returns the code for default with cyan background' do
         
     | 
| 
       46 
     | 
    
         
            -
                        subject.must_equal("\e[38; 
     | 
| 
      
 46 
     | 
    
         
            +
                        subject.must_equal("\e[38;2;39m\e[48;2;46m")
         
     | 
| 
       47 
47 
     | 
    
         
             
                      end
         
     | 
| 
       48 
48 
     | 
    
         
             
                    end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
         @@ -10,9 +10,8 @@ module Vedeu 
     | 
|
| 
       10 
10 
     | 
    
         
             
                let(:interface)          { 'dummy' }
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                before do
         
     | 
| 
       13 
     | 
    
         
            -
                  Interface.create({ name: 'dummy' })
         
     | 
| 
       14 
     | 
    
         
            -
                  Interface.create({ name: 'test_interface' })
         
     | 
| 
       15 
     | 
    
         
            -
                  Renderer.stubs(:write).returns(stream)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  Interface.create({ name: 'dummy', width: 15, height: 2 })
         
     | 
| 
      
 14 
     | 
    
         
            +
                  Interface.create({ name: 'test_interface', width: 15, height: 2 })
         
     | 
| 
       16 
15 
     | 
    
         
             
                end
         
     | 
| 
       17 
16 
     | 
    
         | 
| 
       18 
17 
     | 
    
         
             
                after do
         
     | 
| 
         @@ -60,22 +59,28 @@ module Vedeu 
     | 
|
| 
       60 
59 
     | 
    
         | 
| 
       61 
60 
     | 
    
         
             
                  context 'when unstyled' do
         
     | 
| 
       62 
61 
     | 
    
         
             
                    context 'and a single line' do
         
     | 
| 
       63 
     | 
    
         
            -
                      let(:output) { [['Some text...']] }
         
     | 
| 
       64 
     | 
    
         
            -
                      let(:stream) { 
     | 
| 
      
 62 
     | 
    
         
            +
                      let(:output) { { 'dummy' => [['Some text...']] } }
         
     | 
| 
      
 63 
     | 
    
         
            +
                      let(:stream) {
         
     | 
| 
      
 64 
     | 
    
         
            +
                        [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1HSome text...\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
      
 65 
     | 
    
         
            +
                      }
         
     | 
| 
       65 
66 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                      it 'returns  
     | 
| 
      
 67 
     | 
    
         
            +
                      it 'returns the enqueue composition' do
         
     | 
| 
       67 
68 
     | 
    
         
             
                        subject.must_equal(stream)
         
     | 
| 
       68 
69 
     | 
    
         
             
                      end
         
     | 
| 
       69 
70 
     | 
    
         
             
                    end
         
     | 
| 
       70 
71 
     | 
    
         | 
| 
       71 
72 
     | 
    
         
             
                    context 'and multi-line' do
         
     | 
| 
       72 
73 
     | 
    
         
             
                      let(:output) {
         
     | 
| 
       73 
     | 
    
         
            -
                         
     | 
| 
       74 
     | 
    
         
            -
                           
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
                        {
         
     | 
| 
      
 75 
     | 
    
         
            +
                          'dummy' => [
         
     | 
| 
      
 76 
     | 
    
         
            +
                            ['Some text...'],
         
     | 
| 
      
 77 
     | 
    
         
            +
                            ['Some more text...']
         
     | 
| 
      
 78 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 79 
     | 
    
         
            +
                        }
         
     | 
| 
      
 80 
     | 
    
         
            +
                      }
         
     | 
| 
      
 81 
     | 
    
         
            +
                      let(:stream) {
         
     | 
| 
      
 82 
     | 
    
         
            +
                        [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1HSome text...\e[2;1H               \e[2;1H", "\e[1;1H               \e[1;1HSome more tex...\e[0m\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
       77 
83 
     | 
    
         
             
                      }
         
     | 
| 
       78 
     | 
    
         
            -
                      let(:stream) { "Some text...\nSome more text..." }
         
     | 
| 
       79 
84 
     | 
    
         | 
| 
       80 
85 
     | 
    
         
             
                      it 'returns a String' do
         
     | 
| 
       81 
86 
     | 
    
         
             
                        subject.must_equal(stream)
         
     | 
| 
         @@ -87,11 +92,15 @@ module Vedeu 
     | 
|
| 
       87 
92 
     | 
    
         
             
                    context 'with colour pair' do
         
     | 
| 
       88 
93 
     | 
    
         
             
                      context 'and a single line' do
         
     | 
| 
       89 
94 
     | 
    
         
             
                        let(:output) {
         
     | 
| 
       90 
     | 
    
         
            -
                           
     | 
| 
       91 
     | 
    
         
            -
                             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
      
 95 
     | 
    
         
            +
                          {
         
     | 
| 
      
 96 
     | 
    
         
            +
                            'dummy' => [
         
     | 
| 
      
 97 
     | 
    
         
            +
                              [{ colour: [:red, :white] }, 'Some text...']
         
     | 
| 
      
 98 
     | 
    
         
            +
                            ]
         
     | 
| 
      
 99 
     | 
    
         
            +
                          }
         
     | 
| 
      
 100 
     | 
    
         
            +
                        }
         
     | 
| 
      
 101 
     | 
    
         
            +
                        let(:stream) {
         
     | 
| 
      
 102 
     | 
    
         
            +
                          [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[38;2;31m\e[48;2;47m\e[2;1H               \e[2;1HSome text...", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
       93 
103 
     | 
    
         
             
                        }
         
     | 
| 
       94 
     | 
    
         
            -
                        let(:stream) { "\e[38;5;31m\e[48;5;47mSome text..." }
         
     | 
| 
       95 
104 
     | 
    
         | 
| 
       96 
105 
     | 
    
         
             
                        it 'returns a String' do
         
     | 
| 
       97 
106 
     | 
    
         
             
                          subject.must_equal(stream)
         
     | 
| 
         @@ -100,14 +109,15 @@ module Vedeu 
     | 
|
| 
       100 
109 
     | 
    
         | 
| 
       101 
110 
     | 
    
         
             
                      context 'and multi-line' do
         
     | 
| 
       102 
111 
     | 
    
         
             
                        let(:output) {
         
     | 
| 
       103 
     | 
    
         
            -
                           
     | 
| 
       104 
     | 
    
         
            -
                             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
      
 112 
     | 
    
         
            +
                          {
         
     | 
| 
      
 113 
     | 
    
         
            +
                            'dummy' => [
         
     | 
| 
      
 114 
     | 
    
         
            +
                              [{ colour: [:red, :white] },   'Some text...'],
         
     | 
| 
      
 115 
     | 
    
         
            +
                              [{ colour: [:blue, :yellow] }, 'Some more text...']
         
     | 
| 
      
 116 
     | 
    
         
            +
                            ]
         
     | 
| 
      
 117 
     | 
    
         
            +
                          }
         
     | 
| 
       107 
118 
     | 
    
         
             
                        }
         
     | 
| 
       108 
119 
     | 
    
         
             
                        let(:stream) {
         
     | 
| 
       109 
     | 
    
         
            -
                          "\e[38; 
     | 
| 
       110 
     | 
    
         
            -
                          "\e[38;5;34m\e[48;5;43mSome more text..."
         
     | 
| 
      
 120 
     | 
    
         
            +
                          [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[38;2;31m\e[48;2;47m\e[2;1H               \e[2;1HSome text...", "\e[1;1H               \e[1;1H\e[38;2;34m\e[48;2;43m\e[2;1H               \e[2;1HSome more tex...\e[0m", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
       111 
121 
     | 
    
         
             
                        }
         
     | 
| 
       112 
122 
     | 
    
         | 
| 
       113 
123 
     | 
    
         
             
                        it 'returns a String' do
         
     | 
| 
         @@ -119,12 +129,14 @@ module Vedeu 
     | 
|
| 
       119 
129 
     | 
    
         
             
                    context 'with a style' do
         
     | 
| 
       120 
130 
     | 
    
         
             
                      context 'and a single line' do
         
     | 
| 
       121 
131 
     | 
    
         
             
                        let(:output) {
         
     | 
| 
       122 
     | 
    
         
            -
                           
     | 
| 
       123 
     | 
    
         
            -
                             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
      
 132 
     | 
    
         
            +
                          {
         
     | 
| 
      
 133 
     | 
    
         
            +
                            'dummy' => [
         
     | 
| 
      
 134 
     | 
    
         
            +
                              [{ style: :bold }, 'Some text...']
         
     | 
| 
      
 135 
     | 
    
         
            +
                            ]
         
     | 
| 
      
 136 
     | 
    
         
            +
                          }
         
     | 
| 
       125 
137 
     | 
    
         
             
                        }
         
     | 
| 
       126 
138 
     | 
    
         
             
                        let(:stream) {
         
     | 
| 
       127 
     | 
    
         
            -
                          "\e[ 
     | 
| 
      
 139 
     | 
    
         
            +
                          [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[1m\e[2;1H               \e[2;1HSome text...", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
       128 
140 
     | 
    
         
             
                        }
         
     | 
| 
       129 
141 
     | 
    
         | 
| 
       130 
142 
     | 
    
         
             
                        it 'returns a String' do
         
     | 
| 
         @@ -134,14 +146,15 @@ module Vedeu 
     | 
|
| 
       134 
146 
     | 
    
         | 
| 
       135 
147 
     | 
    
         
             
                      context 'and multi-line' do
         
     | 
| 
       136 
148 
     | 
    
         
             
                        let(:output) {
         
     | 
| 
       137 
     | 
    
         
            -
                           
     | 
| 
       138 
     | 
    
         
            -
                             
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
      
 149 
     | 
    
         
            +
                          {
         
     | 
| 
      
 150 
     | 
    
         
            +
                            'dummy' => [
         
     | 
| 
      
 151 
     | 
    
         
            +
                              [{ style: :inverse },   'Some text...'],
         
     | 
| 
      
 152 
     | 
    
         
            +
                              [{ style: :underline }, 'Some more text...']
         
     | 
| 
      
 153 
     | 
    
         
            +
                            ]
         
     | 
| 
      
 154 
     | 
    
         
            +
                          }
         
     | 
| 
       141 
155 
     | 
    
         
             
                        }
         
     | 
| 
       142 
156 
     | 
    
         
             
                        let(:stream) {
         
     | 
| 
       143 
     | 
    
         
            -
                          "\e[ 
     | 
| 
       144 
     | 
    
         
            -
                          "\e[4mSome more text..."
         
     | 
| 
      
 157 
     | 
    
         
            +
                          [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[7m\e[2;1H               \e[2;1HSome text...", "\e[1;1H               \e[1;1H\e[4m\e[2;1H               \e[2;1HSome more tex...\e[0m", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
       145 
158 
     | 
    
         
             
                        }
         
     | 
| 
       146 
159 
     | 
    
         | 
| 
       147 
160 
     | 
    
         
             
                        it 'returns a String' do
         
     | 
| 
         @@ -152,12 +165,14 @@ module Vedeu 
     | 
|
| 
       152 
165 
     | 
    
         | 
| 
       153 
166 
     | 
    
         
             
                    context 'with an unknown style' do
         
     | 
| 
       154 
167 
     | 
    
         
             
                      let(:output) {
         
     | 
| 
       155 
     | 
    
         
            -
                         
     | 
| 
       156 
     | 
    
         
            -
                           
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
      
 168 
     | 
    
         
            +
                        {
         
     | 
| 
      
 169 
     | 
    
         
            +
                          'dummy' => [
         
     | 
| 
      
 170 
     | 
    
         
            +
                            [{ style: :unknown }, 'Some text...']
         
     | 
| 
      
 171 
     | 
    
         
            +
                          ]
         
     | 
| 
      
 172 
     | 
    
         
            +
                        }
         
     | 
| 
       158 
173 
     | 
    
         
             
                      }
         
     | 
| 
       159 
174 
     | 
    
         
             
                      let(:stream) {
         
     | 
| 
       160 
     | 
    
         
            -
                        " 
     | 
| 
      
 175 
     | 
    
         
            +
                        [[["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1HSome text...", "\e[38;2;39m\e[48;2;49m", "\e[?25h"], ["\e[38;2;39m\e[48;2;49m", "\e[1;1H               \e[1;1H\e[2;1H               \e[2;1H", "\e[38;2;39m\e[48;2;49m", "\e[?25h"]]]
         
     | 
| 
       161 
176 
     | 
    
         
             
                      }
         
     | 
| 
       162 
177 
     | 
    
         | 
| 
       163 
178 
     | 
    
         
             
                      it 'renders in the default style' do
         
     | 
| 
         @@ -171,17 +171,5 @@ module Vedeu 
     | 
|
| 
       171 
171 
     | 
    
         
             
                    subject.must_equal("\e[8")
         
     | 
| 
       172 
172 
     | 
    
         
             
                  end
         
     | 
| 
       173 
173 
     | 
    
         
             
                end
         
     | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
       175 
     | 
    
         
            -
                describe '.esc' do
         
     | 
| 
       176 
     | 
    
         
            -
                  let(:subject) { described_class.esc }
         
     | 
| 
       177 
     | 
    
         
            -
             
     | 
| 
       178 
     | 
    
         
            -
                  it 'returns a String' do
         
     | 
| 
       179 
     | 
    
         
            -
                    subject.must_be_instance_of(String)
         
     | 
| 
       180 
     | 
    
         
            -
                  end
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
                  it 'returns an escape sequence' do
         
     | 
| 
       183 
     | 
    
         
            -
                    subject.must_equal("\e[")
         
     | 
| 
       184 
     | 
    
         
            -
                  end
         
     | 
| 
       185 
     | 
    
         
            -
                end
         
     | 
| 
       186 
174 
     | 
    
         
             
              end
         
     | 
| 
       187 
175 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative '../../../test_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Vedeu
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe Output do
         
     | 
| 
      
 5 
     | 
    
         
            +
                let(:described_class) { Output }
         
     | 
| 
      
 6 
     | 
    
         
            +
                let(:subject)         { described_class.new }
         
     | 
| 
      
 7 
     | 
    
         
            +
                let(:result)          {}
         
     | 
| 
      
 8 
     | 
    
         
            +
                let(:queued_result)   { { 'dummy' => [['queued...']] } }
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                before do
         
     | 
| 
      
 11 
     | 
    
         
            +
                  Interface.create({ name: 'dummy', width: 10, height: 2, cursor: true })
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                after do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  InterfaceRepository.reset
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                it 'returns an Output instance' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                  subject.must_be_instance_of(Output)
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                describe '.render' do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  let(:subject) { described_class.render }
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -16,13 +16,17 @@ module Vedeu 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  let(:command) { Command.new }
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                  before do
         
     | 
| 
      
 19 
     | 
    
         
            +
                    Interface.create({ name: 'dummy' })
         
     | 
| 
       19 
20 
     | 
    
         
             
                    Queue.stubs(:dequeue).returns(input)
         
     | 
| 
       20 
21 
     | 
    
         
             
                    CommandRepository.stubs(:by_keypress).returns(command)
         
     | 
| 
       21 
22 
     | 
    
         
             
                    CommandRepository.stubs(:by_keyword).returns(command)
         
     | 
| 
       22 
23 
     | 
    
         
             
                    command.stubs(:execute).returns(result)
         
     | 
| 
       23 
24 
     | 
    
         
             
                  end
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                  after  
     | 
| 
      
 26 
     | 
    
         
            +
                  after do
         
     | 
| 
      
 27 
     | 
    
         
            +
                    InterfaceRepository.reset
         
     | 
| 
      
 28 
     | 
    
         
            +
                    Queue.clear
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
       26 
30 
     | 
    
         | 
| 
       27 
31 
     | 
    
         
             
                  context 'when there is no input' do
         
     | 
| 
       28 
32 
     | 
    
         
             
                    it 'returns a NilClass' do
         
     | 
| 
         @@ -48,7 +52,7 @@ module Vedeu 
     | 
|
| 
       48 
52 
     | 
    
         
             
                    end
         
     | 
| 
       49 
53 
     | 
    
         | 
| 
       50 
54 
     | 
    
         
             
                    context 'or the result is anything else' do
         
     | 
| 
       51 
     | 
    
         
            -
                      let(:result) {  
     | 
| 
      
 55 
     | 
    
         
            +
                      let(:result) { { 'dummy' => [['output...']] } }
         
     | 
| 
       52 
56 
     | 
    
         | 
| 
       53 
57 
     | 
    
         
             
                      it 'returns an Array' do
         
     | 
| 
       54 
58 
     | 
    
         
             
                        subject.must_be_instance_of(Array)
         
     | 
| 
         @@ -74,7 +78,7 @@ module Vedeu 
     | 
|
| 
       74 
78 
     | 
    
         
             
                    end
         
     | 
| 
       75 
79 
     | 
    
         | 
| 
       76 
80 
     | 
    
         
             
                    context 'or the result is anything else' do
         
     | 
| 
       77 
     | 
    
         
            -
                      let(:result) {  
     | 
| 
      
 81 
     | 
    
         
            +
                      let(:result) { { 'dummy' => [['output...']] } }
         
     | 
| 
       78 
82 
     | 
    
         | 
| 
       79 
83 
     | 
    
         
             
                      it 'returns an Array' do
         
     | 
| 
       80 
84 
     | 
    
         
             
                        subject.must_be_instance_of(Array)
         
     | 
| 
         @@ -8,6 +8,8 @@ module Vedeu 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                before { Interface.create({ name: 'dummy' }) }
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
                after { InterfaceRepository.reset }
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       11 
13 
     | 
    
         
             
                describe '.activate' do
         
     | 
| 
       12 
14 
     | 
    
         
             
                  let(:subject) { described_class.activate(interface) }
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
         @@ -40,19 +42,11 @@ module Vedeu 
     | 
|
| 
       40 
42 
     | 
    
         
             
                  end
         
     | 
| 
       41 
43 
     | 
    
         
             
                end
         
     | 
| 
       42 
44 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                describe '.initial_state' do
         
     | 
| 
       44 
     | 
    
         
            -
                  let(:subject) { described_class.initial_state }
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  before { Compositor.stubs(:arrange) }
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                  it 'returns an Array' do
         
     | 
| 
       49 
     | 
    
         
            -
                    subject.must_be_instance_of(Array)
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
                end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
45 
     | 
    
         
             
                describe '.update' do
         
     | 
| 
       54 
46 
     | 
    
         
             
                  let(:subject) { described_class.update }
         
     | 
| 
       55 
47 
     | 
    
         | 
| 
      
 48 
     | 
    
         
            +
                  before { Compositor.stubs(:arrange) }
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       56 
50 
     | 
    
         
             
                  it 'returns an Array' do
         
     | 
| 
       57 
51 
     | 
    
         
             
                    subject.must_be_instance_of(Array)
         
     | 
| 
       58 
52 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -43,13 +43,11 @@ module Vedeu 
     | 
|
| 
       43 
43 
     | 
    
         
             
                  end
         
     | 
| 
       44 
44 
     | 
    
         
             
                end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                describe '# 
     | 
| 
       47 
     | 
    
         
            -
                  let(:subject) { described_instance. 
     | 
| 
      
 46 
     | 
    
         
            +
                describe '#update' do
         
     | 
| 
      
 47 
     | 
    
         
            +
                  let(:subject) { described_instance.update }
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                  it 'returns a NilClass' do
         
     | 
| 
       52 
     | 
    
         
            -
                    subject.must_be_instance_of(NilClass)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  it 'returns a Array' do
         
     | 
| 
      
 50 
     | 
    
         
            +
                    subject.must_be_instance_of(Array)
         
     | 
| 
       53 
51 
     | 
    
         
             
                  end
         
     | 
| 
       54 
52 
     | 
    
         
             
                end
         
     | 
| 
       55 
53 
     | 
    
         | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -4,20 +4,21 @@ module Vedeu 
     | 
|
| 
       4 
4 
     | 
    
         
             
              describe Queue do
         
     | 
| 
       5 
5 
     | 
    
         
             
                let(:described_class) { Queue }
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                before { described_class. 
     | 
| 
      
 7 
     | 
    
         
            +
                before { described_class.enqueue(:result) }
         
     | 
| 
      
 8 
     | 
    
         
            +
                after  { described_class.clear }
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
                describe '.dequeue' do
         
     | 
| 
       10 
11 
     | 
    
         
             
                  let(:subject) { described_class.dequeue }
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
13 
     | 
    
         
             
                  context 'when the queue is empty' do
         
     | 
| 
      
 14 
     | 
    
         
            +
                    before { described_class.clear }
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       13 
16 
     | 
    
         
             
                    it 'returns a NilClass' do
         
     | 
| 
       14 
17 
     | 
    
         
             
                      subject.must_be_instance_of(NilClass)
         
     | 
| 
       15 
18 
     | 
    
         
             
                    end
         
     | 
| 
       16 
19 
     | 
    
         
             
                  end
         
     | 
| 
       17 
20 
     | 
    
         | 
| 
       18 
21 
     | 
    
         
             
                  context 'when the queue is not empty' do
         
     | 
| 
       19 
     | 
    
         
            -
                    before { described_class.enqueue(:result) }
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
22 
     | 
    
         
             
                    it 'returns the first entry added' do
         
     | 
| 
       22 
23 
     | 
    
         
             
                      subject.must_be_instance_of(Symbol)
         
     | 
| 
       23 
24 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -33,7 +34,25 @@ module Vedeu 
     | 
|
| 
       33 
34 
     | 
    
         
             
                  end
         
     | 
| 
       34 
35 
     | 
    
         | 
| 
       35 
36 
     | 
    
         
             
                  it 'contains the enqueued item' do
         
     | 
| 
       36 
     | 
    
         
            -
                    subject.size.must_equal( 
     | 
| 
      
 37 
     | 
    
         
            +
                    subject.size.must_equal(2)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                describe '.enqueued?' do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  let(:subject) { described_class.enqueued? }
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  context 'when the queue contains data' do
         
     | 
| 
      
 45 
     | 
    
         
            +
                    it 'returns a TrueClass' do
         
     | 
| 
      
 46 
     | 
    
         
            +
                      subject.must_be_instance_of(TrueClass)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    end
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  context 'when the queue is empty' do
         
     | 
| 
      
 51 
     | 
    
         
            +
                    before { described_class.clear }
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                    it 'returns a FalseClass' do
         
     | 
| 
      
 54 
     | 
    
         
            +
                      subject.must_be_instance_of(FalseClass)
         
     | 
| 
      
 55 
     | 
    
         
            +
                    end
         
     | 
| 
       37 
56 
     | 
    
         
             
                  end
         
     | 
| 
       38 
57 
     | 
    
         
             
                end
         
     | 
| 
       39 
58 
     | 
    
         | 
| 
         @@ -45,7 +64,7 @@ module Vedeu 
     | 
|
| 
       45 
64 
     | 
    
         
             
                  end
         
     | 
| 
       46 
65 
     | 
    
         | 
| 
       47 
66 
     | 
    
         
             
                  it 'returns the size of the queue' do
         
     | 
| 
       48 
     | 
    
         
            -
                    subject.must_equal( 
     | 
| 
      
 67 
     | 
    
         
            +
                    subject.must_equal(1)
         
     | 
| 
       49 
68 
     | 
    
         
             
                  end
         
     | 
| 
       50 
69 
     | 
    
         
             
                end
         
     | 
| 
       51 
70 
     | 
    
         | 
| 
         @@ -69,7 +88,7 @@ module Vedeu 
     | 
|
| 
       69 
88 
     | 
    
         
             
                  end
         
     | 
| 
       70 
89 
     | 
    
         | 
| 
       71 
90 
     | 
    
         
             
                  it 'returns the queue as a String' do
         
     | 
| 
       72 
     | 
    
         
            -
                    subject.must_equal("[]")
         
     | 
| 
      
 91 
     | 
    
         
            +
                    subject.must_equal("[:result]")
         
     | 
| 
       73 
92 
     | 
    
         
             
                  end
         
     | 
| 
       74 
93 
     | 
    
         
             
                end
         
     | 
| 
       75 
94 
     | 
    
         
             
              end
         
     | 
| 
         @@ -28,14 +28,12 @@ module Vedeu 
     | 
|
| 
       28 
28 
     | 
    
         
             
                describe '.output' do
         
     | 
| 
       29 
29 
     | 
    
         
             
                  let(:subject) { described_class.output }
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                  before { console.stubs(:print).returns("test") }
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
31 
     | 
    
         
             
                  it 'returns a String' do
         
     | 
| 
       34 
32 
     | 
    
         
             
                    subject.must_be_instance_of(String)
         
     | 
| 
       35 
33 
     | 
    
         
             
                  end
         
     | 
| 
       36 
34 
     | 
    
         | 
| 
       37 
35 
     | 
    
         
             
                  it 'returns the output' do
         
     | 
| 
       38 
     | 
    
         
            -
                    subject.must_equal(" 
     | 
| 
      
 36 
     | 
    
         
            +
                    subject.must_equal("")
         
     | 
| 
       39 
37 
     | 
    
         
             
                  end
         
     | 
| 
       40 
38 
     | 
    
         
             
                end
         
     | 
| 
       41 
39 
     | 
    
         | 
| 
         @@ -86,8 +84,12 @@ module Vedeu 
     | 
|
| 
       86 
84 
     | 
    
         
             
                describe '.close' do
         
     | 
| 
       87 
85 
     | 
    
         
             
                  let(:subject) { described_class.close }
         
     | 
| 
       88 
86 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                  it 'returns a  
     | 
| 
       90 
     | 
    
         
            -
                    subject.must_be_instance_of( 
     | 
| 
      
 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")
         
     | 
| 
       91 
93 
     | 
    
         
             
                  end
         
     | 
| 
       92 
94 
     | 
    
         
             
                end
         
     | 
| 
       93 
95 
     | 
    
         | 
| 
         @@ -120,18 +122,12 @@ module Vedeu 
     | 
|
| 
       120 
122 
     | 
    
         
             
                describe '.clear_screen' do
         
     | 
| 
       121 
123 
     | 
    
         
             
                  let(:subject) { described_class.clear_screen }
         
     | 
| 
       122 
124 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
                   
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                  it 'returns a NilClass' do
         
     | 
| 
       126 
     | 
    
         
            -
                    subject.must_be_instance_of(NilClass)
         
     | 
| 
      
 125 
     | 
    
         
            +
                  it 'returns a String' do
         
     | 
| 
      
 126 
     | 
    
         
            +
                    subject.must_be_instance_of(String)
         
     | 
| 
       127 
127 
     | 
    
         
             
                  end
         
     | 
| 
       128 
128 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
                   
     | 
| 
       130 
     | 
    
         
            -
                     
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                    it 'returns a String' do
         
     | 
| 
       133 
     | 
    
         
            -
                      io.must_be_instance_of(String)
         
     | 
| 
       134 
     | 
    
         
            -
                    end
         
     | 
| 
      
 129 
     | 
    
         
            +
                  it 'returns an escape sequence' do
         
     | 
| 
      
 130 
     | 
    
         
            +
                    subject.must_equal("\e[2J")
         
     | 
| 
       135 
131 
     | 
    
         
             
                  end
         
     | 
| 
       136 
132 
     | 
    
         
             
                end
         
     | 
| 
       137 
133 
     | 
    
         | 
| 
         @@ -139,56 +135,48 @@ module Vedeu 
     | 
|
| 
       139 
135 
     | 
    
         
             
                  let(:subject) { described_class.clear_line(index) }
         
     | 
| 
       140 
136 
     | 
    
         
             
                  let(:index)   { 0 }
         
     | 
| 
       141 
137 
     | 
    
         | 
| 
       142 
     | 
    
         
            -
                  it 'returns a  
     | 
| 
       143 
     | 
    
         
            -
                    subject.must_be_instance_of( 
     | 
| 
      
 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[0;1H                                                                                \e[0;1H")
         
     | 
| 
       144 
144 
     | 
    
         
             
                  end
         
     | 
| 
       145 
145 
     | 
    
         
             
                end
         
     | 
| 
       146 
146 
     | 
    
         | 
| 
       147 
147 
     | 
    
         
             
                describe '.show_cursor' do
         
     | 
| 
       148 
148 
     | 
    
         
             
                  let(:subject) { described_class.show_cursor }
         
     | 
| 
       149 
149 
     | 
    
         | 
| 
       150 
     | 
    
         
            -
                  it 'returns a  
     | 
| 
       151 
     | 
    
         
            -
                    subject.must_be_instance_of( 
     | 
| 
      
 150 
     | 
    
         
            +
                  it 'returns a String' do
         
     | 
| 
      
 151 
     | 
    
         
            +
                    subject.must_be_instance_of(String)
         
     | 
| 
       152 
152 
     | 
    
         
             
                  end
         
     | 
| 
       153 
153 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
                   
     | 
| 
       155 
     | 
    
         
            -
                     
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                    it 'returns a String' do
         
     | 
| 
       158 
     | 
    
         
            -
                      io.must_be_instance_of(String)
         
     | 
| 
       159 
     | 
    
         
            -
                    end
         
     | 
| 
      
 154 
     | 
    
         
            +
                  it 'returns an escape sequence' do
         
     | 
| 
      
 155 
     | 
    
         
            +
                    subject.must_equal("\e[?25h")
         
     | 
| 
       160 
156 
     | 
    
         
             
                  end
         
     | 
| 
       161 
157 
     | 
    
         
             
                end
         
     | 
| 
       162 
158 
     | 
    
         | 
| 
       163 
159 
     | 
    
         
             
                describe '.hide_cursor' do
         
     | 
| 
       164 
160 
     | 
    
         
             
                  let(:subject) { described_class.hide_cursor }
         
     | 
| 
       165 
161 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
                  it 'returns a  
     | 
| 
       167 
     | 
    
         
            -
                    subject.must_be_instance_of( 
     | 
| 
      
 162 
     | 
    
         
            +
                  it 'returns a String' do
         
     | 
| 
      
 163 
     | 
    
         
            +
                    subject.must_be_instance_of(String)
         
     | 
| 
       168 
164 
     | 
    
         
             
                  end
         
     | 
| 
       169 
165 
     | 
    
         | 
| 
       170 
     | 
    
         
            -
                   
     | 
| 
       171 
     | 
    
         
            -
                     
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
       173 
     | 
    
         
            -
                    it 'returns a String' do
         
     | 
| 
       174 
     | 
    
         
            -
                      io.must_be_instance_of(String)
         
     | 
| 
       175 
     | 
    
         
            -
                    end
         
     | 
| 
      
 166 
     | 
    
         
            +
                  it 'returns an escape sequence' do
         
     | 
| 
      
 167 
     | 
    
         
            +
                    subject.must_equal("\e[?25l")
         
     | 
| 
       176 
168 
     | 
    
         
             
                  end
         
     | 
| 
       177 
169 
     | 
    
         
             
                end
         
     | 
| 
       178 
170 
     | 
    
         | 
| 
       179 
171 
     | 
    
         
             
                describe '.reset_colours' do
         
     | 
| 
       180 
172 
     | 
    
         
             
                  let(:subject) { described_class.reset_colours }
         
     | 
| 
       181 
173 
     | 
    
         | 
| 
       182 
     | 
    
         
            -
                  it 'returns a  
     | 
| 
       183 
     | 
    
         
            -
                    subject.must_be_instance_of( 
     | 
| 
      
 174 
     | 
    
         
            +
                  it 'returns a String' do
         
     | 
| 
      
 175 
     | 
    
         
            +
                    subject.must_be_instance_of(String)
         
     | 
| 
       184 
176 
     | 
    
         
             
                  end
         
     | 
| 
       185 
177 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
                   
     | 
| 
       187 
     | 
    
         
            -
                     
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
                    it 'returns a String' do
         
     | 
| 
       190 
     | 
    
         
            -
                      io.must_be_instance_of(String)
         
     | 
| 
       191 
     | 
    
         
            -
                    end
         
     | 
| 
      
 178 
     | 
    
         
            +
                  it 'returns an escape sequence' do
         
     | 
| 
      
 179 
     | 
    
         
            +
                    subject.must_equal("\e[0m")
         
     | 
| 
       192 
180 
     | 
    
         
             
                  end
         
     | 
| 
       193 
181 
     | 
    
         
             
                end
         
     | 
| 
       194 
182 
     | 
    
         | 
| 
         @@ -211,8 +199,12 @@ module Vedeu 
     | 
|
| 
       211 
199 
     | 
    
         
             
                describe '#initial_setup!' do
         
     | 
| 
       212 
200 
     | 
    
         
             
                  let(:subject) { described_class.new.initial_setup! }
         
     | 
| 
       213 
201 
     | 
    
         | 
| 
       214 
     | 
    
         
            -
                  it 'returns a  
     | 
| 
       215 
     | 
    
         
            -
                    subject.must_be_instance_of( 
     | 
| 
      
 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")
         
     | 
| 
       216 
208 
     | 
    
         
             
                  end
         
     | 
| 
       217 
209 
     | 
    
         
             
                end
         
     | 
| 
       218 
210 
     | 
    
         
             
              end
         
     |