Sha256: a605cbc1b4a017ca732bcfda9fe71676a510b6d0deddb10922ccdd6d48bcc676

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 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', 'select_project_and_environment_filter'))

describe 'filtering configuration data by selecting the data for the project and environment' do
  before do
    @config = WhiskeyDisk::Config.new
    @filter = WhiskeyDisk::Config::SelectProjectAndEnvironmentFilter.new(@config)
    
    @data = { 
      'project' => { 'environment' => { 'a' => 'b' } },
      'other'   => { 'missing' => { 'c' => 'd' } },
    }
  end
  
  it 'fails when the specified project cannot be found' do
    ENV['to'] = @env = 'something:environment'
    lambda { @filter.filter(@data) }.should.raise
  end

  it 'fails when the specified environment cannot be found for the specified project' do
    ENV['to'] = @env = 'other:environment'
    lambda { @filter.filter(@data) }.should.raise
  end

  it 'returns only the data for the specified project and environment' do
    ENV['to'] = @env = 'project:environment'
    @filter.filter(@data).should == @data['project']['environment']
  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/select_project_and_environment_filter_spec.rb
ol-whisk_deploy-0.6.26 spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb
whisk_deploy-0.6.26 spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb
whiskey_disk-0.6.24 spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb
whiskey_disk-0.6.23 spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb