File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 44 let ( :path ) { "spec/fixtures/#{ file } .yaml" }
55 let ( :file ) { 'basic' }
66
7+ describe '::read' do
8+ it 'reads from io' do
9+ io = double :io , read : "cli: [--help, --version]"
10+ expect ( described_class . read ( io ) . config . config ) . to eq ( { 'cli' => %w[ --help --version ] } )
11+ end
12+ end
13+
714 describe '#valid?' do
815 context 'when all patterns start with the same word' do
916 it 'returns true' do
Original file line number Diff line number Diff line change 33
44 let ( :path ) { "spec/fixtures/#{ file } .yaml" }
55 let ( :file ) { 'nested' }
6+ let ( :config_string ) { "cli: [--help, --version]" }
7+ let ( :config_hash ) { { 'cli' => %w[ --help --version ] } }
8+
9+ describe '::parse' do
10+ it 'loads config from string' do
11+ expect ( described_class . parse ( config_string ) . config ) . to eq config_hash
12+ end
13+
14+ context 'when the string is not a valid YAML' do
15+ it 'raises ParseError' do
16+ expect { described_class . parse ( "not: a: yaml" ) } . to raise_error ( Completely ::ParseError )
17+ end
18+ end
19+ end
20+
21+ describe '::read' do
22+ it 'loads config from io' do
23+ io = double :io , read : config_string
24+ expect ( described_class . read ( io ) . config ) . to eq config_hash
25+ end
26+ end
627
728 describe '#flat_config' do
829 it 'returns a flat pattern => completions hash' do
You can’t perform that action at this time.
0 commit comments