Permalink
Browse files

Ready and QA cucumber features

  • Loading branch information...
1 parent b1f0a26 commit 121f6eb60d33060150c1ab6b01dfa48287bf1c10 @winton committed Feb 21, 2012
Showing with 106 additions and 73 deletions.
  1. +0 −65 features/gitcycle.feature
  2. +71 −0 features/qa.feature
  3. +27 −0 features/review.feature
  4. +6 −6 features/steps/gitcycle_steps.rb
  5. +2 −2 lib/gitcycle.rb
View
@@ -1,65 +0,0 @@
-# Feature: gitcycle
-
-# Scenario: Reviewed issue w/ no parameters
-# When I cd to the user repo
-# And I checkout ticket.id
-# And I execute gitcycle with "review pass"
-# Then gitcycle runs
-# And output includes "Labeling issue as 'Pending QA'."
-
-# Scenario: Reviewed issue w/ parameters
-# When I cd to the user repo
-# And I execute gitcycle with "review pass issue.id"
-# Then gitcycle runs
-# And output includes "Labeling issues as 'Pending QA'."
-
-# Scenario: QA issue
-# When I cd to the owner repo
-# And I checkout master
-# And I execute gitcycle with "qa issue.id"
-# And I enter "y"
-# Then gitcycle runs
-# And output includes
-# """
-# Do you want to create a QA branch from 'master'? (y/n)
-# Retrieving branch information from gitcycle.
-# Deleting old QA branch 'qa_master_config.user'.
-# Adding remote repo 'config.owner/config.repo'.
-# Fetching remote 'config.owner'.
-# Checking out remote branch 'qa_master_config.user' from 'config.owner/config.repo/master'.
-# Fetching remote 'origin'.
-# Pushing 'origin/qa_master_config.user'.
-# Adding remote repo 'config.user/config.repo'.
-# Fetching remote 'config.user'.
-# Merging remote branch 'ticket.id' from 'config.user/config.repo'.
-# Pushing branch 'qa_master_config.user'.
-# Type 'gitc qa pass' to approve all issues in this branch.
-# Type 'gitc qa fail' to reject all issues in this branch.
-# """
-
-# Scenario: QA issue pass
-# When I cd to the owner repo
-# And I checkout qa_master_config.user
-# And I execute gitcycle with "qa pass"
-# Then gitcycle runs
-# And output includes
-# """
-# Retrieving branch information from gitcycle.
-# Checking out branch 'master'.
-# Adding remote repo 'config.user/config.repo'.
-# Fetching remote 'config.user'.
-# Merging remote branch 'ticket.id' from 'config.user/config.repo'.
-# Pushing branch 'master'.
-# Labeling all issues as 'Pass'.
-# """
-
-# Scenario: QA issue list
-# When I cd to the owner repo
-# And I checkout master
-# And I execute gitcycle with "qa"
-# Then gitcycle runs
-# And output includes
-# """
-# qa_master_config.user
-# issue #issue.id\tconfig.user/ticket.id
-# """
View
@@ -0,0 +1,71 @@
+Feature: QA
+
+Scenario: QA issue
+ Given a fresh set of repositories
+ When I cd to the user repo
+ And I execute gitcycle branch with a new URL or string
+ And I give default input
+ And gitcycle runs
+ And I commit something
+ And I execute gitcycle with "ready"
+ And gitcycle runs
+ And I cd to the owner repo
+ And I checkout master
+ And I execute gitcycle with "qa issue.id"
+ And I enter "y"
+ And gitcycle runs
+ Then output includes
+ """
+ Do you want to create a QA branch from 'master'? (y/n)
+ Retrieving branch information from gitcycle.
+ Adding remote repo 'config.owner/config.repo'.
+ Fetching remote 'config.owner'.
+ Checking out remote branch 'qa_master_config.user' from 'config.owner/config.repo/master'.
+ Fetching remote 'origin'.
+ Pushing 'origin/qa_master_config.user'.
+ Adding remote repo 'config.user/config.repo'.
+ Fetching remote 'config.user'.
+ Merging remote branch 'ticket.id' from 'config.user/config.repo'.
+ Pushing branch 'qa_master_config.user'.
+ Type 'gitc qa pass' to approve all issues in this branch.
+ Type 'gitc qa fail' to reject all issues in this branch.
+ """
+
+Scenario: QA issue pass
+ Given a fresh set of repositories
+ When I cd to the user repo
+ And I execute gitcycle branch with a new URL or string
+ And I give default input
+ And gitcycle runs
+ And I commit something
+ And I execute gitcycle with "ready"
+ And gitcycle runs
+ And I cd to the owner repo
+ And I checkout master
+ And I execute gitcycle with "qa issue.id"
+ And I enter "y"
+ And gitcycle runs
+ And I checkout qa_master_config.user
+ And I execute gitcycle with "qa pass"
+ Then gitcycle runs
+ And output includes
+ """
+ Retrieving branch information from gitcycle.
+ Checking out branch 'master'.
+ Adding remote repo 'config.user/config.repo'.
+ Fetching remote 'config.user'.
+ Merging remote branch 'ticket.id' from 'config.user/config.repo'.
+ Pushing branch 'master'.
+ Labeling all issues as 'Pass'.
+ """
+
+Scenario: QA issue list
+ When I cd to the owner repo
+ And I checkout master
+ And I execute gitcycle with "qa"
+ Then gitcycle runs
+ And output includes
+ """
+ qa_master_config.user
+ issue #issue.id\tconfig.user/last_ticket.id
+ """
View
@@ -0,0 +1,27 @@
+Feature: Review
+
+Scenario: No parameters
+ Given a fresh set of repositories
+ When I cd to the user repo
+ And I execute gitcycle branch with a new URL or string
+ And I give default input
+ And gitcycle runs
+ And I commit something
+ And I execute gitcycle with "ready"
+ And gitcycle runs
+ And I execute gitcycle with "review pass"
+ And gitcycle runs
+ Then output includes "Labeling issue as 'Pending QA'."
+
+Scenario: Parameters
+ Given a fresh set of repositories
+ When I cd to the user repo
+ And I execute gitcycle branch with a new URL or string
+ And I give default input
+ And gitcycle runs
+ And I commit something
+ And I execute gitcycle with "ready"
+ And gitcycle runs
+ And I execute gitcycle with "review pass issue.id"
+ And gitcycle runs
+ Then output includes "Labeling issues as 'Pending QA'."
@@ -17,6 +17,7 @@
$redis = Redis.new
Before do |scenario|
+ Launchy.stub(:open) { |url| $github_url = url }
@scenario_title = scenario.title
$execute = []
$input = []
@@ -50,8 +51,8 @@ def gsub_variables(str)
if $tickets
str = str.gsub('last_ticket.id', $tickets.last.attributes['id'])
end
- if $url
- issue_id = $url.match(/https:\/\/github.com\/.+\/issues\/(\d+)/)[1]
+ if $github_url
+ issue_id = $github_url.match(/https:\/\/github.com\/.+\/issues\/(\d+)/)[1]
str = str.gsub('issue.id', issue_id)
end
str = str.gsub('env.home', ENV['REPO'] == 'owner' ? config['owner'] : config['user'])
@@ -258,8 +259,7 @@ def type(text)
Then /^output includes \"([^\"]*)" with URL$/ do |expected|
expected = gsub_variables(expected)
- @output.include?(expected).should == true
- $url = @output.match(/#{expected}.*(https?:\/\/[^\s]+)/)[1]
+ @output.should =~ /#{expected}.*(https?:\/\/[^\s]+)/
end
Then /^output includes$/ do |expected|
@@ -297,7 +297,7 @@ def type(text)
'source' => 'master'
}
if @scenario_title == 'Discuss commits w/ no parameters and something committed'
- should['issue_url'] = $url
+ should['issue_url'] = $github_url
end
branch.should == should
end
@@ -311,5 +311,5 @@ def type(text)
end
Then /^URL is a valid issue$/ do
- $url.should =~ /https:\/\/github.com\/.+\/issues\/\d+/
+ $github_url.should =~ /https:\/\/github.com\/.+\/issues\/\d+/
end
View
@@ -25,6 +25,8 @@ class Gitcycle
end
def initialize(args=nil)
+ $remotes = {}
+
if ENV['CONFIG']
@config_path = File.expand_path(ENV['CONFIG'])
else
@@ -478,8 +480,6 @@ def add_remote_and_fetch(options={})
owner = options[:owner]
repo = options[:repo]
- $remotes ||= {}
-
unless $remotes[owner]
$remotes[owner] = true

0 comments on commit 121f6eb

Please sign in to comment.