/
conf_loading_handler_spec.rb
60 lines (42 loc) · 1.34 KB
/
conf_loading_handler_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$:.unshift "spec/"
require './spec/spec_helper'
require 'xiki/handlers/conf_loading_handler'
%w"xiki/core/tree".each {|o| require o}
# Menus should use Xik.new, to parse.
# - or whatever else they want, like YAML::load
# describe ConfLoadingHandler, "#parse" do
# it "makes a hash of one line" do
# txt = "- password: BaaRamEwe"
# ConfLoadingHandler.parse(txt).should == {"password"=>"BaaRamEwe"}
# end
# it "makes a hash of two lines" do
# txt = "
# - password: BaaRamEwe
# - motto: Baa
# ".unindent
# ConfLoadingHandler.parse(txt).should == {"password"=>"BaaRamEwe", "motto"=>"Baa"}
# end
# it "ignores headings and blank lines" do
# txt = "
# > Ignore headings
# - password: BaaRamEwe
# - motto: Baa
# ".unindent
# ConfLoadingHandler.parse(txt).should == {"password"=>"BaaRamEwe", "motto"=>"Baa"}
# end
# it "doesn't require dashes" do
# txt = "password: BaaRamEwe"
# ConfLoadingHandler.parse(txt).should == {"password"=>"BaaRamEwe"}
# end
# # it "handles nesting" do
# #
# # - What about the "- motto: Baa" vs "- motto/Baa" question?
# # - For the xi syntax
# #
# # txt = "
# # - sheep password: Baa Ram Ewe
# # - sheep mottos
# # - Just keep baa'ing
# # - Curlyness is next to godliness
# # ".unindent
# end