vedeu 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,13 +4,14 @@ module Vedeu
4
4
 
5
5
  describe Configuration do
6
6
 
7
- before { Configuration.reset }
8
- after { Configuration.reset }
7
+ before { Configuration.reset! }
8
+ after { test_configuration }
9
9
 
10
10
  describe '#colour_mode' do
11
11
  it 'returns the value of the colour_mode option' do
12
- ENV['VEDEU_TERM'] = 'xterm-truecolor'
12
+ skip
13
13
  Configuration.colour_mode.must_equal(16777216)
14
+ Configuration.colour_mode.must_equal(256)
14
15
  end
15
16
  end
16
17
 
@@ -26,6 +27,13 @@ module Vedeu
26
27
  end
27
28
  end
28
29
 
30
+ describe '#log' do
31
+ it 'returns the value of the log option' do
32
+ skip
33
+ Configuration.log.must_match(/vedeu_test\.log/)
34
+ end
35
+ end
36
+
29
37
  describe '#once?' do
30
38
  it 'returns the value of the once option' do
31
39
  Configuration.once?.must_equal(false)
@@ -48,12 +56,13 @@ module Vedeu
48
56
  it 'returns the options configured' do
49
57
  Configuration.configure.must_equal(
50
58
  {
51
- colour_mode: 16777216,
59
+ colour_mode: 256,
52
60
  debug: false,
53
61
  interactive: true,
62
+ log: '/tmp/vedeu.log',
54
63
  once: false,
55
64
  system_keys: {
56
- exit: "q",
65
+ exit: 'q',
57
66
  focus_next: :tab,
58
67
  focus_prev: :shift_tab,
59
68
  mode_switch: :escape
@@ -8,7 +8,9 @@ module Vedeu
8
8
  let(:menu) { Menu.new(collection) }
9
9
 
10
10
  describe '#initialize' do
11
- it { skip }
11
+ it 'returns a new instance of Menu' do
12
+ menu.must_be_instance_of(Menu)
13
+ end
12
14
  end
13
15
 
14
16
  describe '#current' do
@@ -35,9 +35,8 @@ module Vedeu
35
35
  let(:back) {
36
36
  { name: 'indium', lines: [{ streams: [{ text: 'back' }] }] }
37
37
  }
38
- before do
39
- Buffers.add(back)
40
- end
38
+
39
+ before { Buffers.add(back) }
41
40
 
42
41
  it 'returns the current/front content' do
43
42
  subject.must_equal([
@@ -57,7 +56,9 @@ module Vedeu
57
56
  end
58
57
 
59
58
  context 'when there is no new content' do
60
- let(:front) { { name: 'indium', lines: [{ streams: [{ text: 'front' }] }] } }
59
+ let(:front) {
60
+ { name: 'indium', lines: [{ streams: [{ text: 'front' }] }] }
61
+ }
61
62
 
62
63
  before do
63
64
  Buffers.add(front)
@@ -73,12 +74,14 @@ module Vedeu
73
74
  end
74
75
 
75
76
  context 'when there is no new or current content' do
76
- let(:previous) { { name: 'indium', lines: [{ streams: [{ text: 'previous' }] }] } }
77
+ let(:previous) {
78
+ { name: 'indium', lines: [{ streams: [{ text: 'previous' }] }] }
79
+ }
77
80
 
78
81
  before do
79
- Buffers.add(previous)
80
- Buffers.find('indium').swap
81
- Buffers.find('indium').swap
82
+ Buffers.add(previous) # puts 'previous' on to 'back'
83
+ Buffers.find('indium').swap # puts 'back' ('previous') on to 'front'
84
+ Buffers.find('indium').swap # puts 'front' ('previous') on to 'previous'
82
85
  end
83
86
 
84
87
  it 'returns the previous content' do
@@ -92,9 +95,7 @@ module Vedeu
92
95
  context 'when there is no new, current or previous content' do
93
96
  let(:clear) { { name: 'indium', lines: [] } }
94
97
 
95
- before do
96
- Buffers.add(clear)
97
- end
98
+ before { Buffers.add(clear) }
98
99
 
99
100
  it 'returns the escape sequences to clear the interface' do
100
101
  subject.must_equal(["\e[1;1H \e[1;1H", "\e[1;1H\e[?25l"])
@@ -5,7 +5,9 @@ module Vedeu
5
5
  describe Position do
6
6
 
7
7
  describe '#initialize' do
8
- it { skip }
8
+ it 'returns an instance of Position' do
9
+ Position.new.must_be_instance_of(Position)
10
+ end
9
11
  end
10
12
 
11
13
  describe '#to_s' do
@@ -4,11 +4,11 @@ module Vedeu
4
4
 
5
5
  describe Refresh do
6
6
 
7
+ before { Interfaces.reset }
8
+
7
9
  describe '.all' do
8
10
  it 'returns an empty collection when there are no registered ' \
9
11
  'interfaces' do
10
- Interfaces.reset
11
-
12
12
  Refresh.all.must_equal([])
13
13
  end
14
14
  end
@@ -75,6 +75,14 @@ module Vedeu
75
75
 
76
76
  end
77
77
 
78
+ describe '.reset!' do
79
+ it { Registrar.reset!.must_be_instance_of(TrueClass) }
80
+
81
+ it 'removes all entities from all repositories' do
82
+ skip
83
+ end
84
+ end
85
+
78
86
  end # Registrar
79
87
 
80
88
  end # Vedeu
@@ -42,13 +42,18 @@ module Vedeu
42
42
 
43
43
  describe '#find' do
44
44
  it 'raises an exception when the entity cannot be found' do
45
- proc { RepositoryTestClass.new.find('terbium') }
46
- .must_raise(EntityNotFound)
45
+ proc {
46
+ RepositoryTestClass.new.find('terbium')
47
+ }.must_raise(EntityNotFound)
47
48
  end
48
49
 
49
50
  context 'when the entity is found' do
50
51
  it 'returns the stored entity' do
51
- skip
52
+ entity = { key: :value }
53
+ repo = RepositoryTestClass.new
54
+ repo.add({ 'terbium' => entity })
55
+
56
+ repo.find('terbium').must_equal(entity)
52
57
  end
53
58
  end
54
59
  end
@@ -9,7 +9,9 @@ module Vedeu
9
9
  end
10
10
 
11
11
  describe '#initialize' do
12
- it { skip }
12
+ it 'returns an instance of Trace' do
13
+ Trace.new.must_be_instance_of(Trace)
14
+ end
13
15
  end
14
16
 
15
17
  describe '#trace' do
data/test/test_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'simplecov'
2
2
  require 'pry'
3
3
  require 'minitest/autorun'
4
- require 'minitest/pride'
4
+ require 'minitest/pride' unless ENV['NO_COLOR']
5
5
  require 'minitest/hell'
6
6
 
7
7
  SimpleCov.start do
@@ -15,7 +15,7 @@ module MiniTest
15
15
 
16
16
  class << self
17
17
  alias_method :context, :describe
18
- end
18
+ end # Spec eigenclass
19
19
  end
20
20
  end
21
21
 
@@ -23,10 +23,18 @@ require 'mocha/setup'
23
23
 
24
24
  GC.disable
25
25
 
26
- ENV['VEDEU_TESTMODE'] = '1'
27
-
28
26
  require 'vedeu'
29
27
 
28
+ def test_configuration
29
+ Vedeu.configure do
30
+ debug!
31
+ colour_mode 16777216
32
+ log '/tmp/vedeu_test_helper.log'
33
+ end
34
+ end
35
+
36
+ test_configuration
37
+
30
38
  # commented out by default (makes tests slower)
31
39
  # require 'minitest/reporters'
32
40
  # Minitest::Reporters.use!(
data/vedeu.gemspec CHANGED
@@ -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.2.9'
7
+ spec.version = '0.2.10'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
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.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-02 00:00:00.000000000 Z
11
+ date: 2014-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -186,6 +186,7 @@ files:
186
186
  - docs/api.md
187
187
  - docs/events.md
188
188
  - docs/getting_started.md
189
+ - examples/configuration_app.rb
189
190
  - examples/cursor_app/cursor_app.rb
190
191
  - examples/focus_app.rb
191
192
  - examples/hello_world.rb