Sha256: 424cda0712331441831e11e51628afb00477251fcf0391a5a444ea3ded2f5b70
Contents?: true
Size: 1.96 KB
Versions: 5
Compression:
Stored size: 1.96 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper.rb')) require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'lib', 'whiskey_disk', 'config')) require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'lib', 'whiskey_disk', 'config', 'filters', 'normalize_ssh_options_filter')) describe 'normalizing SSH options' do before do @config = WhiskeyDisk::Config.new @filter = WhiskeyDisk::Config::NormalizeSshOptionsFilter.new(@config) end it 'eliminates ssh options with nil, or empty values' do @data = { 'domain' => [ { 'name' => 'foo', 'ssh_options' => nil }, { 'name' => 'bar', 'ssh_options' => '' }, { 'name' => 'baz', 'ssh_options' => [] }, { 'name' => 'xyzzy', 'ssh_options' => ['', ''] }, { 'name' => 'quux', 'ssh_options' => [nil, '', nil] }, ] } @filter.filter(@data).should == { 'domain' => [ { 'name' => 'foo' }, { 'name' => 'bar' }, { 'name' => 'baz' }, { 'name' => 'xyzzy' }, { 'name' => 'quux' } ] } end it 'preserves non-empty ssh options' do @data = { 'domain' => [ { 'name' => 'foo', 'ssh_options' => nil }, { 'name' => 'bar', 'ssh_options' => 'c' }, { 'name' => 'baz', 'ssh_options' => [] }, { 'name' => 'xyzzy', 'ssh_options' => ['', 'c'] }, { 'name' => 'quux', 'ssh_options' => [nil, '', 'a', nil, 'b' ] }, { 'name' => 'wut', 'ssh_options' => [nil, '', 'x', 'a', 'a', nil, 'b' ] }, ] } @filter.filter(@data).should == { 'domain' => [ { 'name' => 'foo' }, { 'name' => 'bar', 'ssh_options' => [ 'c' ] }, { 'name' => 'baz' }, { 'name' => 'xyzzy', 'ssh_options' => [ 'c' ] }, { 'name' => 'quux', 'ssh_options' => [ 'a', 'b' ] }, { 'name' => 'wut', 'ssh_options' => [ 'x', 'a', 'a', 'b' ] } ] } end end
Version data entries
5 entries across 5 versions & 3 rubygems