Sha256: 854de0ea24e2f5b13f20ac8b3380c27524b5247d33764aba4778104ee87a8da4

Contents?: true

Size: 1.8 KB

Versions: 19

Compression:

Stored size: 1.8 KB

Contents

World(Berkshelf::RSpec::ChefServer)

Given(/^the Chef Server is empty$/) do
  Berkshelf::RSpec::ChefServer.reset!
end

Given /^the Chef Server has cookbooks:$/ do |cookbooks|
  cookbooks.raw.each do |name, version, dependencies|
    metadata = []
    metadata << "name '#{name}'"
    metadata << "version '#{version}'"
    dependencies.to_s.split(',').map { |d| d.split(' ', 2) }.each do |(name, constraint)|
      metadata << "depends '#{name}', '#{constraint}'"
    end

    chef_cookbook(name, { 'metadata.rb' => metadata.join("\n") })
  end
end

Given /^the Chef Server has frozen cookbooks:$/ do |cookbooks|
  cookbooks.raw.each do |name, version|
    chef_cookbook(name, { 'metadata.rb' => "version '#{version}'", frozen: true })
  end
end

Given(/^the Chef Server has an environment named "(.*?)"$/) do |name|
  chef_environment(name, { 'description' => 'This is an environment' })
end

Given(/^the Chef Server does not have an environment named "(.*?)"$/) do |name|
  if chef_server.data_store.exists?(['environments', name])
    chef_server.data_store.delete(['environments', name])
  end
end

Then /^the Chef Server should have the cookbooks:$/ do |cookbooks|
  list = chef_cookbooks
  cookbooks.raw.each do |name, version|
    expect(list.keys).to  include(name)
    expect(list[name]).to include(version) unless version.nil?
  end
end

Then /^the Chef Server should not have the cookbooks:$/ do |cookbooks|
  list = chef_cookbooks
  cookbooks.raw.each do |name, version|
    unless version.nil?
      expect(list.keys).to_not include(name)
    else
      expect(list[name] || []).to_not include(version)
    end
  end
end

Then(/^the version locks in the "(.*?)" environment should be:$/) do |name, locks|
  list = chef_environment_locks(name)
  locks.raw.each do |cookbook, version|
    expect(list[cookbook]).to eq(version)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
berkshelf-4.0.1 features/step_definitions/chef_server_steps.rb
berkshelf-4.0.0 features/step_definitions/chef_server_steps.rb
berkshelf-3.3.0 features/step_definitions/chef_server_steps.rb
berkshelf-3.2.4 features/step_definitions/chef_server_steps.rb
berkshelf-3.2.3 features/step_definitions/chef_server_steps.rb
berkshelf-3.2.2 features/step_definitions/chef_server_steps.rb
berkshelf-3.2.1 features/step_definitions/chef_server_steps.rb
berkshelf-3.2.0 features/step_definitions/chef_server_steps.rb
berkshelf-3.1.5 features/step_definitions/chef_server_steps.rb
berkshelf-3.1.4 features/step_definitions/chef_server_steps.rb
berkshelf-3.1.3 features/step_definitions/chef_server_steps.rb
berkshelf-3.1.2 features/step_definitions/chef_server_steps.rb
berkshelf-3.1.1 features/step_definitions/chef_server_steps.rb
berkshelf-3.1.0 features/step_definitions/chef_server_steps.rb
berkshelf-3.0.1 features/step_definitions/chef_server_steps.rb
berkshelf-3.0.0 features/step_definitions/chef_server_steps.rb
berkshelf-3.0.0.rc1 features/step_definitions/chef_server_steps.rb
berkshelf-3.0.0.beta9 features/step_definitions/chef_server_steps.rb
berkshelf-3.0.0.beta8 features/step_definitions/chef_server_steps.rb