Sha256: 50791a53845a2ad88bdf30b8ca4f472e4656ee37f7fdd26e07e71cb8be4c3422

Contents?: true

Size: 1.85 KB

Versions: 18

Compression:

Stored size: 1.85 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?(["organizations", "chef", "environments", name])
    chef_server.data_store.delete(["organizations", "chef", "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

18 entries across 18 versions & 1 rubygems

Version Path
berkshelf-6.3.4 features/step_definitions/chef_server_steps.rb
berkshelf-6.3.3 features/step_definitions/chef_server_steps.rb
berkshelf-6.3.2 features/step_definitions/chef_server_steps.rb
berkshelf-6.3.1 features/step_definitions/chef_server_steps.rb
berkshelf-6.3.0 features/step_definitions/chef_server_steps.rb
berkshelf-6.2.2 features/step_definitions/chef_server_steps.rb
berkshelf-6.2.1 features/step_definitions/chef_server_steps.rb
berkshelf-6.2.0 features/step_definitions/chef_server_steps.rb
berkshelf-6.1.1 features/step_definitions/chef_server_steps.rb
berkshelf-6.1.0 features/step_definitions/chef_server_steps.rb
berkshelf-6.0.1 features/step_definitions/chef_server_steps.rb
berkshelf-6.0.0 features/step_definitions/chef_server_steps.rb
berkshelf-5.6.5 features/step_definitions/chef_server_steps.rb
berkshelf-5.6.4 features/step_definitions/chef_server_steps.rb
berkshelf-5.6.3 features/step_definitions/chef_server_steps.rb
berkshelf-5.6.2 features/step_definitions/chef_server_steps.rb
berkshelf-5.6.1 features/step_definitions/chef_server_steps.rb
berkshelf-5.6.0 features/step_definitions/chef_server_steps.rb