vedeu 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/step_definitions/vedeu_steps.rb +2 -2
- data/lib/vedeu/output/compositor.rb +23 -30
- data/lib/vedeu/output/output.rb +1 -1
- data/lib/vedeu/repository/command.rb +5 -5
- data/lib/vedeu/repository/command_repository.rb +3 -3
- data/lib/vedeu/repository/dummy_command.rb +1 -1
- data/lib/vedeu/repository/dummy_interface.rb +1 -1
- data/lib/vedeu/repository/interface.rb +2 -4
- data/lib/vedeu/repository/interface_repository.rb +9 -27
- data/lib/vedeu/repository/repository.rb +6 -6
- data/lib/vedeu/repository/storage.rb +13 -16
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/output/compositor_test.rb +16 -40
- data/test/lib/vedeu/repository/command_repository_test.rb +4 -4
- data/test/lib/vedeu/repository/command_test.rb +2 -2
- data/test/lib/vedeu/repository/interface_repository_test.rb +16 -32
- data/test/lib/vedeu/repository/interface_test.rb +2 -6
- data/test/lib/vedeu/repository/repository_test.rb +7 -9
- data/test/lib/vedeu/repository/storage_test.rb +6 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6ed6d21f04e9b8b6f98a8d1afb25e8f020d92a6
|
4
|
+
data.tar.gz: f0d1c0b2cf28c40d11d975b839fe200d2a775b20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c994a800613efaed9cc001808d496252e92e4cd697854ca2fbe6d73b052cf0be9ea12609e988d865776f48165aa17b930788169a34b8034534bdb782a578ad1
|
7
|
+
data.tar.gz: ed9a5b2ae734d278f040c83c91b498c1a853069efedec1c39e3c7e1aea18daf77a310f5c5444ddd416d3554db626f61d8f9fb32c98359966b454e8567690954a
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Given(/^the interface "(.*?)" is defined$/) do |interface|
|
2
|
-
Vedeu::Interface.create({ name: interface,
|
2
|
+
Vedeu::Interface.create({ name: interface, entity: Vedeu::DummyInterface, options: {} })
|
3
3
|
end
|
4
4
|
|
5
5
|
Given(/^the command "(.*?)" is defined$/) do |command|
|
6
|
-
Vedeu::Command.create({ name: command,
|
6
|
+
Vedeu::Command.create({ name: command, entity: Vedeu::DummyCommand, options: { keyword: command } })
|
7
7
|
end
|
8
8
|
|
9
9
|
When(/^the input "(.*?)" is entered$/) do |input|
|
@@ -1,6 +1,4 @@
|
|
1
1
|
module Vedeu
|
2
|
-
class UndefinedInterface < StandardError; end
|
3
|
-
|
4
2
|
class Compositor
|
5
3
|
class << self
|
6
4
|
def arrange(output = {})
|
@@ -26,62 +24,57 @@ module Vedeu
|
|
26
24
|
|
27
25
|
def composition
|
28
26
|
container = []
|
29
|
-
streams = []
|
30
|
-
|
31
|
-
container << colour.set
|
32
27
|
|
33
|
-
|
34
|
-
remaining = height - stream.size
|
35
|
-
remaining.times { |i| stream << [''] }
|
36
|
-
end
|
28
|
+
pad_stream
|
37
29
|
|
38
30
|
stream.each_with_index do |lines, index|
|
39
|
-
|
31
|
+
line = [interface.colour.set, clear(index)]
|
40
32
|
|
41
33
|
lines.each do |data|
|
42
|
-
|
34
|
+
line << Directive.enact(interface, data)
|
43
35
|
end
|
44
36
|
|
45
|
-
|
46
|
-
streams = []
|
47
|
-
end
|
37
|
+
line << interface.colour.reset << interface.cursor
|
48
38
|
|
49
|
-
|
50
|
-
|
39
|
+
container << line.join
|
40
|
+
end
|
51
41
|
|
52
42
|
container
|
53
43
|
end
|
54
44
|
|
45
|
+
def pad_stream
|
46
|
+
if stream.size < height
|
47
|
+
remaining = height - stream.size
|
48
|
+
remaining.times { |i| stream << [''] }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
55
52
|
def clear(index)
|
56
53
|
[origin(index), (' ' * width), origin(index)].join
|
57
54
|
end
|
58
55
|
|
59
56
|
def origin(index)
|
60
|
-
geometry.origin(index)
|
57
|
+
interface.geometry.origin(index)
|
61
58
|
end
|
62
59
|
|
63
60
|
def height
|
64
|
-
geometry.height
|
61
|
+
interface.geometry.height
|
65
62
|
end
|
66
63
|
|
67
64
|
def width
|
68
|
-
geometry.width
|
65
|
+
interface.geometry.width
|
69
66
|
end
|
70
67
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
def cursor
|
80
|
-
interface.cursor
|
68
|
+
def stream
|
69
|
+
@_stream ||= if @stream.is_a?(String)
|
70
|
+
[@stream.split("\n")]
|
71
|
+
else
|
72
|
+
@stream
|
73
|
+
end
|
81
74
|
end
|
82
75
|
|
83
76
|
def interface
|
84
|
-
@_interface ||= InterfaceRepository.
|
77
|
+
@_interface ||= InterfaceRepository.find(@interface)
|
85
78
|
end
|
86
79
|
end
|
87
80
|
end
|
data/lib/vedeu/output/output.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Command
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :attributes, :name, :entity, :keyword, :keypress
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def create(attributes = {})
|
@@ -11,7 +11,7 @@ module Vedeu
|
|
11
11
|
def initialize(attributes = {})
|
12
12
|
@attributes = attributes || {}
|
13
13
|
@name = attributes[:name]
|
14
|
-
@
|
14
|
+
@entity = attributes[:entity]
|
15
15
|
@keyword = attributes.fetch(:options, {}).fetch(:keyword, '')
|
16
16
|
@keypress = attributes.fetch(:options, {}).fetch(:keypress, '')
|
17
17
|
end
|
@@ -26,16 +26,16 @@ module Vedeu
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def executable
|
29
|
-
proc { |*args| attributes[:
|
29
|
+
proc { |*args| attributes[:entity].dispatch(*args) }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
# :nocov:
|
34
34
|
module ClassMethods
|
35
|
-
def command(name,
|
35
|
+
def command(name, entity, options = {})
|
36
36
|
command_name = name.is_a?(Symbol) ? name.to_s : name
|
37
37
|
|
38
|
-
Command.create({ name: command_name,
|
38
|
+
Command.create({ name: command_name, entity: entity, options: options })
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -4,14 +4,14 @@ module Vedeu
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
def by_keypress(input)
|
7
|
-
query(
|
7
|
+
query(entity, :keypress, input)
|
8
8
|
end
|
9
9
|
|
10
10
|
def by_keyword(input)
|
11
|
-
query(
|
11
|
+
query(entity, :keyword, input)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def entity
|
15
15
|
Command
|
16
16
|
end
|
17
17
|
end
|
@@ -2,7 +2,7 @@ module Vedeu
|
|
2
2
|
class Interface
|
3
3
|
include Queue
|
4
4
|
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :attributes, :name, :cursor, :current
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def create(attributes = {})
|
@@ -12,8 +12,6 @@ module Vedeu
|
|
12
12
|
|
13
13
|
def initialize(attributes = {})
|
14
14
|
@attributes = attributes || {}
|
15
|
-
|
16
|
-
@active = false
|
17
15
|
@name = attributes[:name]
|
18
16
|
@cursor = attributes.fetch(:cursor, true)
|
19
17
|
@current = []
|
@@ -25,7 +23,7 @@ module Vedeu
|
|
25
23
|
self
|
26
24
|
end
|
27
25
|
|
28
|
-
def
|
26
|
+
def refresh
|
29
27
|
if enqueued?
|
30
28
|
@current = dequeue
|
31
29
|
elsif @current.empty?
|
@@ -1,39 +1,21 @@
|
|
1
1
|
module Vedeu
|
2
|
+
class UndefinedInterface < StandardError; end
|
3
|
+
|
2
4
|
class InterfaceRepository
|
3
5
|
extend Repository
|
4
6
|
|
5
7
|
class << self
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def activate(interface)
|
11
|
-
deactivate
|
12
|
-
|
13
|
-
all.map do |stored|
|
14
|
-
stored.active = true if stored == interface
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def deactivate
|
19
|
-
all.map { |interface| interface.active = false }
|
20
|
-
end
|
21
|
-
|
22
|
-
def activated
|
23
|
-
query(klass, :active, true)
|
24
|
-
end
|
25
|
-
|
26
|
-
def find_by_name(value)
|
27
|
-
query(klass, :name, value).tap do |interface|
|
28
|
-
fail UndefinedInterface unless interface
|
29
|
-
end
|
8
|
+
def find(name)
|
9
|
+
result = super
|
10
|
+
raise UndefinedInterface unless result
|
11
|
+
result
|
30
12
|
end
|
31
13
|
|
32
|
-
def
|
33
|
-
all.map { |interface| interface.
|
14
|
+
def refresh
|
15
|
+
all.map { |interface| interface.refresh }.compact
|
34
16
|
end
|
35
17
|
|
36
|
-
def
|
18
|
+
def entity
|
37
19
|
Interface
|
38
20
|
end
|
39
21
|
end
|
@@ -4,16 +4,16 @@ module Vedeu
|
|
4
4
|
@adaptor ||= Storage.new
|
5
5
|
end
|
6
6
|
|
7
|
-
def find(
|
8
|
-
adaptor.find(
|
7
|
+
def find(name)
|
8
|
+
adaptor.find(entity, name)
|
9
9
|
end
|
10
10
|
|
11
11
|
def all
|
12
|
-
adaptor.all(
|
12
|
+
adaptor.all(entity)
|
13
13
|
end
|
14
14
|
|
15
|
-
def query(
|
16
|
-
adaptor.query(
|
15
|
+
def query(entity, attribute, value)
|
16
|
+
adaptor.query(entity, attribute, value)
|
17
17
|
end
|
18
18
|
|
19
19
|
def create(model)
|
@@ -25,7 +25,7 @@ module Vedeu
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def reset
|
28
|
-
adaptor.reset(
|
28
|
+
adaptor.reset(entity)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -1,34 +1,31 @@
|
|
1
1
|
module Vedeu
|
2
2
|
class Storage
|
3
3
|
def initialize
|
4
|
-
@
|
5
|
-
@map = {}
|
4
|
+
@map = {}
|
6
5
|
end
|
7
6
|
|
8
7
|
def create(record)
|
9
|
-
|
10
|
-
record.id ||= @counter
|
11
|
-
map_for(record)[record.id] = record
|
8
|
+
map_for(record)[record.name] = record
|
12
9
|
end
|
13
10
|
|
14
11
|
def delete(record)
|
15
|
-
map_for(record).delete(record.
|
12
|
+
map_for(record).delete(record.name)
|
16
13
|
end
|
17
14
|
|
18
|
-
def reset(
|
19
|
-
all(
|
15
|
+
def reset(entity)
|
16
|
+
all(entity).map { |record| delete(record) }
|
20
17
|
end
|
21
18
|
|
22
|
-
def find(
|
23
|
-
map_for_class(
|
19
|
+
def find(entity, name)
|
20
|
+
map_for_class(entity).fetch(name, nil)
|
24
21
|
end
|
25
22
|
|
26
|
-
def all(
|
27
|
-
map_for_class(
|
23
|
+
def all(entity)
|
24
|
+
map_for_class(entity).values
|
28
25
|
end
|
29
26
|
|
30
|
-
def query(
|
31
|
-
map_for_class(
|
27
|
+
def query(entity, attribute, value)
|
28
|
+
map_for_class(entity).select do |_, result|
|
32
29
|
return result if result.send(attribute) == value
|
33
30
|
end
|
34
31
|
|
@@ -37,8 +34,8 @@ module Vedeu
|
|
37
34
|
|
38
35
|
private
|
39
36
|
|
40
|
-
def map_for_class(
|
41
|
-
@map[
|
37
|
+
def map_for_class(entity)
|
38
|
+
@map[entity.to_s.to_sym] ||= {}
|
42
39
|
end
|
43
40
|
|
44
41
|
def map_for(record)
|
data/lib/vedeu/version.rb
CHANGED
@@ -41,11 +41,8 @@ module Vedeu
|
|
41
41
|
let(:composition) {
|
42
42
|
[
|
43
43
|
[
|
44
|
-
"\e[38;2;39m\e[48;2;49m",
|
45
|
-
"\e[
|
46
|
-
"\e[2;1H \e[2;1H",
|
47
|
-
"\e[38;2;39m\e[48;2;49m",
|
48
|
-
"\e[?25h"
|
44
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1H\e[38;2;39m\e[48;2;49m\e[?25h",
|
45
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
49
46
|
]
|
50
47
|
]
|
51
48
|
}
|
@@ -65,11 +62,8 @@ module Vedeu
|
|
65
62
|
let(:composition) {
|
66
63
|
[
|
67
64
|
[
|
68
|
-
"\e[38;2;39m\e[48;2;49m",
|
69
|
-
"\e[
|
70
|
-
"\e[2;1H \e[2;1H",
|
71
|
-
"\e[38;2;39m\e[48;2;49m",
|
72
|
-
"\e[?25h"
|
65
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1HSome text...\e[38;2;39m\e[48;2;49m\e[?25h",
|
66
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
73
67
|
]
|
74
68
|
]
|
75
69
|
}
|
@@ -89,11 +83,8 @@ module Vedeu
|
|
89
83
|
let(:composition) {
|
90
84
|
[
|
91
85
|
[
|
92
|
-
"\e[38;2;39m\e[48;2;49m",
|
93
|
-
"\e[
|
94
|
-
"\e[2;1H \e[2;1HSome more tex...\e[0m",
|
95
|
-
"\e[38;2;39m\e[48;2;49m",
|
96
|
-
"\e[?25h"
|
86
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1HSome text...\e[38;2;39m\e[48;2;49m\e[?25h",
|
87
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1HSome more tex...\e[0m\e[38;2;39m\e[48;2;49m\e[?25h"
|
97
88
|
]
|
98
89
|
]
|
99
90
|
}
|
@@ -115,11 +106,8 @@ module Vedeu
|
|
115
106
|
let(:composition) {
|
116
107
|
[
|
117
108
|
[
|
118
|
-
"\e[38;2;39m\e[48;2;49m",
|
119
|
-
"\e[
|
120
|
-
"\e[2;1H \e[2;1H",
|
121
|
-
"\e[38;2;39m\e[48;2;49m",
|
122
|
-
"\e[?25h"
|
109
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1H\e[38;2;31m\e[48;2;47mSome text...\e[38;5;39m\e[48;5;49m\e[38;2;39m\e[48;2;49m\e[?25h",
|
110
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
123
111
|
]
|
124
112
|
]
|
125
113
|
}
|
@@ -139,11 +127,8 @@ module Vedeu
|
|
139
127
|
let(:composition) {
|
140
128
|
[
|
141
129
|
[
|
142
|
-
"\e[38;2;39m\e[48;2;49m",
|
143
|
-
"\e[
|
144
|
-
"\e[2;1H \e[2;1H\e[38;2;34m\e[48;2;43mSome more tex...\e[0m",
|
145
|
-
"\e[38;2;39m\e[48;2;49m",
|
146
|
-
"\e[?25h"
|
130
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1H\e[38;2;31m\e[48;2;47mSome text...\e[38;2;39m\e[48;2;49m\e[?25h",
|
131
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;34m\e[48;2;43mSome more tex...\e[0m\e[38;2;39m\e[48;2;49m\e[?25h"
|
147
132
|
]
|
148
133
|
]
|
149
134
|
}
|
@@ -160,11 +145,8 @@ module Vedeu
|
|
160
145
|
let(:composition) {
|
161
146
|
[
|
162
147
|
[
|
163
|
-
"\e[38;2;39m\e[48;2;49m",
|
164
|
-
"\e[
|
165
|
-
"\e[2;1H \e[2;1H",
|
166
|
-
"\e[38;2;39m\e[48;2;49m",
|
167
|
-
"\e[?25h"
|
148
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1H\e[1mSome text...\e[21m\e[38;2;39m\e[48;2;49m\e[?25h",
|
149
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
168
150
|
]
|
169
151
|
]
|
170
152
|
}
|
@@ -184,11 +166,8 @@ module Vedeu
|
|
184
166
|
let(:composition) {
|
185
167
|
[
|
186
168
|
[
|
187
|
-
"\e[38;2;39m\e[48;2;49m",
|
188
|
-
"\e[
|
189
|
-
"\e[2;1H \e[2;1H\e[4mSome more tex...\e[0m",
|
190
|
-
"\e[38;2;39m\e[48;2;49m",
|
191
|
-
"\e[?25h"
|
169
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1H\e[7mSome text...\e[38;2;39m\e[48;2;49m\e[?25h",
|
170
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[4mSome more tex...\e[0m\e[38;2;39m\e[48;2;49m\e[?25h"
|
192
171
|
]
|
193
172
|
]
|
194
173
|
}
|
@@ -204,11 +183,8 @@ module Vedeu
|
|
204
183
|
let(:composition) {
|
205
184
|
[
|
206
185
|
[
|
207
|
-
"\e[38;2;39m\e[48;2;49m",
|
208
|
-
"\e[
|
209
|
-
"\e[2;1H \e[2;1H",
|
210
|
-
"\e[38;2;39m\e[48;2;49m",
|
211
|
-
"\e[?25h"
|
186
|
+
"\e[38;2;39m\e[48;2;49m\e[1;1H \e[1;1HSome text...\e[38;2;39m\e[48;2;49m\e[?25h",
|
187
|
+
"\e[38;2;39m\e[48;2;49m\e[2;1H \e[2;1H\e[38;2;39m\e[48;2;49m\e[?25h"
|
212
188
|
]
|
213
189
|
]
|
214
190
|
}
|
@@ -7,10 +7,10 @@ module Vedeu
|
|
7
7
|
|
8
8
|
before do
|
9
9
|
Command.create({ name: 'apple',
|
10
|
-
|
10
|
+
entity: DummyCommand,
|
11
11
|
options: { keypress: 'a', keyword: 'apple' } })
|
12
12
|
Command.create({ name: 'banana',
|
13
|
-
|
13
|
+
entity: DummyCommand,
|
14
14
|
options: { keypress: 'b', keyword: 'banana' } })
|
15
15
|
end
|
16
16
|
|
@@ -66,8 +66,8 @@ module Vedeu
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe '.
|
70
|
-
let(:subject) { described_class.
|
69
|
+
describe '.entity' do
|
70
|
+
let(:subject) { described_class.entity }
|
71
71
|
|
72
72
|
it 'returns Command' do
|
73
73
|
subject.must_equal(Command)
|
@@ -8,7 +8,7 @@ module Vedeu
|
|
8
8
|
let(:attributes) {
|
9
9
|
{
|
10
10
|
name: 'dummy',
|
11
|
-
|
11
|
+
entity: DummyCommand,
|
12
12
|
options: {
|
13
13
|
keyword: "dummy",
|
14
14
|
keypress: "d"
|
@@ -29,7 +29,7 @@ module Vedeu
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'sets an instance variable' do
|
32
|
-
subject.instance_variable_get('@
|
32
|
+
subject.instance_variable_get('@entity').must_equal(DummyCommand)
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'sets an instance variable' do
|
@@ -5,45 +5,29 @@ module Vedeu
|
|
5
5
|
let(:described_class) { InterfaceRepository }
|
6
6
|
|
7
7
|
before { Interface.create({ name: 'dummy' }) }
|
8
|
-
|
9
8
|
after { InterfaceRepository.reset }
|
10
9
|
|
11
|
-
describe '.
|
12
|
-
let(:subject)
|
13
|
-
let(:
|
14
|
-
|
15
|
-
it 'returns an Array' do
|
16
|
-
subject.must_be_instance_of(Array)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '.deactivate' do
|
21
|
-
let(:subject) { described_class.deactivate }
|
22
|
-
|
23
|
-
it 'returns an Array' do
|
24
|
-
subject.must_be_instance_of(Array)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.activated' do
|
29
|
-
let(:subject) { described_class.activated }
|
10
|
+
describe '.find' do
|
11
|
+
let(:subject) { described_class.find(value) }
|
12
|
+
let(:value) { 'dummy' }
|
30
13
|
|
31
|
-
|
32
|
-
|
14
|
+
context 'when the interface exists' do
|
15
|
+
it 'returns an Interface' do
|
16
|
+
subject.must_be_instance_of(Interface)
|
17
|
+
end
|
33
18
|
end
|
34
|
-
end
|
35
19
|
|
36
|
-
|
37
|
-
|
38
|
-
let(:value) { 'dummy' }
|
20
|
+
context 'when the interface does not exist' do
|
21
|
+
before { InterfaceRepository.reset }
|
39
22
|
|
40
|
-
|
41
|
-
|
23
|
+
it 'raises an exception' do
|
24
|
+
proc { subject }.must_raise(UndefinedInterface)
|
25
|
+
end
|
42
26
|
end
|
43
27
|
end
|
44
28
|
|
45
|
-
describe '.
|
46
|
-
let(:subject) { described_class.
|
29
|
+
describe '.refresh' do
|
30
|
+
let(:subject) { described_class.refresh }
|
47
31
|
|
48
32
|
before { Compositor.stubs(:arrange) }
|
49
33
|
|
@@ -52,8 +36,8 @@ module Vedeu
|
|
52
36
|
end
|
53
37
|
end
|
54
38
|
|
55
|
-
describe '.
|
56
|
-
let(:subject) { described_class.
|
39
|
+
describe '.entity' do
|
40
|
+
let(:subject) { described_class.entity }
|
57
41
|
|
58
42
|
it 'returns an Interface' do
|
59
43
|
subject.must_equal(Interface)
|
@@ -30,10 +30,6 @@ module Vedeu
|
|
30
30
|
subject.instance_variable_get('@attributes').must_equal(attributes)
|
31
31
|
end
|
32
32
|
|
33
|
-
it 'sets an instance variable' do
|
34
|
-
subject.instance_variable_get('@active').must_equal(false)
|
35
|
-
end
|
36
|
-
|
37
33
|
it 'sets an instance variable' do
|
38
34
|
subject.instance_variable_get('@name').must_equal('dummy')
|
39
35
|
end
|
@@ -46,8 +42,8 @@ module Vedeu
|
|
46
42
|
end
|
47
43
|
end
|
48
44
|
|
49
|
-
describe '#
|
50
|
-
let(:subject) { described_instance.
|
45
|
+
describe '#refresh' do
|
46
|
+
let(:subject) { described_instance.refresh }
|
51
47
|
|
52
48
|
# it 'returns a Array' do
|
53
49
|
# subject.must_be_instance_of(Array)
|
@@ -2,17 +2,15 @@ require_relative '../../../test_helper'
|
|
2
2
|
|
3
3
|
module Vedeu
|
4
4
|
class Dummy
|
5
|
-
attr_accessor :id
|
6
|
-
|
7
5
|
def name
|
8
|
-
|
6
|
+
'dummy'
|
9
7
|
end
|
10
8
|
end
|
11
9
|
|
12
10
|
class DummyRepository
|
13
11
|
extend Repository
|
14
12
|
|
15
|
-
def self.
|
13
|
+
def self.entity
|
16
14
|
Dummy
|
17
15
|
end
|
18
16
|
end
|
@@ -37,8 +35,8 @@ module Vedeu
|
|
37
35
|
end
|
38
36
|
|
39
37
|
describe '#find' do
|
40
|
-
let(:subject)
|
41
|
-
let(:
|
38
|
+
let(:subject) { described_class.find(record_name) }
|
39
|
+
let(:record_name) { @dummy.name }
|
42
40
|
|
43
41
|
it 'returns a Dummy' do
|
44
42
|
subject.must_be_instance_of(Dummy)
|
@@ -54,10 +52,10 @@ module Vedeu
|
|
54
52
|
end
|
55
53
|
|
56
54
|
describe '#query' do
|
57
|
-
let(:subject) { described_class.query(
|
58
|
-
let(:
|
55
|
+
let(:subject) { described_class.query(entity, attribute, value) }
|
56
|
+
let(:entity) { Dummy }
|
59
57
|
let(:attribute) { :name }
|
60
|
-
let(:value) {
|
58
|
+
let(:value) { 'dummy' }
|
61
59
|
|
62
60
|
it 'returns a Dummy' do
|
63
61
|
subject.must_be_instance_of(Dummy)
|
@@ -5,16 +5,12 @@ module Vedeu
|
|
5
5
|
let(:described_class) { Storage }
|
6
6
|
let(:subject) { described_class.new }
|
7
7
|
let(:record) { DummyCommand.new }
|
8
|
-
let(:
|
8
|
+
let(:entity) {}
|
9
9
|
|
10
10
|
it 'returns a Storage instance' do
|
11
11
|
subject.must_be_instance_of(Storage)
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'sets an instance variable' do
|
15
|
-
subject.instance_variable_get('@counter').must_equal(0)
|
16
|
-
end
|
17
|
-
|
18
14
|
it 'sets an instance variable' do
|
19
15
|
subject.instance_variable_get('@map').must_equal({})
|
20
16
|
end
|
@@ -36,7 +32,7 @@ module Vedeu
|
|
36
32
|
end
|
37
33
|
|
38
34
|
describe '#reset' do
|
39
|
-
let(:subject) { described_class.new.reset(
|
35
|
+
let(:subject) { described_class.new.reset(entity) }
|
40
36
|
|
41
37
|
it 'returns an Array' do
|
42
38
|
subject.must_be_instance_of(Array)
|
@@ -44,8 +40,8 @@ module Vedeu
|
|
44
40
|
end
|
45
41
|
|
46
42
|
describe '#find' do
|
47
|
-
let(:subject)
|
48
|
-
let(:
|
43
|
+
let(:subject) { described_class.new.find(entity, record_name) }
|
44
|
+
let(:record_name) { 'dummy' }
|
49
45
|
|
50
46
|
it 'returns a NilClass' do
|
51
47
|
subject.must_be_instance_of(NilClass)
|
@@ -53,7 +49,7 @@ module Vedeu
|
|
53
49
|
end
|
54
50
|
|
55
51
|
describe '#all' do
|
56
|
-
let(:subject) { described_class.new.all(
|
52
|
+
let(:subject) { described_class.new.all(entity) }
|
57
53
|
|
58
54
|
it 'returns an Array' do
|
59
55
|
subject.must_be_instance_of(Array)
|
@@ -61,7 +57,7 @@ module Vedeu
|
|
61
57
|
end
|
62
58
|
|
63
59
|
describe '#query' do
|
64
|
-
let(:subject) { described_class.new.query(
|
60
|
+
let(:subject) { described_class.new.query(entity, attribute, value) }
|
65
61
|
let(:attribute) {}
|
66
62
|
let(:value) {}
|
67
63
|
|
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.0.
|
4
|
+
version: 0.0.21
|
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-06-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|