pivotal-brancher 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/pivotal-brancher/cli.rb +7 -0
  2. data/spec/start.rb +39 -20
  3. metadata +8 -8
@@ -25,8 +25,15 @@ module PivotalBrancher
25
25
  method_options %w{pretend -p} => :boolean #ok
26
26
  def start
27
27
  stories = app.started_stories
28
+ if stories.empty?
29
+ say "No started stories found - could be you haven't started any stories yet?"
30
+ exit
31
+ end
28
32
  story = stories.shift
29
33
 
34
+ #Need to handle empty case ( you should probably start a story...)
35
+ #
36
+
30
37
  say "Switching to branch for:"
31
38
  say "#{story.id}: #{story.name}"
32
39
  say ""
data/spec/start.rb CHANGED
@@ -15,32 +15,51 @@ describe PivotalBrancher::Cli do
15
15
  end
16
16
  end
17
17
 
18
- let :brancher_app do
19
- PivotalBrancher::App.new.tap do |app|
20
- app.stub(:started_stories).and_return(stories)
18
+ describe "with started stories" do
19
+ let :brancher_app do
20
+ PivotalBrancher::App.new.tap do |app|
21
+ app.stub(:started_stories).and_return(stories)
22
+ end
21
23
  end
22
- end
23
24
 
24
- let :stories do
25
- [
26
- OpenStruct.new(:id => "123456", :name => "This: is a story")
27
- ]
28
- end
25
+ let :stories do
26
+ [
27
+ OpenStruct.new(:id => "123456", :name => "This: is a story")
28
+ ]
29
+ end
29
30
 
30
- it "should report on stories considered" do
31
- expect(capture_stdout do
32
- cli.start
33
- end).to match(/is a story/)
34
- end
31
+ it "should report on stories considered" do
32
+ expect(capture_stdout do
33
+ cli.start
34
+ end).to match(/is a story/)
35
+ end
35
36
 
36
- it "should build branch names" do
37
- expect(cli.story_branch_name(stories.first)).to eql("123456_this_is_a_story")
37
+ it "should build branch names" do
38
+ expect(cli.story_branch_name(stories.first)).to eql("123456_this_is_a_story")
39
+ end
40
+
41
+ it "should execute git checkout -b" do
42
+ cli.should_receive(:run).with("git checkout -b 123456_this_is_a_story")
43
+ capture_stdout do
44
+ cli.start
45
+ end
46
+ end
38
47
  end
39
48
 
40
- it "should execute git checkout -b" do
41
- cli.should_receive(:run).with("git checkout -b 123456_this_is_a_story")
42
- capture_stdout do
43
- cli.start
49
+ describe "with no started stories" do
50
+ let :brancher_app do
51
+ PivotalBrancher::App.new.tap do |app|
52
+ app.stub(:started_stories).and_return([])
53
+ end
54
+ end
55
+
56
+ it "should not execute git" do
57
+ cli.should_not_receive(:run)
58
+ capture_stdout do
59
+ expect do
60
+ cli.start
61
+ end.to raise_error(SystemExit)
62
+ end
44
63
  end
45
64
  end
46
65
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: pivotal-brancher
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Judson Lester
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-23 00:00:00.000000000 Z
12
+ date: 2013-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -44,18 +44,18 @@ dependencies:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
46
  segments:
47
+ - 1
47
48
  - 0
48
- - 9
49
- version: '0.9'
49
+ version: '1.0'
50
50
  none: false
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  segments:
56
+ - 1
56
57
  - 0
57
- - 9
58
- version: '0.9'
58
+ version: '1.0'
59
59
  none: false
60
60
  - !ruby/object:Gem::Dependency
61
61
  prerelease: false
@@ -105,7 +105,7 @@ rdoc_options:
105
105
  - --main
106
106
  - doc/README
107
107
  - --title
108
- - pivotal-brancher-0.0.2 Documentation
108
+ - pivotal-brancher-0.0.3 Documentation
109
109
  require_paths:
110
110
  - lib/
111
111
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  - !ruby/object:Gem::Version
115
115
  segments:
116
116
  - 0
117
- hash: -369662783
117
+ hash: 795572577
118
118
  version: '0'
119
119
  none: false
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement