Skip to content

Commit

Permalink
add basic acceptance tests: show and init
Browse files Browse the repository at this point in the history
  • Loading branch information
e2 committed Oct 29, 2014
1 parent c93b5ba commit 41d540d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
15 changes: 15 additions & 0 deletions features/init.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Guard "init" command

In order to quickly start a new project with Guard
As a user
I want Guard to create a Guardfile template for me

Scenario: Create an empty Guardfile
When I run `guard init -b`
Then the output should match /Writing new Guardfile to .*Guardfile$/
And the file "Guardfile" should contain "# A sample Guardfile"

Scenario: Create a Guardfile using a plugin's template
When I run `guard init ronn`
Then the output should match /Writing new Guardfile to .*Guardfile$/
And the file "Guardfile" should match /^guard :ronn do$/
26 changes: 26 additions & 0 deletions features/show.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Feature: Show

In order to know the defined groups and plugins
As a developer using Guard
I want to see a table of groups and plugins

Scenario: Show error when no Guardfile
When I run `guard show`
Then the output should match /No Guardfile found, please create one with `guard init`\./
And the exit status should not be 0

Scenario: Show error when Guardfile has no plugins
Given an empty file named "Guardfile"
When I run `guard show`
Then the output should match /No Guard plugins found in Guardfile, please add at least one\.$/
# TODO: this step fails
# And the exit status should not be 0

Scenario: Show plugins and their configuration
Given a file named "Guardfile" with:
"""
guard :ronn do
end
"""
When I run `guard show`
Then the output should match /^| Default | Ronn\s+ |/

2 comments on commit 41d540d

@rymai
Copy link
Member

@rymai rymai commented on 41d540d Oct 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's really cool!

@e2
Copy link
Contributor Author

@e2 e2 commented on 41d540d Oct 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, it would use custom steps, such as "Given a Guardfile with:" and "It should fail with "no plugins found" error" (which would map to the right expected message).

But... I've got my hands full with scopes and cleanup :(

Please sign in to comment.