features/package_command.feature in berkshelf-2.0.0.beta vs features/package_command.feature in berkshelf-2.0.0

- old
+ new

@@ -1,39 +1,61 @@ -Feature: package command +Feature: Packaging a cookbook as a tarball for distribution As a user I want to be able to package a cookbook So that I can use it outside of Berkshelf - Scenario: Running the package command - Given I write to "Berksfile" with: + Scenario: When no options are passed + Given the cookbook store has the cookbooks: + | fake | 1.0.0 | + And I write to "Berksfile" with: """ site :opscode - cookbook 'berkshelf-cookbook-fixture', '~> 1.0.0' + cookbook 'fake', '~> 1.0.0' """ - And I successfully run `berks install` - When I successfully run `berks package berkshelf-cookbook-fixture` - Then a file named "berkshelf-cookbook-fixture.tar.gz" should exist - And the output should contain "Cookbook 'berkshelf-cookbook-fixture' saved to " + When I successfully run `berks package fake` + Then a file named "fake.tar.gz" should exist + And the output should contain: + """ + Cookbook(s) packaged to + """ And the exit status should be 0 - Scenario: Running the package command with the --output option - Given I write to "Berksfile" with: + Scenario: With the --output option + Given the cookbook store has the cookbooks: + | fake | 1.0.0 | + And I write to "Berksfile" with: """ site :opscode - cookbook 'berkshelf-cookbook-fixture', '~> 1.0.0' + cookbook 'fake', '~> 1.0.0' """ - And I successfully run `berks install` - When I successfully run `berks package berkshelf-cookbook-fixture --output foo/bar` - Then a file named "foo/bar/berkshelf-cookbook-fixture.tar.gz" should exist + When I successfully run `berks package fake --output foo/bar` + Then a file named "foo/bar/fake.tar.gz" should exist And the exit status should be 0 - Scenario: Running the package command with an installed cookbook name - Given I write to "Berksfile" with: + Scenario: With an installed cookbook name + Given the cookbook store has the cookbooks: + | fake | 1.0.0 | + And I write to "Berksfile" with: """ site :opscode - cookbook 'berkshelf-cookbook-fixture', '~> 1.0.0' + cookbook 'fake', '~> 1.0.0' """ - And I successfully run `berks install` When I run `berks package non-existent` Then a file named "non-existent.tar.gz" should not exist - And the output should contain "Cookbook 'non-existent' is not in your Berksfile" + And the output should contain: + """ + Cookbook 'non-existent' is not in your Berksfile + """ And the CLI should exit with the status code for error "CookbookNotFound" + + Scenario: With an invalid cookbook + Given a cookbook named "cookbook with spaces" + And I write to "Berksfile" with: + """ + cookbook 'cookbook with spaces', path: './cookbook with spaces' + """ + When I run `berks package` + Then the output should contain: + """ + The cookbook 'cookbook with spaces' has invalid filenames: + """ + And the CLI should exit with the status code for error "InvalidCookbookFiles"