features/install_command.feature in berkshelf-2.0.0.beta vs features/install_command.feature in berkshelf-2.0.0
- old
+ new
@@ -1,34 +1,10 @@
Feature: install cookbooks from a Berksfile
As a user with a Berksfile
I want to be able to run knife berkshelf install to install my cookbooks
So that I don't have to download my cookbooks and their dependencies manually
- Scenario: installing with the old lockfile format
- Given I write to "Berksfile" with:
- """
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
- """
- Given I write to "Berksfile.lock" with:
- """
- cookbook 'berkshelf-cookbook-fixture', :locked_version => '1.0.0'
- """
- When I successfully run `berks install`
- Then the output should contain "You are using the old lockfile format. Attempting to convert..."
- Then the file "Berksfile.lock" should contain JSON:
- """
- {
- "sha":"bfb1de046fdc2a0c38cd5bbaddddce8bc1cd3c24",
- "sources":{
- "berkshelf-cookbook-fixture":{
- "locked_version":"1.0.0",
- "constraint":"= 1.0.0"
- }
- }
- }
- """
-
Scenario: installing a Berksfile that contains a source with a default location
Given I write to "Berksfile" with:
"""
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
"""
@@ -180,11 +156,11 @@
cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "somethingabsurd"
"""
When I run `berks install`
Then the output should contain:
"""
- 'somethingabsurd' is not a supported Git protocol for the 'github' location key. Please use 'git' instead.
+ 'somethingabsurd' is not supported for the 'github' location key - please use 'git' instead
"""
And the exit status should be 110
Scenario: installing a Berksfile that contains an explicit site location
Given I write to "Berksfile" with:
@@ -242,11 +218,11 @@
cookbook 'nginx', git: '/something/on/disk'
"""
When I run `berks install`
Then the output should contain:
"""
- '/something/on/disk' is not a valid Git URI.
+ '/something/on/disk' is not a valid Git URI
"""
And the CLI should exit with the status code for error "InvalidGitURI"
Scenario: installing when there are sources with duplicate names defined in the same group
Given I write to "Berksfile" with:
@@ -273,11 +249,11 @@
berkshelf-cookbook-fixture \(.+\)
does not satisfy the version constraint:
berkshelf-cookbook-fixture \(= 1.0.0\)
- This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`\.
+ This occurs when the Chef Server has a cookbook with a missing/mis-matched version number in its `metadata.rb`
"""
And the CLI should exit with the status code for error "CookbookValidationFailure"
Scenario: when a git location source is defined and a cookbook of the same name is already cached in the cookbook store
Given I write to "Berksfile" with:
@@ -320,35 +296,50 @@
"""
And the cookbook store should have the cookbooks:
| berkshelf-cookbook-fixture | 1.0.0 |
And the exit status should be 0
+ Scenario: when the :site is not defined
+ Given I write to "Berksfile" with:
+ """
+ cookbook 'berkshelf-cookbook-fixture', '1.0.0', site: nil
+ """
+ When I successfully run `berks install`
+ Then the output should contain:
+ """
+ Installing berkshelf-cookbook-fixture (1.0.0) from site:
+ """
+ And the cookbook store should have the cookbooks:
+ | berkshelf-cookbook-fixture | 1.0.0 |
+ And the exit status should be 0
+
Scenario: with a chef_api source location specifying :config when a Berkshelf config is not found at the given path
Given I write to "Berksfile" with:
"""
cookbook 'berkshelf-cookbook-fixture', chef_api: :config
"""
When I run the install command with flags:
| -c /tmp/notthere.lol |
Then the output should contain:
"""
- You specified a path to a configuration file that did not exist: '/tmp/notthere.lol'
+ No Berkshelf config file found at: '/tmp/notthere.lol'!
"""
- And the CLI should exit with the status code for error "BerksConfigNotFound"
+ And the CLI should exit with the status code for error "ConfigNotFound"
Scenario: with a git error during download
Given I write to "Berksfile" with:
"""
cookbook 'berkshelf-cookbook-fixture', '1.0.0'
cookbook "doesntexist", git: "git://github.com/asdjhfkljashflkjashfakljsf"
"""
When I run `berks install`
Then the output should contain:
"""
- Installing berkshelf-cookbook-fixture (1.0.0) from site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
- Failed to download 'doesntexist' from git: 'git://github.com/asdjhfkljashflkjashfakljsf' with branch: 'master'
- An error occured during Git execution:
+ An error occurred during Git execution:
+
+ fatal: remote error:
+ Repository not found.
"""
And the CLI should exit with the status code for error "GitError"
Scenario: invalid site symbol
Given I write to "Berksfile" with:
@@ -357,7 +348,7 @@
cookbook 'berkshelf-cookbook-fixture'
"""
When I run `berks install`
Then the output should contain:
"""
- Unknown site shortname: :somethingabsurd. Supported shortnames are: :opscode
+ Unknown site shortname 'somethingabsurd' - supported shortnames are:
"""