Permalink
Browse files

more syntax cleanup of tests (unfinished)

  • Loading branch information...
1 parent 7a951f2 commit f99f2f1c5ba13f63f37b472244f4343b29b1fd6f @mroth committed Aug 14, 2012
Showing with 42 additions and 43 deletions.
  1. +36 −43 features/lolcommits.feature
  2. +6 −0 features/step_definitions/lolcommits_steps.rb
@@ -10,45 +10,42 @@ Feature: Basic UI functionality
When I cd to "loltest"
And I successfully run `lolcommits --enable`
Then the output should contain "installed lolcommmit hook as:"
- And the output should contain "(to remove later, you can use: lolcommits --disable)"
- And a file named ".git/hooks/post-commit" should exist
- And the exit status should be 0
+ And the output should contain "(to remove later, you can use: lolcommits --disable)"
+ And a file named ".git/hooks/post-commit" should exist
+ And the exit status should be 0
Scenario: Disable in a enabled git repository
Given I am in a git repository named "lolenabled" with lolcommits enabled
- And I successfully run `lolcommits --disable`
+ When I successfully run `lolcommits --disable`
Then the output should contain "removed"
- And a file named ".git/hooks/post-commit" should not exist
- And the exit status should be 0
+ And a file named ".git/hooks/post-commit" should not exist
+ And the exit status should be 0
Scenario: Trying to enable while not in a git repo fails
- Given a directory named "svnrulez"
- When I cd to "svnrulez"
- And I run `lolcommits --enable`
+ Given I am in a directory named "svnrulez"
+ When I run `lolcommits --enable`
Then the output should contain "You don't appear to be in the base directory of a git project."
- And the exit status should be 1
+ And the exit status should be 1
Scenario: Commiting in an enabled repo triggers successful capture
Given I am in a git repository named "testcapture" with lolcommits enabled
- And I successfully run `git commit --allow-empty -m 'can haz commit'`
+ When I successfully run `git commit --allow-empty -m 'can haz commit'`
Then the output should contain "*** Preserving this moment in history."
- And a directory named "../.lolcommits/testcapture" should exist
- And a file named "../.lolcommits/testcapture/tmp_snapshot.jpg" should not exist
- And there should be exactly 1 jpg in "../.lolcommits/testcapture"
+ And a directory named "../.lolcommits/testcapture" should exist
+ And a file named "../.lolcommits/testcapture/tmp_snapshot.jpg" should not exist
+ And there should be exactly 1 jpg in "../.lolcommits/testcapture"
Scenario: Commiting in an enabled repo subdirectory triggers successful capture of parent repo
- Given a git repository named "testcapture"
- And a directory named "testcapture/subdir"
- And an empty file named "testcapture/subdir/FOOBAR"
- When I cd to "testcapture/"
- And I successfully run `lolcommits --enable`
- Then I cd to "subdir/"
- And I successfully run `git add .`
- And I successfully run `git commit -m 'can haz commit'`
+ Given I am in a git repository named "testcapture" with lolcommits enabled
+ And a directory named "subdir"
+ And an empty file named "subdir/FOOBAR"
+ When I cd to "subdir/"
+ And I successfully run `git add .`
+ And I successfully run `git commit -m 'can haz commit'`
Then the output should contain "*** Preserving this moment in history."
- And a directory named "../../.lolcommits/testcapture" should exist
- And a file named "../../.lolcommits/testcapture/tmp_snapshot.jpg" should not exist
- And there should be exactly 1 jpg in "../../.lolcommits/testcapture"
+ And a directory named "../../.lolcommits/testcapture" should exist
+ And a directory named "../../.lolcommits/subdir" should not exist
+ And there should be exactly 1 jpg in "../../.lolcommits/testcapture"
Scenario: Show plugins
When I successfully run `lolcommits --plugins`
@@ -98,33 +95,30 @@ Feature: Basic UI functionality
And the output should contain "enabled: true"
Scenario: test capture should work regardless of whether in a git repository
- Given a directory named "nothingtoseehere"
- When I cd to "nothingtoseehere"
- And I run `lolcommits --test --capture`
+ Given I am in a directory named "nothingtoseehere"
+ When I run `lolcommits --test --capture`
Then the output should contain "*** Capturing in test mode."
- And the output should not contain "path does not exist (ArgumentError)"
- And the exit status should be 0
+ And the output should not contain "path does not exist (ArgumentError)"
+ And the exit status should be 0
Scenario: test capture should store in its own test directory
- Given a git repository named "randomgitrepo"
- When I cd to "randomgitrepo"
- And I successfully run `lolcommits --test --capture`
+ Given I am in a git repository named "randomgitrepo" with lolcommits enabled
+ When I successfully run `lolcommits --test --capture`
Then a directory named "../.lolcommits/test" should exist
And a directory named "../.lolcommits/randomgitrepo" should not exist
Scenario: last command should work properly when in a lolrepo
Given a git repository named "randomgitrepo"
- And a loldir named "randomgitrepo" with 2 lolimages
- And I cd to "randomgitrepo"
+ And a loldir named "randomgitrepo" with 2 lolimages
+ And I cd to "randomgitrepo"
When I run `lolcommits --last`
Then the exit status should be 0
Scenario: last command should fail gracefully if not in a lolrepo
- Given a directory named "gitsuxcvs4eva"
- And I cd to "gitsuxcvs4eva"
+ Given I am in a directory named "gitsuxcvs4eva"
When I run `lolcommits --last`
Then the output should contain "Can't do that since we're not in a valid git repository!"
- Then the exit status should be 1
+ And the exit status should be 1
Scenario: last command should fail gracefully if zero lolimages in lolrepo
Given a git repository named "randomgitrepo"
@@ -136,15 +130,14 @@ Feature: Basic UI functionality
Scenario: browse command should work properly when in a lolrepo
Given a git repository named "randomgitrepo"
- And a loldir named "randomgitrepo" with 2 lolimages
- And I cd to "randomgitrepo"
+ And a loldir named "randomgitrepo" with 2 lolimages
+ And I cd to "randomgitrepo"
When I run `lolcommits --browse`
Then the exit status should be 0
Scenario: browse command should fail gracefully when not in a lolrepo
- Given a directory named "gitsuxcvs4eva"
- And I cd to "gitsuxcvs4eva"
+ Given I am in a directory named "gitsuxcvs4eva"
When I run `lolcommits --browse`
Then the output should contain "Can't do that since we're not in a valid git repository!"
- Then the exit status should be 1
+ And the exit status should be 1
@@ -1,5 +1,11 @@
include FileUtils
+Given /^I am in a directory named "(.*?)"$/ do |dir_name|
+ steps %Q{
+ Given a directory named "#{dir_name}"
+ And I cd to "#{dir_name}"
+ }
+end
Given /^a git repository named "(.*?)"$/ do |repo_name|
repo_dir = File.join current_dir, repo_name

0 comments on commit f99f2f1

Please sign in to comment.