git_workflow 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README.markdown +77 -0
  2. data/Rakefile +33 -0
  3. data/bin/git-finish +4 -0
  4. data/bin/git-start +4 -0
  5. data/bin/git-workflow-setup +4 -0
  6. data/features/core_functionality/4049578_need_the_ability_to_start_a_new_branch.feature +15 -0
  7. data/features/core_functionality/4049611_need_the_ability_to_finish_a_specified_branch.feature +17 -0
  8. data/features/core_functionality/4056359_start_with_local_branch_already_present.feature +16 -0
  9. data/features/core_functionality/4056363_finish_the_current_branch.feature +17 -0
  10. data/features/core_functionality/4056389_changes_to_pt_story_name_cause_branch_issues.feature +25 -0
  11. data/features/core_functionality/4135658_control_output_verbosity_using_v_switch.feature +32 -0
  12. data/features/core_functionality/4468313_get_config_value_for_is_producing_an_error_log.feature +43 -0
  13. data/features/extensions/4058326_display_story_description_on_start.feature +14 -0
  14. data/features/git_branching/4135501_allow_branch_start_point_to_be_specified_from_command_line.feature +27 -0
  15. data/features/hooks/4069174_investigate_the_effort_required_to_add_pre_amp_post_hooks.feature +24 -0
  16. data/features/hooks/4199841_need_hooks_for_my_workflow.feature +51 -0
  17. data/features/hooks/4199845_need_hooks_for_sanger_workflow.feature +66 -0
  18. data/features/hooks/4205913_output_from_rake_tests_should_be_seen.feature +19 -0
  19. data/features/hooks/4424828_git_start_is_missing_pt_integration_for_my_hooks.feature +15 -0
  20. data/features/pivotal_tracker_api/4133291_chores_go_straight_to_accepted_not_to_finished.feature +15 -0
  21. data/features/release/4132264_fix_the_libxml_warnings_from_nokogiri.feature +20 -0
  22. data/features/step_definitions/aruba_extensions.rb +4 -0
  23. data/features/step_definitions/configuration_steps.rb +38 -0
  24. data/features/step_definitions/git_steps.rb +102 -0
  25. data/features/step_definitions/misc_steps.rb +3 -0
  26. data/features/step_definitions/pivotal_tracker_steps.rb +43 -0
  27. data/features/step_definitions/project_code_steps.rb +35 -0
  28. data/features/support/aruba.rb +1 -0
  29. data/features/support/hooks/configuration.rb +4 -0
  30. data/features/support/hooks/environment.rb +49 -0
  31. data/features/support/hooks/pivotal_tracker.rb +170 -0
  32. data/lib/git_workflow.rb +5 -0
  33. data/lib/git_workflow/callbacks.rb +16 -0
  34. data/lib/git_workflow/callbacks/pivotal_tracker_support.rb +64 -0
  35. data/lib/git_workflow/callbacks/remote_git_branch_support.rb +9 -0
  36. data/lib/git_workflow/callbacks/styles/debug.rb +58 -0
  37. data/lib/git_workflow/callbacks/styles/default.rb +43 -0
  38. data/lib/git_workflow/callbacks/styles/mine.rb +52 -0
  39. data/lib/git_workflow/callbacks/styles/sanger.rb +48 -0
  40. data/lib/git_workflow/callbacks/test_code_support.rb +29 -0
  41. data/lib/git_workflow/command_line.rb +46 -0
  42. data/lib/git_workflow/commands.rb +4 -0
  43. data/lib/git_workflow/commands/base.rb +31 -0
  44. data/lib/git_workflow/commands/finish.rb +36 -0
  45. data/lib/git_workflow/commands/setup.rb +157 -0
  46. data/lib/git_workflow/commands/start.rb +30 -0
  47. data/lib/git_workflow/configuration.rb +93 -0
  48. data/lib/git_workflow/core_ext.rb +106 -0
  49. data/lib/git_workflow/git.rb +143 -0
  50. data/lib/git_workflow/logger.yaml +27 -0
  51. data/lib/git_workflow/logging.rb +77 -0
  52. data/lib/git_workflow/story.rb +96 -0
  53. data/spec/core_functionality/4056539_support_http_proxy_spec.rb +68 -0
  54. data/spec/core_functionality/4058365_bad_request_on_story_update_spec.rb +13 -0
  55. data/spec/core_functionality/4058394_make_commands_more_verbose_spec.rb +41 -0
  56. data/spec/core_functionality/4058719_error_if_none_of_the_required_configuration_values_are_set_spec.rb +21 -0
  57. data/spec/core_functionality/4058861_git_config_returns_empty_strings_which_should_be_nil_spec.rb +59 -0
  58. data/spec/core_functionality/4172431_add_git_workflow_setup_command_to_make_setup_easier_spec.rb +148 -0
  59. data/spec/core_functionality/4199841_need_callbacks_for_my_workflow_spec.rb +97 -0
  60. data/spec/extensions/4199841_need_callbacks_for_my_workflow_spec.rb +167 -0
  61. data/spec/extensions/4205913_output_from_rake_tests_should_be_seen_spec.rb +34 -0
  62. data/spec/git_branching/4058723_branches_end_in_if_the_last_character_is_invalid_spec.rb +40 -0
  63. data/spec/git_branching/4059824_code_is_not_using_workflow_localbranchconvention_to_decode_branch_names_on_finish_spec.rb +115 -0
  64. data/spec/git_branching/4216087_support_pushing_branches_spec.rb +44 -0
  65. data/spec/hooks/4199845_need_hooks_for_sanger_workflow_spec.rb +27 -0
  66. data/spec/pivotal_tracker_api/4056381_pt_api_token_not_being_passed_in_headers_spec.rb +40 -0
  67. data/spec/pivotal_tracker_api/4056638_library_code_using_localhost_spec.rb +16 -0
  68. data/spec/pivotal_tracker_api/4056661_content_type_header_should_be_text_xml_on_updates_spec.rb +16 -0
  69. data/spec/pivotal_tracker_api/4058718_if_pt_username_is_not_set_use_user_name_spec.rb +26 -0
  70. data/spec/pivotal_tracker_api/4146016_decode_the_xml_encoded_text_of_description_and_name_spec.rb +63 -0
  71. data/spec/shared_examples/configuration.rb +10 -0
  72. data/spec/shared_examples/story.rb +17 -0
  73. data/spec/spec_helper.rb +18 -0
  74. metadata +220 -0
data/README.markdown ADDED
@@ -0,0 +1,77 @@
1
+ Git Workflow Tools
2
+ ==================
3
+ These are a set of [git](http://git-scm.org/) extensions to integrate with [Pivotal Tracker](http://www.pivotaltracker.com/).
4
+
5
+ * `git workflow-setup` configures your environment appropriately
6
+ * `git start` starts a new branch with an associated PT story
7
+ * `git finish` finishes the current, or given, branch and associated PT story
8
+
9
+ Usage
10
+ -----
11
+ First you run `git workflow-setup` and follow the instructions.
12
+
13
+ If you want to start a PT story all you need to do is:
14
+
15
+ `git start NNNNNN`
16
+
17
+ Where `NNNNNN` is the PT story number.
18
+
19
+ When you have finished it your can either do:
20
+
21
+ `git finish`
22
+
23
+ If you're on a branch you want to mark as finished, or:
24
+
25
+ `git finish NNNNNN`
26
+
27
+ To finish the story `NNNNNN`.
28
+
29
+ Settings
30
+ --------
31
+ They require certain git configuration settings, either globally or on the project:
32
+
33
+ * `user.name` your name as it appears on PT
34
+ * `pt.username` your name as it appears on PT (only required if `user.name` is not correct)
35
+ * `pt.token` your PT API token (find it on your [PT Profile](https://www.pivotaltracker.com/profile) page)
36
+ * `pt.projectid` the PT ID for your project (the number from the PT URL)
37
+ * `workflow.localbranchconvention` used to generate the name of the local branch
38
+ * `workflow.remotebranchconvention` used to generate the name of the remote branch
39
+ * `workflow.callbacks` the style of interaction you have with git
40
+
41
+ You are *strongly* advised to use `git workflow-setup` to configure these settings.
42
+
43
+ Obviously these settings can be set globally (`user.name`, `pt.username` and `pt.token` are good candidates for this) or at the individual git repository level. It is highly recommended that `pt.projectid` be set on a per-project basis, obviously. Remember that if these are set in the project then they override the global settings, which can be useful if you work with several different PT accounts across several different projects.
44
+
45
+ Callbacks/Hooks
46
+ ---------------
47
+ The behaviour of what happens when you issue `git start` or `git finish` is driven by hooks. At the moment there a couple of forms of hooks included in the code:
48
+
49
+ * `default` creates a branch or merges a branch
50
+ * `debug` built on top of `default`, this simply adds more debugging output
51
+ * `mine` performs the steps I use for this (and other) projects
52
+ * `sanger` performs the steps used by Production Software at [The Wellcome Trust Sanger Institute](http://www.sanger.ac.uk/)
53
+
54
+ The workflow for `sanger` is easy to describe:
55
+
56
+ * `git start` creates a branch from the head of master and marks the PT story started
57
+ * `git finish` runs `rake test features` and the pushes the branch to the remote repository
58
+
59
+ My workflow, used by `mine`, is a little more complex:
60
+
61
+ * `git start` creates a branch from the head of master and marks the PT story started
62
+ * `git finish` runs `rake spec features`, merges the branch into master, runs `rake spec features`, then pushes master to the remote repository
63
+
64
+ Should the `rake` steps fail for either of these workflows then the subsequent steps are not performed, i.e. the branch won't be pushed for `git finish` if `sanger` is being used.
65
+
66
+ Branch conventions
67
+ ------------------
68
+ The idea for `workflow.localbranchconvention` and `workflow.remotebranchconvention` is that you can have your personal preference for naming branches in your local repository, and a common format for the branch names in the remote repository. For instance, I might have story ID followed by title as a local convention, you might have the reverse, and the remote repository might have a completely different convention.
69
+
70
+ The two branch convention settings are freeform text with substitutions. Values that can be substituted are:
71
+
72
+ * `number` is the PT story number for the story
73
+ * `name` is the name of the PT story
74
+
75
+ For instance, "`${number}_${name}`" will generate a branch of the form `12345_some_new_feature`, if this is for story 12345 and that story has the name 'Some new feature'. The final branch will have non-alphanumeric characters replaced by underscore.
76
+
77
+ *WARNING:* I've not properly tested this with other information being placed inside the convention settings, so you're on your own if you try something different! The `git workflow-setup` command will only choose between the two possible combinations.
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup(:build, :test)
4
+
5
+ require 'rake'
6
+
7
+ require 'yard'
8
+
9
+ YARD::Rake::YardocTask.new do |rd|
10
+ rd.files = [ 'README.markdown', 'lib/**/*.rb' ]
11
+ rd.options = [ '-o', 'doc' ]
12
+ end
13
+
14
+ require 'spec/rake/spectask'
15
+
16
+ Spec::Rake::SpecTask.new do |t|
17
+ t.spec_files = FileList[ 'spec/**/*_spec.rb' ]
18
+ end
19
+
20
+ require 'cucumber'
21
+ require 'cucumber/rake/task'
22
+
23
+ Cucumber::Rake::Task.new(:features) do |t|
24
+ options, features = [ '--format pretty' ], 'features'
25
+ options << "--tags '#{ ENV['tags'] }'" unless ENV['tags'].nil? or ENV['tags'].empty?
26
+ unless ENV['FEATURE'].nil? or ENV['FEATURE'].empty?
27
+ features = ENV['FEATURE']
28
+ options << '-r features/step_definitions'
29
+ options << '-r features/support'
30
+ end
31
+
32
+ t.cucumber_opts = "#{ options.join(' ') } '#{ features }'"
33
+ end
data/bin/git-finish ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'git_workflow'
3
+
4
+ GitWorkflow::Commands::Finish.new(ARGV).execute
data/bin/git-start ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'git_workflow'
3
+
4
+ GitWorkflow::Commands::Start.new(ARGV).execute
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'git_workflow'
3
+
4
+ GitWorkflow::Commands::Setup.new(ARGV).execute
@@ -0,0 +1,15 @@
1
+ # rake features FEATURE=features/core_functionality/4049578_need_the_ability_to_start_a_new_branch.feature
2
+ @core_functionality @needs_service
3
+ Feature: Need the ability to start a new branch
4
+
5
+ Scenario: Starting a new branch
6
+ Given my Pivotal Tracker configuration is setup as normal
7
+
8
+ Given the story 4049578 exists
9
+ And the name of story 4049578 is "Need the ability to start a new branch"
10
+
11
+ When I successfully execute "git start 4049578"
12
+
13
+ Then the branch "4049578_need_the_ability_to_start_a_new_branch" should be active
14
+ And the owner of story 4049578 should be "Matthew Denner"
15
+ And story 4049578 should be started
@@ -0,0 +1,17 @@
1
+ # rake features FEATURE=features/core_functionality/4049611_need_the_ability_to_finish_a_specified_branch.feature
2
+ @core_functionality @needs_service
3
+ Feature: Need the ability to finish a specified branch
4
+ Scenario: Finishing an existing branch
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4049611 exists
8
+ And the name of story 4049611 is "Need the ability to start a new branch"
9
+
10
+ Given the local branch "4049611_need_the_ability_to_start_a_new_branch" exists
11
+
12
+ When I successfully execute "git finish 4049611"
13
+
14
+ Then the branch "4049611_need_the_ability_to_start_a_new_branch" should be merged into master
15
+ And the owner of story 4049611 should be "Matthew Denner"
16
+ And story 4049611 should be finished
17
+
@@ -0,0 +1,16 @@
1
+ # rake features FEATURE=features/core_functionality/4056359_start_with_local_branch_already_present.feature
2
+ @core_functionality @needs_service
3
+ Feature: Start with local branch already present
4
+ Scenario: The branch already exists
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4056359 exists
8
+ And the name of story 4056359 is "Start with local branch already present"
9
+
10
+ Given the local branch "4056359_start_with_local_branch_already_present" exists
11
+
12
+ When I successfully execute "git start 4056359"
13
+
14
+ Then the branch "4056359_start_with_local_branch_already_present" should be active
15
+ And the owner of story 4056359 should be "Matthew Denner"
16
+ And story 4056359 should be started
@@ -0,0 +1,17 @@
1
+ # rake features FEATURE=features/core_functionality/4056363_finish_the_current_branch.feature
2
+ @core_functionality @needs_service
3
+ Feature: Finish the current branch
4
+ Scenario: When executed on the branch
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4056363 exists
8
+ And the name of story 4056363 is "Finish the current branch"
9
+
10
+ Given the local branch "4056363_finish_the_current_branch" exists
11
+ And the local branch "4056363_finish_the_current_branch" is active
12
+
13
+ When I successfully execute "git finish"
14
+
15
+ Then the branch "4056363_finish_the_current_branch" should be merged into master
16
+ And the owner of story 4056363 should be "Matthew Denner"
17
+ And story 4056363 should be finished
@@ -0,0 +1,25 @@
1
+ # rake features FEATURE=features/core_functionality/4056389_changes_to_pt_story_name_cause_branch_issues.feature
2
+ @core_functionality @needs_service
3
+ Feature: Changing the name of a story
4
+ Background:
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4056389 exists
8
+ And the name of story 4056389 is "PT story name changes screws with branches"
9
+
10
+ Given the local branch "4056389_changes_to_pt_story_name_cause_branch_issues" exists
11
+
12
+ Scenario: Name changed after the story has started
13
+ When I successfully execute "git finish 4056389"
14
+
15
+ Then the branch "4056389_changes_to_pt_story_name_cause_branch_issues" should be merged into master
16
+ And the owner of story 4056389 should be "Matthew Denner"
17
+ And story 4056389 should be finished
18
+
19
+ Scenario: Name changed and trying to start it
20
+ When I successfully execute "git start 4056389"
21
+
22
+ Then the branch "4056389_changes_to_pt_story_name_cause_branch_issues" should be active
23
+ And the owner of story 4056389 should be "Matthew Denner"
24
+ And story 4056389 should be started
25
+
@@ -0,0 +1,32 @@
1
+ # rake features FEATURE=features/core_functionality/4135658_control_output_verbosity_using_v_switch.feature
2
+ @core_functionality @needs_service @command_line
3
+ Feature: Command line option parsing
4
+ Background:
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4135658 exists
8
+ And the name of story 4135658 is "Need the ability to start a new branch"
9
+
10
+ Given the local branch "4135658_control_output_verbosity_using_v_switch" exists
11
+
12
+ Scenario Outline: Usage displayed for --help
13
+ When I execute "git <command> --help"
14
+ Then the output should contain "Usage: git <command>"
15
+
16
+ Examples:
17
+ |command|
18
+ | start |
19
+ |finish |
20
+
21
+ Scenario Outline: Verbose output for --verbose
22
+ When I execute "git <command> 4135658"
23
+ Then the output should not contain "DEBUG"
24
+
25
+ When I execute "git <command> --verbose 4135658"
26
+ Then the output should contain "DEBUG"
27
+
28
+ Examples:
29
+ |command|
30
+ | start |
31
+ |finish |
32
+
@@ -0,0 +1,43 @@
1
+ # rake features FEATURE=features/core_functionality/4468313_get_config_value_for_is_producing_an_error_log.feature
2
+ @core_functionality @needs_service
3
+ Feature: Separate the various logging information
4
+ Background:
5
+ # Note that this background does not set pt.username and uses user.name instead.
6
+ # Notice that this means that this will be reported with verbosity enable, but not
7
+ # without it.
8
+ Given my git username is "Matthew Denner"
9
+ And my Pivotal Tracker project ID is 93630
10
+ And my Pivotal Tracker token is 1234567890
11
+ And my local branch naming convention is "${number}_${name}"
12
+ And my remote branch naming convention is "${number}_${name}"
13
+
14
+ Given the story 4468313 exists
15
+ And the name of story 4468313 is "'get_config_value_for' is producing an error log"
16
+
17
+ Scenario: Starting a branch
18
+ When I successfully execute "git start 4468313"
19
+
20
+ Then the output should not contain "pt.username"
21
+ And the output should not contain "DEBUG"
22
+
23
+ Scenario: Finishing a branch
24
+ Given the local branch "4468313_get_config_value_for_is_producing_an_error_log" exists
25
+
26
+ When I successfully execute "git finish 4468313"
27
+
28
+ Then the output should not contain "pt.username"
29
+ And the output should not contain "DEBUG"
30
+
31
+ Scenario: Starting a branch with verbosity
32
+ When I successfully execute "git start --verbose 4468313"
33
+
34
+ Then the stderr should contain "pt.username"
35
+ And the stdout should not contain "pt.username"
36
+
37
+ Scenario: Finishing a branch with verbosity
38
+ Given the local branch "4468313_get_config_value_for_is_producing_an_error_log" exists
39
+
40
+ When I successfully execute "git finish --verbose 4468313"
41
+
42
+ Then the stderr should contain "pt.username"
43
+ And the stdout should not contain "pt.username"
@@ -0,0 +1,14 @@
1
+ # rake features FEATURE=features/extensions/4058326_display_story_description_on_start.feature
2
+ @extension @needs_service
3
+ Feature: Display the story description on start
4
+ Scenario: Displaying the description
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4058326 exists
8
+ And the name of story 4058326 is "Display the story description"
9
+ And the description of story 4058326 is "Please can we display the description of a story?"
10
+
11
+ When I successfully execute "git start 4058326"
12
+
13
+ Then the stdout should contain "Story 4058326: Display the story description"
14
+ And the stdout should contain "Please can we display the description of a story?"
@@ -0,0 +1,27 @@
1
+ # rake features FEATURE=features/git_branching/4135501_allow_branch_start_point_to_be_specified_from_command_line.feature
2
+ @git_branching @needs_service
3
+ Feature: Branching from a branch
4
+ Background:
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4135501 exists
8
+ And the name of story 4135501 is "Allow branch start point to be specified from command line"
9
+
10
+ Given the local branch "parent_branch" exists
11
+ And the local branch "parent_branch" is active
12
+ And an empty file named "I am empty"
13
+ And I commit "I am empty"
14
+
15
+ Scenario: When the user is on master and specifies the branch
16
+ And the local branch "master" is active
17
+
18
+ When I successfully execute "git start 4135501 parent_branch"
19
+
20
+ Then the branch "4135501_allow_branch_start_point_to_be_specified_from_command_line" should be active
21
+ And the parent of branch "4135501_allow_branch_start_point_to_be_specified_from_command_line" should be "parent_branch"
22
+
23
+ Scenario: When the user is on the parent branch and doesn't specify one
24
+ When I successfully execute "git start 4135501"
25
+
26
+ Then the branch "4135501_allow_branch_start_point_to_be_specified_from_command_line" should be active
27
+ And the parent of branch "4135501_allow_branch_start_point_to_be_specified_from_command_line" should be "parent_branch"
@@ -0,0 +1,24 @@
1
+ # rake features FEATURE=features/hooks/4069174_investigate_the_effort_required_to_add_pre_amp_post_hooks.feature
2
+ @hooks @needs_service
3
+ Feature: Adding pre-and-post hooks
4
+ Background:
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+
7
+ Given the story 4069174 exists
8
+ And the name of story 4069174 is "Investigate the effort required to add pre & post hooks"
9
+
10
+ Given I have "debug" callbacks enabled
11
+
12
+ Scenario: Hooked into start
13
+ When I successfully execute "git start 4069174"
14
+
15
+ Then the stdout should contain "start"
16
+ And the stderr should contain "start_story_on_pivotal_tracker!"
17
+
18
+ Scenario: Hooked into finish
19
+ Given the local branch "4069174_investigate_the_effort_required_to_add_pre_amp_post_hooks" exists
20
+
21
+ When I successfully execute "git finish 4069174"
22
+
23
+ Then the stdout should contain "finish"
24
+ And the stderr should contain "finish_story_on_pivotal_tracker!"
@@ -0,0 +1,51 @@
1
+ # rake features FEATURE=features/hooks/4199841_need_hooks_for_my_workflow.feature
2
+ @hooks @needs_service @needs_remote_repository @my_workflow
3
+ Feature: Need hooks for my workflow
4
+ Background:
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+ And I have "mine" callbacks enabled
7
+
8
+ Given the story 4199841 exists
9
+ And the name of story 4199841 is "Need hooks for my workflow"
10
+
11
+ Given the local branch "4199841_need_hooks_for_my_workflow" exists
12
+
13
+ Scenario: Fails to merge when tests fail before merge
14
+ Given the local branch "4199841_need_hooks_for_my_workflow" is active
15
+ And the rake task "spec" will fail
16
+ And the rake task "features" will fail
17
+
18
+ When I execute "git finish"
19
+
20
+ Then the stderr should contain "The tests failed, please fix and try again"
21
+ And the branch "4199841_need_hooks_for_my_workflow" should be active
22
+ And the branch "4199841_need_hooks_for_my_workflow" should not be merged into master
23
+
24
+ Scenario: Leaves the branch being merged as active
25
+ Given the local branch "4199841_need_hooks_for_my_workflow" is active
26
+ And the rake task "spec" will fail
27
+ And the rake task "features" will fail
28
+ And the local branch "master" is active
29
+
30
+ When I execute "git finish 4199841"
31
+
32
+ Then the stderr should contain "The tests failed, please fix and try again"
33
+ And the branch "4199841_need_hooks_for_my_workflow" should be active
34
+ And the branch "4199841_need_hooks_for_my_workflow" should not be merged into master
35
+
36
+
37
+ # @wip
38
+ # Scenario: Drops into shell if tests fail after merge
39
+
40
+ Scenario: Completely successful pushes master to the remote repository
41
+ Given the local branch "4199841_need_hooks_for_my_workflow" is active
42
+ And the rake task "spec" will succeed
43
+ And the rake task "features" will succeed
44
+
45
+ When I execute "git finish"
46
+
47
+ Then the stderr should not contain "The tests failed, please fix and try again"
48
+ And the stderr should not contain "Unable to push branch 'master'"
49
+ And the branch "4199841_need_hooks_for_my_workflow" should be merged into master
50
+ And story 4199841 should be finished
51
+ And the local and remote "master" branches should agree
@@ -0,0 +1,66 @@
1
+ # rake features FEATURE=features/hooks/4199845_need_hooks_for_sanger_workflow.feature
2
+ @hooks @needs_service @needs_remote_repository @sanger_workflow
3
+ Feature: Need hooks for WTSI workflow
4
+ Background:
5
+ Given my Pivotal Tracker configuration is setup as normal
6
+ And I have "sanger" callbacks enabled
7
+
8
+ Given the story 4199845 exists
9
+ And the name of story 4199845 is "Need hooks for WTSI workflow"
10
+
11
+ Given the local branch "4199845_need_hooks_for_wtsi_workflow" exists
12
+
13
+ Scenario: Fails to push local branch if tests fail
14
+ Given the local branch "4199845_need_hooks_for_wtsi_workflow" is active
15
+ And the rake task "test" will fail
16
+ And the rake task "features" will fail
17
+
18
+ When I execute "git finish"
19
+
20
+ Then the stderr should contain "The tests failed, please fix and try again"
21
+ And the branch "4199845_need_hooks_for_wtsi_workflow" should be active
22
+ And the branch "4199845_need_hooks_for_wtsi_workflow" should not be merged into master
23
+
24
+ Scenario: Leaves the branch being merged as active
25
+ Given the local branch "4199845_need_hooks_for_wtsi_workflow" is active
26
+ And the rake task "test" will fail
27
+ And the rake task "features" will fail
28
+ And the local branch "master" is active
29
+
30
+ When I execute "git finish 4199845"
31
+
32
+ Then the stderr should contain "The tests failed, please fix and try again"
33
+ And the branch "4199845_need_hooks_for_wtsi_workflow" should be active
34
+ And the branch "4199845_need_hooks_for_wtsi_workflow" should not be merged into master
35
+
36
+ Scenario: Completely successful pushes branch to remote repository
37
+ Given my remote branch naming convention is "${number}_${name}"
38
+
39
+ Given the local branch "4199845_need_hooks_for_wtsi_workflow" is active
40
+ And the rake task "test" will succeed
41
+ And the rake task "features" will succeed
42
+
43
+ When I successfully execute "git finish"
44
+
45
+ Then the stderr should not contain "The tests failed, please fix and try again"
46
+ And the stderr should not contain "Unable to push branch '4199845_need_hooks_for_wtsi_workflow'"
47
+ And the branch "4199845_need_hooks_for_wtsi_workflow" should not be merged into master
48
+ And the local and remote "4199845_need_hooks_for_wtsi_workflow" branches should agree
49
+
50
+ Then story 4199845 should be finished
51
+ And story 4199845 should have a comment of "Fixed on 4199845_need_hooks_for_wtsi_workflow. Needs merging into master"
52
+
53
+ Scenario: Pushes remote name properly
54
+ Given my remote branch naming convention is "${name}_${number}"
55
+
56
+ Given the local branch "4199845_need_hooks_for_wtsi_workflow" is active
57
+ And the rake task "test" will succeed
58
+ And the rake task "features" will succeed
59
+
60
+ When I successfully execute "git finish"
61
+
62
+ Then the stderr should not contain "The tests failed, please fix and try again"
63
+ And the stderr should not contain "Unable to push branch '4199845_need_hooks_for_wtsi_workflow'"
64
+ And the branch "4199845_need_hooks_for_wtsi_workflow" should not be merged into master
65
+ And story 4199845 should be finished
66
+ And the local branch "4199845_need_hooks_for_wtsi_workflow" and remote branch "need_hooks_for_wtsi_workflow_4199845" should agree