Sha256: 9cf5f2155360ed3c4e52706eaa558651c74d6f4b81c012ee3b2b3da8b3007d68

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 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', 'convert_role_strings_to_list_filter'))

describe 'converting domain role strings into lists' do
  before do
    @config = WhiskeyDisk::Config.new
    @filter = WhiskeyDisk::Config::ConvertRoleStringsToListFilter.new(@config)
  end
  
  it 'handles single strings' do
    @data = {
      'domain' => [
        { 'name' => 'foo', 'roles' => 'baz' },
        { 'name' => 'bar', 'roles' => 'xyzzy' },
      ]
    }
    
    @filter.filter(@data).should == {      
      'domain' => [
        { 'name' => 'foo', 'roles' => [ 'baz' ] },
        { 'name' => 'bar', 'roles' => [ 'xyzzy' ] },
      ]
    }
  end
  
  it 'does not touch domains without roles' do
    @data = {
      'domain' => [
        { 'name' => 'foo' },
        { 'name' => 'bar' }
      ]
    }
    
    @filter.filter(@data).should == @data  
  end
  
  it 'leaves existing role lists alone' do
    @data = {
      'domain' => [
        { 'name' => 'foo', 'roles' => [ 'baz' ] },
        { 'name' => 'bar', 'roles' => [ 'xyzzy', 'quux' ] },
      ]
    }
    
    @filter.filter(@data).should == @data
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
ol-whisk_deploy-0.6.25 spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb
ol-whisk_deploy-0.6.26 spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb
whisk_deploy-0.6.26 spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb
whiskey_disk-0.6.24 spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb
whiskey_disk-0.6.23 spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb