Sha256: 1fbb362bbda4156d0baab5b64ffe3d57ad6265ca6ef4fd4667f52b79b24dfc42
Contents?: true
Size: 1.86 KB
Versions: 3
Compression:
Stored size: 1.86 KB
Contents
require 'phut' require 'stringio' describe Phut::Parser do describe '#parse' do Given do allow(IO).to receive(:read).with('CONFIGURATION_FILE').and_return(string) end Given(:configuration) { Phut::Parser.new.parse 'CONFIGURATION_FILE' } context "with 'vswitch { dpid '0xabc' }'" do When(:string) { "vswitch { dpid '0xabc' }" } describe '#vswitch' do Then { configuration.fetch('0xabc').datapath_id == 0xabc } Then { configuration.fetch('0xabc').dpid == 0xabc } end end context "with 'vswitch { datapath_id '0xabc' }" do When(:string) { "vswitch { datapath_id '0xabc' }" } describe '#vswitch' do Then { configuration.fetch('0xabc').dpid == 0xabc } Then { configuration.fetch('0xabc').datapath_id == 0xabc } end end context "with 'vswitch('my_controller') { dpid '0xabc' }'" do When(:string) { "vswitch('my_controller') { dpid '0xabc' }" } describe '#vswitch' do Then { configuration.fetch('my_controller').dpid == 0xabc } Then { configuration.fetch('my_controller').datapath_id == 0xabc } end end context "with 'vhost { ip '192.168.0.1' }' ..." do When(:string) do <<-CONFIGURATION vhost { ip '192.168.0.1' } vhost { ip '192.168.0.2' } link '192.168.0.1', '192.168.0.2' CONFIGURATION end describe '#vhost' do Then { configuration.fetch('192.168.0.1').ip_address == '192.168.0.1' } end end context "with 'vhost('host1') { ip '192.168.0.1' }' ..." do When(:string) do <<-CONFIGURATION vhost('host1') { ip '192.168.0.1' } vhost('host2') { ip '192.168.0.2' } link 'host1', 'host2' CONFIGURATION end describe '#vhost' do Then { configuration.fetch('host1').ip_address == '192.168.0.1' } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phut-0.7.7 | spec/phut/parser_spec.rb |
phut-0.7.6 | spec/phut/parser_spec.rb |
phut-0.7.5 | spec/phut/parser_spec.rb |