tudu 0.0.1
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.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +196 -0
- data/Rakefile +1 -0
- data/bin/tudu +71 -0
- data/lib/task.rb +281 -0
- data/lib/tasks.rb +281 -0
- data/lib/tudu/version.rb +3 -0
- data/lib/tudu_core.rb +74 -0
- data/lib/tudu_dsl.rb +41 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/task_spec.rb +762 -0
- data/spec/tudu_core_spec.rb +574 -0
- data/spec/tudu_dsl_spec.rb +120 -0
- data/tudu.gemspec +27 -0
- metadata +124 -0
data/lib/tasks.rb
ADDED
@@ -0,0 +1,281 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Tudu
|
4
|
+
#= Tudu::Tasks
|
5
|
+
class Tasks
|
6
|
+
#== Tudufile key
|
7
|
+
TUDU_FILE_KEY = :tudufile
|
8
|
+
#== todo key
|
9
|
+
TUDU_TODO_KEY = :todo
|
10
|
+
#== doing key
|
11
|
+
TUDU_DOING_KEY = :doing
|
12
|
+
#== done key
|
13
|
+
TUDU_DONE_KEY = :done
|
14
|
+
#== file's key
|
15
|
+
TUDU_KEYS = [TUDU_FILE_KEY, TUDU_TODO_KEY, TUDU_DOING_KEY, TUDU_DONE_KEY]
|
16
|
+
|
17
|
+
#== Tudufile file name
|
18
|
+
TUDU_FILE = "Tudufile"
|
19
|
+
#== Tudufile file name
|
20
|
+
TUDU_DIR = "tudu"
|
21
|
+
#== todo file name
|
22
|
+
TUDU_TODOS_FILE = "todos"
|
23
|
+
#== todo file path
|
24
|
+
TUDU_TODOS_FILE_PATH = "./#{TUDU_DIR}/#{TUDU_TODOS_FILE}"
|
25
|
+
#== doing file name
|
26
|
+
TUDU_DOINGS_FILE = "doings"
|
27
|
+
#== doing file path
|
28
|
+
TUDU_DOINGS_FILE_PATH = "./#{TUDU_DIR}/#{TUDU_DOINGS_FILE}"
|
29
|
+
#== done file name
|
30
|
+
TUDU_DONES_FILE = "dones"
|
31
|
+
#== done file path
|
32
|
+
TUDU_DONES_FILE_PATH = "./#{TUDU_DIR}/#{TUDU_DONES_FILE}"
|
33
|
+
#== file names
|
34
|
+
INIT_FILES = {
|
35
|
+
TUDU_FILE_KEY => TUDU_FILE,
|
36
|
+
TUDU_TODO_KEY => TUDU_TODOS_FILE,
|
37
|
+
TUDU_DOING_KEY => TUDU_DOINGS_FILE,
|
38
|
+
TUDU_DONE_KEY => TUDU_DONES_FILE
|
39
|
+
}
|
40
|
+
#== task file names
|
41
|
+
TASK_FILES = {
|
42
|
+
TUDU_TODO_KEY => TUDU_TODOS_FILE,
|
43
|
+
TUDU_DOING_KEY => TUDU_DOINGS_FILE,
|
44
|
+
TUDU_DONE_KEY => TUDU_DONES_FILE
|
45
|
+
}
|
46
|
+
|
47
|
+
#== Tudufile file template
|
48
|
+
TUDU_FILE_TEMPLATE =<<-EOS
|
49
|
+
# encoding: utf-8
|
50
|
+
|
51
|
+
# !!!!!!! in tudu ver 0.0.1 this file not using !!!!!!!
|
52
|
+
|
53
|
+
# if you want to use notification, set target type. default => :none
|
54
|
+
# you can set :none, :mail
|
55
|
+
# target_type :mail
|
56
|
+
|
57
|
+
# if you want to use notification, set targets. default => []
|
58
|
+
# if you choose target_type none, you must not set targets.
|
59
|
+
# if you choose mail, you must set target email addresses.
|
60
|
+
# targets ["target1@abcdefg", "target2@abcdefg"]
|
61
|
+
EOS
|
62
|
+
|
63
|
+
#== todo file template
|
64
|
+
TUDU_TODOS_FILE_TEMPLATE = ""
|
65
|
+
#== doing file template
|
66
|
+
TUDU_DOINGS_FILE_TEMPLATE = ""
|
67
|
+
#== done file template
|
68
|
+
TUDU_DONES_FILE_TEMPLATE = ""
|
69
|
+
|
70
|
+
#== template files
|
71
|
+
INIT_FILES_TEMPLATE = {
|
72
|
+
TUDU_FILE_KEY => TUDU_FILE_TEMPLATE,
|
73
|
+
TUDU_TODO_KEY => TUDU_TODOS_FILE_TEMPLATE,
|
74
|
+
TUDU_DOING_KEY => TUDU_DOINGS_FILE_TEMPLATE,
|
75
|
+
TUDU_DONE_KEY => TUDU_DONES_FILE_TEMPLATE
|
76
|
+
}
|
77
|
+
|
78
|
+
#== task type [todo, doing, done]
|
79
|
+
attr_accessor :type
|
80
|
+
#== task name [uniq]
|
81
|
+
attr_accessor :name
|
82
|
+
|
83
|
+
class << self
|
84
|
+
#== add task to todos
|
85
|
+
#=== Params
|
86
|
+
#- task_names : add task name list
|
87
|
+
def add(*task_names)
|
88
|
+
task_names.each do |task_name|
|
89
|
+
if find_tasks(task_name)
|
90
|
+
puts "#{task_name} is already exists."
|
91
|
+
next
|
92
|
+
end
|
93
|
+
File.open(TUDU_TODOS_FILE_PATH, "a:UTF-8") {|f|f.puts task_name}
|
94
|
+
puts "complete add todo '#{task_name}' to tudu/todos"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
#== remove task to todo
|
99
|
+
#=== Params
|
100
|
+
#- task_names : remove task name list
|
101
|
+
def remove(*task_names)
|
102
|
+
task_names.each do |task_name|
|
103
|
+
can_find = false
|
104
|
+
TASK_FILES.each_value do |rf|
|
105
|
+
tasks = get_tasks_from_file(rf)
|
106
|
+
next unless has_task?(tasks, task_name)
|
107
|
+
remove_task(tasks, task_name, "./#{TUDU_DIR}/#{rf}")
|
108
|
+
can_find = true
|
109
|
+
break
|
110
|
+
end
|
111
|
+
puts "no such todo '#{task_name}'" unless can_find
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
#== choose todo => doing task
|
116
|
+
#=== Params
|
117
|
+
#- task_name : target task name
|
118
|
+
def choose(task_name)
|
119
|
+
if get_doings.size > 0
|
120
|
+
puts "before choose, you must done current doings."
|
121
|
+
return
|
122
|
+
end
|
123
|
+
|
124
|
+
task = find_tasks(task_name)
|
125
|
+
|
126
|
+
if task.nil?
|
127
|
+
puts "#{task_name} not exists"
|
128
|
+
return
|
129
|
+
end
|
130
|
+
|
131
|
+
unless task.todo?
|
132
|
+
puts "#{task_name} is not exists in todos. #{task_name} in #{task.type}"
|
133
|
+
return
|
134
|
+
end
|
135
|
+
|
136
|
+
remove task_name
|
137
|
+
File.open(TUDU_DOINGS_FILE_PATH, "w:UTF-8") {|f|f.puts task_name}
|
138
|
+
puts "complete add doings '#{task_name}'"
|
139
|
+
end
|
140
|
+
|
141
|
+
#== doing to done
|
142
|
+
#- if doings size == 0, nothing todo.
|
143
|
+
#- after move doing to done, next todo move to doing.
|
144
|
+
def done
|
145
|
+
return unless doings_to_dones
|
146
|
+
todos_to_doings
|
147
|
+
end
|
148
|
+
|
149
|
+
#== get todos type tasks.
|
150
|
+
#=== Returns
|
151
|
+
# return Array[Tasks]
|
152
|
+
def get_todos
|
153
|
+
get_tasks(TUDU_TODOS_FILE)
|
154
|
+
end
|
155
|
+
|
156
|
+
#== get doings type tasks.
|
157
|
+
#=== Returns
|
158
|
+
# return Array[Tasks]
|
159
|
+
def get_doings
|
160
|
+
get_tasks(TUDU_DOINGS_FILE)
|
161
|
+
end
|
162
|
+
|
163
|
+
#== get dones type tasks.
|
164
|
+
#=== Returns
|
165
|
+
# return Array[Tasks]
|
166
|
+
def get_dones
|
167
|
+
get_tasks(TUDU_DONES_FILE)
|
168
|
+
end
|
169
|
+
|
170
|
+
#== get each type tasks.
|
171
|
+
#=== Params
|
172
|
+
#- type : task type.if use nil, you can get all types task.
|
173
|
+
#=== Returns
|
174
|
+
# return Array[Tasks]
|
175
|
+
def get_tasks(type = nil)
|
176
|
+
type.nil? ? get_all_tasks : get_each_tasks(type)
|
177
|
+
end
|
178
|
+
|
179
|
+
#== get each type tasks from file.
|
180
|
+
#=== Params
|
181
|
+
#- type : task type.
|
182
|
+
#=== Returns
|
183
|
+
# return Array[String]
|
184
|
+
def get_tasks_from_file(file_name)
|
185
|
+
File.read("./#{TUDU_DIR}/#{file_name}").split("\n")
|
186
|
+
end
|
187
|
+
|
188
|
+
#== filter tasklist by search_word.
|
189
|
+
#=== Params
|
190
|
+
#- tasks : task list.
|
191
|
+
#- search_word : filtering word.
|
192
|
+
#=== Returns
|
193
|
+
# return filterd task list
|
194
|
+
def filter_tasks(tasks, search_word)
|
195
|
+
return tasks if search_word.nil?
|
196
|
+
tasks.select {|task|task.name.match /.*#{search_word}.*/}
|
197
|
+
end
|
198
|
+
|
199
|
+
#== find task from all tasks.
|
200
|
+
#=== Params
|
201
|
+
#- task_name : task name.
|
202
|
+
#=== Returns
|
203
|
+
# return task
|
204
|
+
def find_tasks(task_name)
|
205
|
+
tasks = get_tasks
|
206
|
+
tasks.select {|task|task.name == task_name}.first
|
207
|
+
end
|
208
|
+
|
209
|
+
private
|
210
|
+
def get_each_tasks(type)
|
211
|
+
tasks = []
|
212
|
+
get_tasks_from_file(type).each {|task|tasks << Tasks.new(type, task)}
|
213
|
+
tasks
|
214
|
+
end
|
215
|
+
|
216
|
+
def get_all_tasks
|
217
|
+
tasks = []
|
218
|
+
TASK_FILES.each_value {|each_type|tasks += get_each_tasks(each_type)}
|
219
|
+
tasks
|
220
|
+
end
|
221
|
+
|
222
|
+
def has_task?(tasks, task_name)
|
223
|
+
tasks.include? task_name
|
224
|
+
end
|
225
|
+
|
226
|
+
def remove_task(tasks, task_name, file_path)
|
227
|
+
tasks.delete(task_name)
|
228
|
+
File.open(file_path, "w:UTF-8") {|wf|wf.puts tasks.join("\n")}
|
229
|
+
puts "complete remove todo '#{task_name}' from #{file_path}"
|
230
|
+
end
|
231
|
+
|
232
|
+
def doings_to_dones
|
233
|
+
_doings = get_doings
|
234
|
+
if _doings.size == 0
|
235
|
+
puts "there is no doing task.before done, you must choose task."
|
236
|
+
return false
|
237
|
+
end
|
238
|
+
File.open(TUDU_DOINGS_FILE_PATH, "w:UTF-8") {|f|f.print ""}
|
239
|
+
File.open(TUDU_DONES_FILE_PATH, "a:UTF-8") {|f|f.puts _doings.first.name}
|
240
|
+
true
|
241
|
+
end
|
242
|
+
|
243
|
+
def todos_to_doings
|
244
|
+
_todos = get_todos
|
245
|
+
return if _todos.size == 0
|
246
|
+
deleted_todos = _todos.dup
|
247
|
+
deleted_todos.delete_at 0
|
248
|
+
File.open(TUDU_TODOS_FILE_PATH, "w:UTF-8") do |f|
|
249
|
+
deleted_todos.each {|task|f.puts task.name}
|
250
|
+
end
|
251
|
+
File.open(TUDU_DOINGS_FILE_PATH, "w:UTF-8") {|f|f.puts _todos.first.name}
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
#== init task with setting task type and task name.
|
256
|
+
def initialize(type, name)
|
257
|
+
@type, @name = type, name
|
258
|
+
end
|
259
|
+
|
260
|
+
def todo?
|
261
|
+
@type == "todos"
|
262
|
+
end
|
263
|
+
|
264
|
+
def doing?
|
265
|
+
@type == "doings"
|
266
|
+
end
|
267
|
+
|
268
|
+
def done?
|
269
|
+
@type == "dones"
|
270
|
+
end
|
271
|
+
|
272
|
+
def ==(other)
|
273
|
+
if self.name == other.name
|
274
|
+
if self.type == other.type
|
275
|
+
return true
|
276
|
+
end
|
277
|
+
end
|
278
|
+
false
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
data/lib/tudu/version.rb
ADDED
data/lib/tudu_core.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "tudu/version"
|
3
|
+
require "tasks"
|
4
|
+
|
5
|
+
module Tudu
|
6
|
+
# Tudu::Core
|
7
|
+
class Core
|
8
|
+
#== generate files [Tudufile, todos, doings, dones]
|
9
|
+
def init
|
10
|
+
Dir.mkdir Tudu::Tasks::TUDU_DIR unless File.exists? Tudu::Tasks::TUDU_DIR
|
11
|
+
Tudu::Tasks::TUDU_KEYS.each do |key|
|
12
|
+
File.open("./tudu/#{Tudu::Tasks::INIT_FILES[key]}", "w:UTF-8") {|f|f.print Tudu::Tasks::INIT_FILES_TEMPLATE[key]}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
#== add task to todo
|
17
|
+
#=== Params
|
18
|
+
#- task_names : add task name list
|
19
|
+
def add(*task_names)
|
20
|
+
Tudu::Tasks.add *task_names
|
21
|
+
end
|
22
|
+
|
23
|
+
#== remove task to todo
|
24
|
+
#=== Params
|
25
|
+
#- task_names : remove task name list
|
26
|
+
def remove(*task_names)
|
27
|
+
Tudu::Tasks.remove *task_names
|
28
|
+
end
|
29
|
+
|
30
|
+
#== choose todo => doing task
|
31
|
+
#=== Params
|
32
|
+
#- task_name : target task name
|
33
|
+
def choose(task_name)
|
34
|
+
Tudu::Tasks.choose task_name
|
35
|
+
end
|
36
|
+
|
37
|
+
#== doing to done
|
38
|
+
#- if doings size == 0, nothing todo.
|
39
|
+
#- after move doing to done, next todo move to doing.
|
40
|
+
def done
|
41
|
+
Tudu::Tasks.done
|
42
|
+
end
|
43
|
+
|
44
|
+
#== search tasks
|
45
|
+
#=== Params
|
46
|
+
#- search_word : search word. enable regexp.
|
47
|
+
def tasks(search_word)
|
48
|
+
Tudu::Tasks.filter_tasks(Tudu::Tasks.get_tasks, search_word).map(&:name)
|
49
|
+
end
|
50
|
+
|
51
|
+
#== search todos
|
52
|
+
#=== Params
|
53
|
+
#- search_word : search word. enable regexp.
|
54
|
+
def todos(search_word)
|
55
|
+
Tudu::Tasks.filter_tasks(Tudu::Tasks.get_todos, search_word).map(&:name)
|
56
|
+
end
|
57
|
+
|
58
|
+
#== search doings
|
59
|
+
#=== Params
|
60
|
+
#- search_word : search word. enable regexp.
|
61
|
+
def doings(search_word)
|
62
|
+
Tudu::Tasks.filter_tasks(Tudu::Tasks.get_doings, search_word).map(&:name)
|
63
|
+
end
|
64
|
+
|
65
|
+
#== search dones
|
66
|
+
#=== Params
|
67
|
+
#- search_word : search word. enable regexp.
|
68
|
+
def dones(search_word)
|
69
|
+
Tudu::Tasks.filter_tasks(Tudu::Tasks.get_dones, search_word).map(&:name)
|
70
|
+
end
|
71
|
+
|
72
|
+
alias :now :doings
|
73
|
+
end
|
74
|
+
end
|
data/lib/tudu_dsl.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "tudu/version"
|
3
|
+
|
4
|
+
module Tudu
|
5
|
+
#= Tudu::Dsl
|
6
|
+
class Dsl
|
7
|
+
#== TARGET_TYPES
|
8
|
+
# notice target types
|
9
|
+
#=== types
|
10
|
+
#- none: no notice
|
11
|
+
#- mail: mail notice
|
12
|
+
TARGET_TYPES = {:none => :none, :mail => :mail}
|
13
|
+
#== notice target type
|
14
|
+
attr_accessor :_target_type
|
15
|
+
#== notice targets
|
16
|
+
attr_accessor :_targets
|
17
|
+
|
18
|
+
#== initialize Dsl
|
19
|
+
def initialize
|
20
|
+
@_target_type = TARGET_TYPES[:none]
|
21
|
+
@_targets = []
|
22
|
+
end
|
23
|
+
|
24
|
+
#== initialize Dsl
|
25
|
+
#=== Params
|
26
|
+
#- _target_type: target notice type
|
27
|
+
def target_type(_target_type)
|
28
|
+
return if _target_type.nil?
|
29
|
+
return unless _target_type.instance_of? String or _target_type.instance_of? Symbol
|
30
|
+
_target_type = _target_type.to_sym if _target_type.instance_of? String
|
31
|
+
return unless TARGET_TYPES.include? _target_type
|
32
|
+
@_target_type = _target_type
|
33
|
+
end
|
34
|
+
|
35
|
+
def targets(_targets)
|
36
|
+
return if _targets.nil?
|
37
|
+
return unless _targets.instance_of? Array
|
38
|
+
@_targets = _targets
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/task_spec.rb
ADDED
@@ -0,0 +1,762 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "spec_helper"
|
3
|
+
require "tudu_core"
|
4
|
+
require "tasks"
|
5
|
+
|
6
|
+
describe Tudu::Tasks do
|
7
|
+
|
8
|
+
context :todo? do
|
9
|
+
cases = [
|
10
|
+
{
|
11
|
+
case_no: 1,
|
12
|
+
case_title: "todo task",
|
13
|
+
name: "task_name",
|
14
|
+
type: "todos",
|
15
|
+
expected: true,
|
16
|
+
},
|
17
|
+
{
|
18
|
+
case_no: 2,
|
19
|
+
case_title: "not todo task",
|
20
|
+
name: "task_name",
|
21
|
+
type: "doings",
|
22
|
+
expected: false,
|
23
|
+
},
|
24
|
+
]
|
25
|
+
|
26
|
+
cases.each do |c|
|
27
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
28
|
+
begin
|
29
|
+
case_before c
|
30
|
+
|
31
|
+
# -- given --
|
32
|
+
tudu_task = Tudu::Tasks.new(c[:type], c[:name])
|
33
|
+
|
34
|
+
# -- when --
|
35
|
+
actual = tudu_task.todo?
|
36
|
+
|
37
|
+
# -- then --
|
38
|
+
ret = expect(actual).to eq(c[:expected])
|
39
|
+
ensure
|
40
|
+
case_after c
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def case_before(c)
|
45
|
+
# implement each case before
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def case_after(c)
|
50
|
+
# implement each case after
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context :doing? do
|
56
|
+
cases = [
|
57
|
+
{
|
58
|
+
case_no: 1,
|
59
|
+
case_title: "doing task",
|
60
|
+
name: "task_name",
|
61
|
+
type: "doings",
|
62
|
+
expected: true,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
case_no: 2,
|
66
|
+
case_title: "not doing task",
|
67
|
+
name: "task_name",
|
68
|
+
type: "todos",
|
69
|
+
expected: false,
|
70
|
+
},
|
71
|
+
]
|
72
|
+
|
73
|
+
cases.each do |c|
|
74
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
75
|
+
begin
|
76
|
+
case_before c
|
77
|
+
|
78
|
+
# -- given --
|
79
|
+
tudu_task = Tudu::Tasks.new(c[:type], c[:name])
|
80
|
+
|
81
|
+
# -- when --
|
82
|
+
actual = tudu_task.doing?
|
83
|
+
|
84
|
+
# -- then --
|
85
|
+
ret = expect(actual).to eq(c[:expected])
|
86
|
+
ensure
|
87
|
+
case_after c
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def case_before(c)
|
93
|
+
# implement each case before
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
def case_after(c)
|
98
|
+
# implement each case after
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context :done? do
|
104
|
+
cases = [
|
105
|
+
{
|
106
|
+
case_no: 1,
|
107
|
+
case_title: "done task",
|
108
|
+
name: "task_name",
|
109
|
+
type: "dones",
|
110
|
+
expected: true,
|
111
|
+
},
|
112
|
+
{
|
113
|
+
case_no: 2,
|
114
|
+
case_title: "not done task",
|
115
|
+
name: "task_name",
|
116
|
+
type: "doings",
|
117
|
+
expected: false,
|
118
|
+
},
|
119
|
+
]
|
120
|
+
|
121
|
+
cases.each do |c|
|
122
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
123
|
+
begin
|
124
|
+
case_before c
|
125
|
+
|
126
|
+
# -- given --
|
127
|
+
tudu_task = Tudu::Tasks.new(c[:type], c[:name])
|
128
|
+
|
129
|
+
# -- when --
|
130
|
+
actual = tudu_task.done?
|
131
|
+
|
132
|
+
# -- then --
|
133
|
+
ret = expect(actual).to eq(c[:expected])
|
134
|
+
ensure
|
135
|
+
case_after c
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def case_before(c)
|
140
|
+
# implement each case before
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
def case_after(c)
|
145
|
+
# implement each case after
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
context :get_tasks_from_file do
|
152
|
+
cases = [
|
153
|
+
{
|
154
|
+
case_no: 1,
|
155
|
+
case_title: "get todos from file",
|
156
|
+
type: "todos",
|
157
|
+
texts: ["task1", "task2", "task3"],
|
158
|
+
expected: ["task1", "task2", "task3"],
|
159
|
+
},
|
160
|
+
{
|
161
|
+
case_no: 2,
|
162
|
+
case_title: "get doings from file",
|
163
|
+
type: "doings",
|
164
|
+
texts: ["task1", "task2", "task3"],
|
165
|
+
expected: ["task1", "task2", "task3"],
|
166
|
+
},
|
167
|
+
{
|
168
|
+
case_no: 3,
|
169
|
+
case_title: "get done from file",
|
170
|
+
type: "dones",
|
171
|
+
texts: ["task1", "task2", "task3"],
|
172
|
+
expected: ["task1", "task2", "task3"],
|
173
|
+
},
|
174
|
+
]
|
175
|
+
|
176
|
+
cases.each do |c|
|
177
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
178
|
+
begin
|
179
|
+
case_before c
|
180
|
+
|
181
|
+
# -- given --
|
182
|
+
# nothing
|
183
|
+
|
184
|
+
# -- when --
|
185
|
+
actual = Tudu::Tasks.get_tasks_from_file(c[:type])
|
186
|
+
|
187
|
+
# -- then --
|
188
|
+
ret = expect(actual).to eq(c[:expected])
|
189
|
+
ensure
|
190
|
+
case_after c
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def case_before(c)
|
195
|
+
# implement each case before
|
196
|
+
Dir.mkdir("./#{Tudu::Tasks::TUDU_DIR}")
|
197
|
+
File.open("./#{Tudu::Tasks::TUDU_DIR}/#{c[:type]}", "w") {|f|f.puts c[:texts].join("\n")}
|
198
|
+
end
|
199
|
+
|
200
|
+
def case_after(c)
|
201
|
+
# implement each case after
|
202
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
203
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
context :get_tasks do
|
209
|
+
cases = [
|
210
|
+
{
|
211
|
+
case_no: 1,
|
212
|
+
case_title: "get todos from file",
|
213
|
+
type: "todos",
|
214
|
+
texts: ["task1", "task2", "task3"],
|
215
|
+
expected: [
|
216
|
+
Tudu::Tasks.new("todos", "task1"),
|
217
|
+
Tudu::Tasks.new("todos", "task2"),
|
218
|
+
Tudu::Tasks.new("todos", "task3"),
|
219
|
+
],
|
220
|
+
},
|
221
|
+
{
|
222
|
+
case_no: 2,
|
223
|
+
case_title: "get doings from file",
|
224
|
+
type: "doings",
|
225
|
+
texts: ["task1", "task2", "task3"],
|
226
|
+
expected: [
|
227
|
+
Tudu::Tasks.new("doings", "task1"),
|
228
|
+
Tudu::Tasks.new("doings", "task2"),
|
229
|
+
Tudu::Tasks.new("doings", "task3"),
|
230
|
+
],
|
231
|
+
},
|
232
|
+
{
|
233
|
+
case_no: 3,
|
234
|
+
case_title: "get done from file",
|
235
|
+
type: "dones",
|
236
|
+
texts: ["task1", "task2", "task3"],
|
237
|
+
expected: [
|
238
|
+
Tudu::Tasks.new("dones", "task1"),
|
239
|
+
Tudu::Tasks.new("dones", "task2"),
|
240
|
+
Tudu::Tasks.new("dones", "task3"),
|
241
|
+
],
|
242
|
+
},
|
243
|
+
]
|
244
|
+
|
245
|
+
cases.each do |c|
|
246
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
247
|
+
begin
|
248
|
+
case_before c
|
249
|
+
|
250
|
+
# -- given --
|
251
|
+
# nothing
|
252
|
+
|
253
|
+
# -- when --
|
254
|
+
actual = Tudu::Tasks.get_tasks(c[:type])
|
255
|
+
|
256
|
+
# -- then --
|
257
|
+
ret = expect(actual).to eq(c[:expected])
|
258
|
+
ensure
|
259
|
+
case_after c
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
def case_before(c)
|
264
|
+
# implement each case before
|
265
|
+
Dir.mkdir("./#{Tudu::Tasks::TUDU_DIR}")
|
266
|
+
File.open("./#{Tudu::Tasks::TUDU_DIR}/#{c[:type]}", "w") {|f|f.puts c[:texts].join("\n")}
|
267
|
+
end
|
268
|
+
|
269
|
+
def case_after(c)
|
270
|
+
# implement each case after
|
271
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
272
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
context :get_todos do
|
278
|
+
cases = [
|
279
|
+
{
|
280
|
+
case_no: 1,
|
281
|
+
case_title: "get doings from file",
|
282
|
+
type: "doings",
|
283
|
+
texts: ["task1", "task2", "task3"],
|
284
|
+
expected: [
|
285
|
+
Tudu::Tasks.new("doings", "task1"),
|
286
|
+
Tudu::Tasks.new("doings", "task2"),
|
287
|
+
Tudu::Tasks.new("doings", "task3"),
|
288
|
+
],
|
289
|
+
},
|
290
|
+
]
|
291
|
+
|
292
|
+
cases.each do |c|
|
293
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
294
|
+
begin
|
295
|
+
case_before c
|
296
|
+
|
297
|
+
# -- given --
|
298
|
+
# nothing
|
299
|
+
|
300
|
+
# -- when --
|
301
|
+
actual = Tudu::Tasks.get_doings
|
302
|
+
|
303
|
+
# -- then --
|
304
|
+
ret = expect(actual).to eq(c[:expected])
|
305
|
+
ensure
|
306
|
+
case_after c
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
def case_before(c)
|
311
|
+
# implement each case before
|
312
|
+
Dir.mkdir("./#{Tudu::Tasks::TUDU_DIR}")
|
313
|
+
File.open("./#{Tudu::Tasks::TUDU_DIR}/#{c[:type]}", "w") {|f|f.puts c[:texts].join("\n")}
|
314
|
+
end
|
315
|
+
|
316
|
+
def case_after(c)
|
317
|
+
# implement each case after
|
318
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
319
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
context :get_dones do
|
325
|
+
cases = [
|
326
|
+
{
|
327
|
+
case_no: 1,
|
328
|
+
case_title: "get done from file",
|
329
|
+
type: "dones",
|
330
|
+
texts: ["task1", "task2", "task3"],
|
331
|
+
expected: [
|
332
|
+
Tudu::Tasks.new("dones", "task1"),
|
333
|
+
Tudu::Tasks.new("dones", "task2"),
|
334
|
+
Tudu::Tasks.new("dones", "task3"),
|
335
|
+
],
|
336
|
+
},
|
337
|
+
]
|
338
|
+
|
339
|
+
cases.each do |c|
|
340
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
341
|
+
begin
|
342
|
+
case_before c
|
343
|
+
|
344
|
+
# -- given --
|
345
|
+
# nothing
|
346
|
+
|
347
|
+
# -- when --
|
348
|
+
actual = Tudu::Tasks.get_dones
|
349
|
+
|
350
|
+
# -- then --
|
351
|
+
ret = expect(actual).to eq(c[:expected])
|
352
|
+
ensure
|
353
|
+
case_after c
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
def case_before(c)
|
358
|
+
# implement each case before
|
359
|
+
Dir.mkdir("./#{Tudu::Tasks::TUDU_DIR}")
|
360
|
+
File.open("./#{Tudu::Tasks::TUDU_DIR}/#{c[:type]}", "w") {|f|f.puts c[:texts].join("\n")}
|
361
|
+
end
|
362
|
+
|
363
|
+
def case_after(c)
|
364
|
+
# implement each case after
|
365
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
366
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
context :find_tasks do
|
372
|
+
cases = [
|
373
|
+
{
|
374
|
+
case_no: 1,
|
375
|
+
case_title: "find todos from tasks",
|
376
|
+
type: "todos",
|
377
|
+
texts: ["task1", "task2", "task3"],
|
378
|
+
search_name: "task1",
|
379
|
+
expected: Tudu::Tasks.new("todos", "task1")
|
380
|
+
},
|
381
|
+
{
|
382
|
+
case_no: 2,
|
383
|
+
case_title: "find doings from tasks",
|
384
|
+
type: "doings",
|
385
|
+
texts: ["task1", "task2", "task3"],
|
386
|
+
search_name: "task1",
|
387
|
+
expected: Tudu::Tasks.new("doings", "task1")
|
388
|
+
},
|
389
|
+
{
|
390
|
+
case_no: 3,
|
391
|
+
case_title: "find done from tasks",
|
392
|
+
type: "dones",
|
393
|
+
texts: ["task1", "task2", "task3"],
|
394
|
+
search_name: "task1",
|
395
|
+
expected: Tudu::Tasks.new("dones", "task1")
|
396
|
+
},
|
397
|
+
{
|
398
|
+
case_no: 4,
|
399
|
+
case_title: "not find",
|
400
|
+
type: "dones",
|
401
|
+
texts: ["task1", "task2", "task3"],
|
402
|
+
search_name: "task4",
|
403
|
+
expected: nil
|
404
|
+
},
|
405
|
+
]
|
406
|
+
|
407
|
+
cases.each do |c|
|
408
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
409
|
+
begin
|
410
|
+
case_before c
|
411
|
+
|
412
|
+
# -- given --
|
413
|
+
# nothing
|
414
|
+
|
415
|
+
# -- when --
|
416
|
+
actual = Tudu::Tasks.find_tasks c[:search_name]
|
417
|
+
|
418
|
+
# -- then --
|
419
|
+
ret = expect(actual).to eq(c[:expected])
|
420
|
+
ensure
|
421
|
+
case_after c
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
def case_before(c)
|
426
|
+
# implement each case before
|
427
|
+
Tudu::Core.new.init
|
428
|
+
Dir.mkdir(Tudu::Tasks::TUDU_DIR) unless File.exists?(Tudu::Tasks::TUDU_DIR)
|
429
|
+
File.open("./#{Tudu::Tasks::TUDU_DIR}/#{c[:type]}", "w") {|f|f.puts c[:texts].join("\n")}
|
430
|
+
end
|
431
|
+
|
432
|
+
def case_after(c)
|
433
|
+
# implement each case after
|
434
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
435
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
context :choose do
|
441
|
+
cases = [
|
442
|
+
{
|
443
|
+
case_no: 1,
|
444
|
+
case_title: "choose task",
|
445
|
+
type: "todos",
|
446
|
+
texts: ["task1", "task2", "task3"],
|
447
|
+
choose: "task1",
|
448
|
+
expected: [
|
449
|
+
Tudu::Tasks.new("todos", "task2"),
|
450
|
+
Tudu::Tasks.new("todos", "task3"),
|
451
|
+
Tudu::Tasks.new("doings", "task1"),
|
452
|
+
]
|
453
|
+
},
|
454
|
+
{
|
455
|
+
case_no: 2,
|
456
|
+
case_title: "aleady exists doing",
|
457
|
+
type: "doings",
|
458
|
+
texts: ["task1", "task2", "task3"],
|
459
|
+
choose: "task1",
|
460
|
+
expected: [
|
461
|
+
Tudu::Tasks.new("doings", "task1"),
|
462
|
+
Tudu::Tasks.new("doings", "task2"),
|
463
|
+
Tudu::Tasks.new("doings", "task3"),
|
464
|
+
]
|
465
|
+
},
|
466
|
+
{
|
467
|
+
case_no: 3,
|
468
|
+
case_title: "not exists task",
|
469
|
+
type: "todos",
|
470
|
+
texts: ["task1", "task2", "task3"],
|
471
|
+
choose: "task4",
|
472
|
+
expected: [
|
473
|
+
Tudu::Tasks.new("todos", "task1"),
|
474
|
+
Tudu::Tasks.new("todos", "task2"),
|
475
|
+
Tudu::Tasks.new("todos", "task3"),
|
476
|
+
]
|
477
|
+
},
|
478
|
+
{
|
479
|
+
case_no: 4,
|
480
|
+
case_title: "task exists, but dones",
|
481
|
+
type: "dones",
|
482
|
+
texts: ["task1", "task2", "task3"],
|
483
|
+
choose: "task1",
|
484
|
+
expected: [
|
485
|
+
Tudu::Tasks.new("dones", "task1"),
|
486
|
+
Tudu::Tasks.new("dones", "task2"),
|
487
|
+
Tudu::Tasks.new("dones", "task3"),
|
488
|
+
]
|
489
|
+
},
|
490
|
+
]
|
491
|
+
|
492
|
+
cases.each do |c|
|
493
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
494
|
+
begin
|
495
|
+
case_before c
|
496
|
+
|
497
|
+
# -- given --
|
498
|
+
# nothing
|
499
|
+
|
500
|
+
# -- when --
|
501
|
+
Tudu::Tasks.choose c[:choose]
|
502
|
+
|
503
|
+
# -- then --
|
504
|
+
expect(Tudu::Tasks.get_tasks).to eq(c[:expected])
|
505
|
+
ensure
|
506
|
+
case_after c
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
def case_before(c)
|
511
|
+
# implement each case before
|
512
|
+
Tudu::Core.new.init
|
513
|
+
File.open("./#{Tudu::Tasks::TUDU_DIR}/#{c[:type]}", "w") {|f|f.puts c[:texts].join("\n")}
|
514
|
+
end
|
515
|
+
|
516
|
+
def case_after(c)
|
517
|
+
# implement each case after
|
518
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
519
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
context :done do
|
525
|
+
cases = [
|
526
|
+
{
|
527
|
+
case_no: 1,
|
528
|
+
case_title: "one doing to done, shift todo to doing",
|
529
|
+
task_names: ["task1", "task2", "task3"],
|
530
|
+
choose: "task1",
|
531
|
+
expected: [
|
532
|
+
Tudu::Tasks.new("todos", "task3"),
|
533
|
+
Tudu::Tasks.new("doings", "task2"),
|
534
|
+
Tudu::Tasks.new("dones", "task1"),
|
535
|
+
]
|
536
|
+
},
|
537
|
+
{
|
538
|
+
case_no: 2,
|
539
|
+
case_title: "one doing to done, not shift todo to doing",
|
540
|
+
task_names: ["task1"],
|
541
|
+
choose: "task1",
|
542
|
+
expected: [
|
543
|
+
Tudu::Tasks.new("dones", "task1"),
|
544
|
+
]
|
545
|
+
},
|
546
|
+
{
|
547
|
+
case_no: 3,
|
548
|
+
case_title: "no doing",
|
549
|
+
task_names: ["task1"],
|
550
|
+
choose: "",
|
551
|
+
expected: [
|
552
|
+
Tudu::Tasks.new("todos", "task1"),
|
553
|
+
]
|
554
|
+
},
|
555
|
+
]
|
556
|
+
|
557
|
+
cases.each do |c|
|
558
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
559
|
+
begin
|
560
|
+
case_before c
|
561
|
+
|
562
|
+
# -- given --
|
563
|
+
Tudu::Core.new.init
|
564
|
+
Tudu::Tasks.add *c[:task_names]
|
565
|
+
Tudu::Tasks.choose c[:choose]
|
566
|
+
|
567
|
+
# -- when --
|
568
|
+
Tudu::Tasks.done
|
569
|
+
|
570
|
+
# -- then --
|
571
|
+
expect(Tudu::Tasks.get_tasks).to eq(c[:expected])
|
572
|
+
ensure
|
573
|
+
case_after c
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
def case_before(c)
|
578
|
+
# implement each case before
|
579
|
+
end
|
580
|
+
|
581
|
+
def case_after(c)
|
582
|
+
# implement each case after
|
583
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
584
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
585
|
+
end
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
context :add do
|
590
|
+
cases = [
|
591
|
+
{
|
592
|
+
case_no: 1,
|
593
|
+
case_title: "single add",
|
594
|
+
task_names1: "task_name",
|
595
|
+
task_names2: nil,
|
596
|
+
task_names3: nil,
|
597
|
+
expected: [
|
598
|
+
Tudu::Tasks.new("todos", "task_name")
|
599
|
+
]
|
600
|
+
},
|
601
|
+
{
|
602
|
+
case_no: 2,
|
603
|
+
case_title: "nil add",
|
604
|
+
task_names1: nil,
|
605
|
+
task_names2: nil,
|
606
|
+
task_names3: nil,
|
607
|
+
expected: []
|
608
|
+
},
|
609
|
+
{
|
610
|
+
case_no: 3,
|
611
|
+
case_title: "multi add",
|
612
|
+
task_names1: "task_name1",
|
613
|
+
task_names2: "task_name2",
|
614
|
+
task_names3: "task_name3",
|
615
|
+
expected: [
|
616
|
+
Tudu::Tasks.new("todos", "task_name1"),
|
617
|
+
Tudu::Tasks.new("todos", "task_name2"),
|
618
|
+
Tudu::Tasks.new("todos", "task_name3")
|
619
|
+
]
|
620
|
+
},
|
621
|
+
{
|
622
|
+
case_no: 4,
|
623
|
+
case_title: "duplicate add",
|
624
|
+
task_names1: "task_name1",
|
625
|
+
task_names2: "task_name1",
|
626
|
+
task_names3: nil,
|
627
|
+
expected: [
|
628
|
+
Tudu::Tasks.new("todos", "task_name1"),
|
629
|
+
]
|
630
|
+
},
|
631
|
+
]
|
632
|
+
|
633
|
+
cases.each do |c|
|
634
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
635
|
+
begin
|
636
|
+
case_before c
|
637
|
+
|
638
|
+
# -- given --
|
639
|
+
Tudu::Core.new.init
|
640
|
+
|
641
|
+
# -- when --
|
642
|
+
actual = Tudu::Tasks.add c[:task_names1], c[:task_names2], c[:task_names3]
|
643
|
+
|
644
|
+
# -- then --
|
645
|
+
actual = Tudu::Tasks.get_todos
|
646
|
+
expect(actual).to eq(c[:expected])
|
647
|
+
ensure
|
648
|
+
case_after c
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
def case_before(c)
|
653
|
+
# implement each case before
|
654
|
+
end
|
655
|
+
|
656
|
+
def case_after(c)
|
657
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
658
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
659
|
+
end
|
660
|
+
end
|
661
|
+
end
|
662
|
+
|
663
|
+
|
664
|
+
context :remove do
|
665
|
+
cases = [
|
666
|
+
{
|
667
|
+
case_no: 1,
|
668
|
+
case_title: "single remove",
|
669
|
+
add_tasks: ["task_name"],
|
670
|
+
remove_tasks: ["task_name"],
|
671
|
+
expected_tasks: [],
|
672
|
+
},
|
673
|
+
{
|
674
|
+
case_no: 2,
|
675
|
+
case_title: "multi remove",
|
676
|
+
add_tasks: ["task_name1", "task_name2", "task_name3"],
|
677
|
+
remove_tasks: ["task_name1", "task_name2", "task_name3"],
|
678
|
+
expected_tasks: [],
|
679
|
+
},
|
680
|
+
{
|
681
|
+
case_no: 3,
|
682
|
+
case_title: "not remove",
|
683
|
+
add_tasks: ["task_name"],
|
684
|
+
remove_tasks: ["invalid name"],
|
685
|
+
expected_tasks: [Tudu::Tasks.new("todos", "task_name")],
|
686
|
+
},
|
687
|
+
]
|
688
|
+
|
689
|
+
cases.each do |c|
|
690
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
691
|
+
begin
|
692
|
+
case_before c
|
693
|
+
|
694
|
+
# -- given --
|
695
|
+
Tudu::Core.new.init
|
696
|
+
Tudu::Tasks.add *c[:add_tasks]
|
697
|
+
|
698
|
+
# -- when --
|
699
|
+
Tudu::Tasks.remove *c[:remove_tasks]
|
700
|
+
|
701
|
+
# -- then --
|
702
|
+
actual = Tudu::Tasks.get_tasks
|
703
|
+
expect(actual).to eq(c[:expected_tasks])
|
704
|
+
ensure
|
705
|
+
case_after c
|
706
|
+
end
|
707
|
+
end
|
708
|
+
|
709
|
+
def case_before(c)
|
710
|
+
# implement each case before
|
711
|
+
end
|
712
|
+
|
713
|
+
def case_after(c)
|
714
|
+
return unless File.exists? Tudu::Tasks::TUDU_DIR
|
715
|
+
FileUtils.rm_rf(Tudu::Tasks::TUDU_DIR)
|
716
|
+
end
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
context :filter_tasks do
|
721
|
+
cases = [
|
722
|
+
{
|
723
|
+
case_no: 1,
|
724
|
+
case_title: "get todos from file",
|
725
|
+
tasks: [
|
726
|
+
Tudu::Tasks.new("doings", "task1_1"),
|
727
|
+
Tudu::Tasks.new("doings", "task1_2"),
|
728
|
+
Tudu::Tasks.new("doings", "task3"),
|
729
|
+
],
|
730
|
+
filter_word: "task1_1",
|
731
|
+
expected: [Tudu::Tasks.new("doings", "task1_1")],
|
732
|
+
},
|
733
|
+
]
|
734
|
+
|
735
|
+
cases.each do |c|
|
736
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
737
|
+
begin
|
738
|
+
case_before c
|
739
|
+
|
740
|
+
# -- given --
|
741
|
+
# nothing
|
742
|
+
|
743
|
+
# -- when --
|
744
|
+
actual = Tudu::Tasks.filter_tasks(c[:tasks], c[:filter_word])
|
745
|
+
|
746
|
+
# -- then --
|
747
|
+
ret = expect(actual).to eq(c[:expected])
|
748
|
+
ensure
|
749
|
+
case_after c
|
750
|
+
end
|
751
|
+
end
|
752
|
+
|
753
|
+
def case_before(c)
|
754
|
+
# implement each case before
|
755
|
+
end
|
756
|
+
|
757
|
+
def case_after(c)
|
758
|
+
# implement each case after
|
759
|
+
end
|
760
|
+
end
|
761
|
+
end
|
762
|
+
end
|