Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[CHORE] Introduce Cucumber

* Set up cucumber tests using Aruba
* Added a `gd -v` command to test the version of the executable
* Wrote tests for `gd feature`
* Wrote tests for `gd sync` when it works.
* Bumped gem version
  • Loading branch information...
commit 830f86aeb0d2f166212b82aceeda9e6f068bdc34 1 parent 03711ef
@peakpg peakpg authored
View
1  .gitignore
@@ -3,3 +3,4 @@
Gemfile.lock
pkg/*
.idea/*
+tmp/*
View
5 Gemfile
@@ -2,3 +2,8 @@ source "http://rubygems.org"
# Specify your gem's dependencies in git_er_done.gemspec
gemspec
+
+group :test do
+ gem 'cucumber'
+ gem 'aruba'
+end
View
29 features/cli.feature
@@ -0,0 +1,29 @@
+Feature: CLI
+
+ In order to make doing the right thing easier in Git
+ As a programmer with a bad memory
+ I should be able to use a commandline tool to simplify my interface.
+
+ Scenario: Show the Version of the Gem
+ When I run `gd version`
+ Then the output should contain "Git-Er-Done"
+ And should display the current version
+
+
+ Scenario: Show version using -v
+ When I run `gd -v`
+ Then the output should contain "Git-Er-Done"
+ And should display the current version
+
+ Scenario: Start a New Feature
+ Given I am working on a git project
+ When I run `gd feature new_widget`
+ Then the output should contain "Switched to a new branch 'features/new_widget'"
+
+ Scenario: Sync a Branch
+ Given I am working on a git project
+ And I am working on the "features/new_widget" branch
+ When I run `gd sync`
+ Then the output should contain "Switched to branch 'master'"
+ And the output should contain "Switched to branch 'features/new_widget"
+ And the output should contain "Current branch features/new_widget is up to date"
View
15 features/step_definitions/cli_steps.rb
@@ -0,0 +1,15 @@
+Given /^I am working on a git project$/ do
+ steps %Q{
+ Given I run `git init .`
+ And an empty file named "README"
+ And I run `git add README`
+ And I run `git commit -m 'First commit'`
+ }
+end
+
+Given /^I am working on the "(.*)" branch$/ do |branch|
+ steps "Given I run `git checkout -b #{branch}`"
+end
+When /^should display the current version$/ do
+ assert_partial_output(Git::Er::Done::VERSION, all_output)
+end
View
5 features/support.rb/env.rb
@@ -0,0 +1,5 @@
+require 'aruba/cucumber'
+
+# For loading the library in tests.
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../../lib'))
+require 'git_er_done'
View
7 lib/git_er_done/app.rb
@@ -48,7 +48,12 @@ def sync
git :checkout => return_to_branch
git :rebase => :master
end
-
+
+ desc 'version', 'Show the Git-Er-Done version and quit. (gd -v works too)'
+ map "-v" => :version
+ def version
+ puts "Git-Er-Done #{Git::Er::Done::VERSION}"
+ end
private
# Returns the name of the feature for the current branch
View
2  lib/git_er_done/version.rb
@@ -1,7 +1,7 @@
module Git
module Er
module Done
- VERSION = "0.1.0"
+ VERSION = "0.2.0"
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.