githug 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -0
  3. data/README.md +15 -18
  4. data/levels/fetch.rb +2 -2
  5. data/levels/push.rb +1 -1
  6. data/levels/push_branch.rb +1 -1
  7. data/levels/rebase.rb +16 -0
  8. data/levels/rebase/.githug/COMMIT_EDITMSG +1 -0
  9. data/levels/rebase/.githug/HEAD +1 -0
  10. data/levels/rebase/.githug/ORIG_HEAD +1 -0
  11. data/levels/rebase/.githug/config +7 -0
  12. data/levels/rebase/.githug/index +0 -0
  13. data/levels/rebase/.githug/logs/HEAD +13 -0
  14. data/levels/rebase/.githug/logs/refs/heads/feature +4 -0
  15. data/levels/rebase/.githug/logs/refs/heads/master +2 -0
  16. data/levels/rebase/.githug/objects/0c/d212c5b28da2e65ed4900712dd36c8adce48ad +0 -0
  17. data/levels/rebase/.githug/objects/44/19b972c0cd1b346ac90332aa7c5cc949589f78 +0 -0
  18. data/levels/rebase/.githug/objects/54/3b9bebdc6bd5c4b22136034a95dd097a57d3dd +0 -0
  19. data/levels/rebase/.githug/objects/81/78c76d627cade75005b40711b92f4177bc6cfc +0 -0
  20. data/levels/rebase/.githug/objects/98/205e9faf10cf33d2ef7c0f66e402540c62613a +2 -0
  21. data/levels/rebase/.githug/objects/a7/8bcab6232e9382a86436cdfcb2ed0391b1f0ac +4 -0
  22. data/levels/rebase/.githug/objects/b7/7313d7be366609dd2e77aa96d7fd73f4e27853 +0 -0
  23. data/levels/rebase/.githug/objects/b9/2d5d55d379cfb90b750e6472fc983f32ad9a71 +0 -0
  24. data/levels/rebase/.githug/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  25. data/levels/rebase/.githug/objects/ed/0fdcf366b21b8984fb37ea34106978a2e5c5ba +0 -0
  26. data/levels/rebase/.githug/refs/heads/feature +1 -0
  27. data/levels/rebase/.githug/refs/heads/master +1 -0
  28. data/levels/rebase/README +1 -0
  29. data/levels/reorder.rb +1 -4
  30. data/levels/restructure.rb +1 -1
  31. data/lib/githug/cli.rb +30 -15
  32. data/lib/githug/level.rb +1 -1
  33. data/lib/githug/profile.rb +21 -12
  34. data/lib/githug/ui.rb +6 -12
  35. data/lib/githug/version.rb +1 -1
  36. data/spec/githug/cli_spec.rb +47 -46
  37. data/spec/githug/game_spec.rb +12 -12
  38. data/spec/githug/level_spec.rb +64 -93
  39. data/spec/githug/profile_spec.rb +34 -28
  40. data/spec/githug/repository_spec.rb +37 -38
  41. data/spec/githug/ui_spec.rb +51 -51
  42. data/spec/githug_spec.rb +60 -53
  43. data/spec/support/files/test_level.rb +16 -0
  44. metadata +26 -3
@@ -2,33 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  describe Githug::Profile do
4
4
 
5
- it "should load the profile" do
6
- settings = {:level => 1, :current_attempts => 0, :current_hint_index => 0, :current_levels => [], :completed_levels => []}
7
- File.should_receive(:exists?).with(Githug::Profile::PROFILE_FILE).and_return(true)
8
- File.should_receive(:open).with(Githug::Profile::PROFILE_FILE).and_return("settings")
9
- YAML.should_receive(:load).with("settings").and_return(settings)
10
- Githug::Profile.should_receive(:new).with(settings)
11
- Githug::Profile.load
12
- end
5
+ describe ".load" do
6
+ it "loads the profile" do
7
+ settings = {:level => 1, :current_attempts => 0, :current_hint_index => 0, :current_levels => [], :completed_levels => []}
8
+ File.should_receive(:exists?).with(Githug::Profile::PROFILE_FILE).and_return(true)
9
+ File.should_receive(:open).with(Githug::Profile::PROFILE_FILE).and_return("settings")
10
+ YAML.should_receive(:load).with("settings").and_return(settings)
11
+ Githug::Profile.should_receive(:new).with(settings)
12
+ Githug::Profile.load
13
+ end
13
14
 
14
- it "should load the defaults if the file does not exist" do
15
- defaults = {:level => nil, :current_attempts => 0, :current_hint_index => 0, :current_levels => [], :completed_levels => []}
16
- File.should_receive(:exists?).with(Githug::Profile::PROFILE_FILE).and_return(false)
17
- Githug::Profile.should_receive(:new).with(defaults)
18
- Githug::Profile.load
15
+ it "loads the defaults if the file does not exist" do
16
+ defaults = {:level => nil, :current_attempts => 0, :current_hint_index => 0, :current_levels => [], :completed_levels => []}
17
+ File.should_receive(:exists?).with(Githug::Profile::PROFILE_FILE).and_return(false)
18
+ Githug::Profile.should_receive(:new).with(defaults)
19
+ Githug::Profile.load
20
+ end
19
21
  end
20
22
 
21
- it "should allow method acces to getters and setters" do
23
+ it "allows method acces to getters and setters" do
22
24
  profile = Githug::Profile.load
23
25
  profile.level.should eql(nil)
24
26
  profile.level = 1
25
27
  profile.level.should eql(1)
26
28
  end
27
29
 
28
- it "should save the file" do
29
- profile = Githug::Profile.load
30
- File.should_receive(:open).with(Githug::Profile::PROFILE_FILE, "w")
31
- profile.save
30
+ describe ".save" do
31
+
32
+ it "saves the file" do
33
+ profile = Githug::Profile.load
34
+ File.should_receive(:open).with(Githug::Profile::PROFILE_FILE, "w")
35
+ profile.save
36
+ end
37
+
32
38
  end
33
39
 
34
40
  describe "level methods" do
@@ -46,30 +52,30 @@ describe Githug::Profile do
46
52
  Githug::Level::LEVELS = @levels
47
53
  end
48
54
 
49
- describe "level_bump" do
55
+ describe "#level_bump" do
50
56
 
51
-
52
- it "should bump the level" do
57
+ it "bumps the level" do
53
58
  profile.should_receive(:set_level).with("add")
54
59
  profile.level_bump
55
60
  end
56
61
 
57
- it "should reset the current_attempts" do
62
+ it "resets the current_attempts" do
58
63
  profile.current_attempts = 1
59
64
  profile.level_bump
60
65
  profile.current_attempts.should eql(0)
61
66
  end
62
67
 
63
- it "should set the level to the first incomplete level" do
64
- profile.settings.stub(:[]).with(:level).and_return("rm_cached")
65
- profile.settings.stub(:[]).with(:completed_levels).and_return(["init", "add"])
66
- profile.level_bump.should eql("rm")
68
+ it "sets the level to the first incomplete level" do
69
+ profile.level = "rm_cached"
70
+ profile.completed_levels = ["init", "add"]
71
+ profile.level_bump
72
+ profile.level.should eql("rm")
67
73
  end
68
74
  end
69
75
 
70
- describe "set_level" do
76
+ describe "#set_level" do
71
77
 
72
- it "should set the level" do
78
+ it "sets the level" do
73
79
  profile.should_receive(:save)
74
80
  profile.should_receive(:reset!)
75
81
  profile.set_level("rm")
@@ -2,95 +2,94 @@ require 'spec_helper'
2
2
 
3
3
  describe Githug::Repository do
4
4
 
5
+ let(:grit) { mock }
6
+
5
7
  before(:each) do
6
- @grit = mock
7
- Grit::Repo.stub(:new).and_return(@grit)
8
- @repository = Githug::Repository.new
9
- @repository.stub(:create_gitignore)
8
+ Grit::Repo.stub(:new).and_return(grit)
9
+ subject.stub(:create_gitignore)
10
10
  end
11
11
 
12
- describe "initialize" do
12
+ describe "#initialize" do
13
13
 
14
- it "should call grit on initialize" do
15
- Grit::Repo.should_receive(:new).with(".").and_return(@grit)
14
+ it "calls grit on initialize" do
15
+ Grit::Repo.should_receive(:new).with(".").and_return(grit)
16
16
  repo = Githug::Repository.new
17
- repo.grit.should equal(@grit)
17
+ repo.grit.should equal(grit)
18
18
  end
19
19
 
20
- it "should contain a nil grit if the repo is invalid" do
20
+ it "contains a nil grit if the repo is invalid" do
21
21
  Grit::Repo.should_receive(:new).and_raise(Grit::InvalidGitRepositoryError)
22
22
  repo = Githug::Repository.new
23
23
  repo.grit.should equal(nil)
24
24
  end
25
25
 
26
- it "should initialize with a location" do
27
- Grit::Repo.should_receive(:new).with("test").and_return(@grit)
26
+ it "initializes with a location" do
27
+ Grit::Repo.should_receive(:new).with("test").and_return(grit)
28
28
  repo = Githug::Repository.new("test")
29
29
  end
30
30
 
31
31
  end
32
32
 
33
- describe "reset" do
33
+ describe "#reset" do
34
34
 
35
35
  before(:each) do
36
36
  FileUtils.stub(:rm_rf)
37
37
  end
38
38
 
39
- it "should do nothing if the current directory isn't git_hug" do
39
+ it "does nothing if the current directory isn't git_hug" do
40
40
  Dir.stub(:pwd).and_return("/tmp/foo")
41
41
  FileUtils.should_not_receive(:rm_rf)
42
- @repository.reset
42
+ subject.reset
43
43
  end
44
44
 
45
- it "should remove all the files except .gitignore and .profile.yml" do
45
+ it "removes all the files except .gitignore and .profile.yml" do
46
46
  Dir.stub(:pwd).and_return("/tmp/git_hug")
47
47
  Dir.stub(:entries).and_return([".profile.yml", ".gitignore", "..", ".", "README", ".git"])
48
48
  FileUtils.should_receive(:rm_rf).with("README")
49
49
  FileUtils.should_receive(:rm_rf).with(".git")
50
- @repository.reset
50
+ subject.reset
51
51
  end
52
52
  end
53
53
 
54
54
 
55
- describe "create_gitignore" do
56
- it "should create a gitignore" do
57
- @repository.unstub(:create_gitignore)
55
+ describe "#create_gitignore" do
56
+ it "creates a gitignore" do
57
+ subject.unstub(:create_gitignore)
58
58
  File.stub(:exists?).and_return(true)
59
59
  Dir.should_receive(:chdir).with("git_hug")
60
60
  File.should_receive(:open).with(".gitignore", "w")
61
- @repository.create_gitignore
61
+ subject.create_gitignore
62
62
  end
63
63
  end
64
64
 
65
- describe "valid?" do
66
- it "should be valid if grit exists" do
67
- @repository.should be_valid
65
+ describe "#valid?" do
66
+ it "is valid if grit exists" do
67
+ subject.should be_valid
68
68
  end
69
69
 
70
- it "should not be valid if grit does not exist" do
71
- @repository.instance_variable_set("@grit", nil)
72
- @repository.should_not be_valid
70
+ it "is not valid if grit does not exist" do
71
+ subject.instance_variable_set("@grit", nil)
72
+ subject.should_not be_valid
73
73
  end
74
74
  end
75
75
 
76
- describe "init" do
77
- it "should not add and commit gitignore if prompted" do
78
- @repo = mock
79
- Grit::Repo.should_receive(:init).with(".").and_return(@repo)
80
- @repository.init
76
+ describe "#init" do
77
+ it "does not add and commit gitignore if prompted" do
78
+ Grit::Repo.should_receive(:init).with(".")
79
+ subject.init
81
80
  end
82
81
  end
83
82
 
84
- describe "method_missing" do
85
- it "should deletegate to grit if the method exists" do
86
- @grit.should_receive(:respond_to?).with(:valid_method).and_return(true)
87
- @grit.should_receive(:valid_method)
88
- @repository.valid_method
83
+ describe "#method_missing" do
84
+ it "deletegates to grit if the method exists" do
85
+ grit.should_receive(:respond_to?).with(:valid_method).and_return(true)
86
+ grit.should_receive(:valid_method)
87
+ subject.valid_method
89
88
  end
90
89
 
91
90
  it "should not deletegate to grit if the method does not exist" do
92
- @grit.should_receive(:respond_to?).with(:invalid_method).and_return(false)
93
- lambda { @repository.invalid_method }.should raise_error(NoMethodError)
91
+ grit.should_receive(:respond_to?).with(:invalid_method).and_return(false)
92
+ lambda { subject.invalid_method }.should raise_error(NoMethodError)
94
93
  end
95
94
  end
96
95
 
@@ -4,73 +4,73 @@ require 'spec_helper'
4
4
 
5
5
  describe Githug::UI do
6
6
 
7
+ let(:ui_out) { StringIO.new }
8
+ let(:ui_in) { StringIO.new }
9
+
7
10
  before(:each) do
8
- @ui = Githug::UI
9
- @out = StringIO.new
10
- @in = StringIO.new
11
- @ui.out_stream = @out
12
- @ui.in_stream = @in
11
+ subject.out_stream = ui_out
12
+ subject.in_stream = ui_in
13
13
  end
14
14
 
15
- it "should put to the stream" do
16
- @ui.puts("hello")
17
- @out.string.should eql("hello\n")
15
+ it "puts to the stream" do
16
+ subject.puts("hello")
17
+ ui_out.string.should eql("hello\n")
18
18
  end
19
19
 
20
- it "should print an empty line with no arguments" do
21
- @ui.puts
22
- @out.string.should eql("\n")
20
+ it "prints an empty line with no arguments" do
21
+ subject.puts
22
+ ui_out.string.should eql("\n")
23
23
  end
24
24
 
25
- it "should print without a new line" do
26
- @ui.print("hello")
27
- @out.string.should eql("hello")
25
+ it "prints without a new line" do
26
+ subject.print("hello")
27
+ ui_out.string.should eql("hello")
28
28
  end
29
29
 
30
- it "should fetch gets from input stream" do
31
- @in.puts "bar"
32
- @in.rewind
33
- @ui.gets.should == "bar\n"
30
+ it "fetches gets from input stream" do
31
+ ui_in.puts "bar"
32
+ ui_in.rewind
33
+ subject.gets.should == "bar\n"
34
34
  end
35
35
 
36
- it "should make a wordbox" do
36
+ it "makes a wordbox" do
37
37
  word_box = <<-eof
38
38
  ********************************************************************************
39
39
  * Githug *
40
40
  ********************************************************************************
41
41
  eof
42
- @ui.word_box("Githug")
43
- @out.string.should eql(word_box)
42
+ subject.word_box("Githug")
43
+ ui_out.string.should eql(word_box)
44
44
  end
45
45
 
46
- it "should print a correct wordbox for uneven msg length" do
47
- @ui.word_box("odd",80)
48
- printed = @out.string.lines
46
+ it "prints a correct wordbox for uneven msg length" do
47
+ subject.word_box("odd",80)
48
+ printed = ui_out.string.lines
49
49
  first_size = printed.first.chomp.length
50
50
 
51
51
  printed.map{ |line| line.chomp.length.should eq(first_size) }
52
52
  end
53
53
 
54
- it "should request text input" do
55
- @in.puts "bar"
56
- @in.rewind
57
- @ui.request("foo").should == "bar"
58
- @out.string.should == "foo "
54
+ it "requests text input" do
55
+ ui_in.puts "bar"
56
+ ui_in.rewind
57
+ subject.request("foo").should == "bar"
58
+ ui_out.string.should == "foo "
59
59
  end
60
60
 
61
- it "should ask for yes/no and return true when yes" do
62
- @ui.should_receive(:request).with('foo? [yn] ').and_return('y')
63
- @ui.ask("foo?").should be_true
61
+ it "asks for yes/no and return true when yes" do
62
+ subject.should_receive(:request).with('foo? [yn] ').and_return('y')
63
+ subject.ask("foo?").should be_true
64
64
  end
65
65
 
66
- it "should ask for yes/no and return false when no" do
67
- @ui.stub(:request).and_return('n')
68
- @ui.ask("foo?").should be_false
66
+ it "asks for yes/no and return false when no" do
67
+ subject.stub(:request).and_return('n')
68
+ subject.ask("foo?").should be_false
69
69
  end
70
70
 
71
- it "should ask for yes/no and return false for any input" do
72
- @ui.stub(:request).and_return('aklhasdf')
73
- @ui.ask("foo?").should be_false
71
+ it "asks for yes/no and return false for any input" do
72
+ subject.stub(:request).and_return('aklhasdf')
73
+ subject.ask("foo?").should be_false
74
74
  end
75
75
 
76
76
  describe "Non Windows Platform" do
@@ -78,32 +78,32 @@ describe Githug::UI do
78
78
  ENV.stub(:[]).with("OS").and_return(nil)
79
79
  end
80
80
 
81
- it "should print out a success message in green" do
82
- @ui.success("success")
83
- @out.string.should eql("\033[32msuccess\033[0m\n")
81
+ it "prints out a success message in green" do
82
+ subject.success("success")
83
+ ui_out.string.should eql("\033[32msuccess\033[0m\n")
84
84
  end
85
85
 
86
- it "should print out a error message in red" do
87
- @ui.error("error")
88
- @out.string.should eql("\033[31merror\033[0m\n")
86
+ it "prints out a error message in red" do
87
+ subject.error("error")
88
+ ui_out.string.should eql("\033[31merror\033[0m\n")
89
89
  end
90
90
 
91
91
  end
92
92
 
93
- describe "Non Windows Platform" do
93
+ describe "Windows Platform" do
94
94
 
95
95
  before(:each) do
96
96
  ENV.stub(:[]).with("OS").and_return("Windows_NT")
97
97
  end
98
98
 
99
- it "should print out a success message in white" do
100
- @ui.success("success")
101
- @out.string.should eql("success\n")
99
+ it "prints out a success message in white" do
100
+ subject.success("success")
101
+ ui_out.string.should eql("success\n")
102
102
  end
103
103
 
104
- it "should print out a error message in white" do
105
- @ui.error("error")
106
- @out.string.should eql("error\n")
104
+ it "prints out a error message in white" do
105
+ subject.error("error")
106
+ ui_out.string.should eql("error\n")
107
107
  end
108
108
 
109
109
  end
data/spec/githug_spec.rb CHANGED
@@ -14,6 +14,7 @@ end
14
14
 
15
15
  describe "The Game" do
16
16
 
17
+
17
18
  before(:all) do
18
19
  @dir = Dir.pwd
19
20
  `rake build`
@@ -28,12 +29,12 @@ describe "The Game" do
28
29
  Dir.chdir(@dir)
29
30
  end
30
31
 
31
- it "should complete the init level" do
32
+ it "solves the init level" do
32
33
  `git init`
33
34
  `githug`.should be_solved
34
35
  end
35
36
 
36
- it "should complete the config level" do
37
+ it "solves the config level" do
37
38
  skip_level #The CI server does not have git config set
38
39
  #full_name = `git config --get user.name`.chomp
39
40
  #email = `git config --get user.email`.chomp
@@ -43,93 +44,93 @@ describe "The Game" do
43
44
  #f.close
44
45
  end
45
46
 
46
- it "should complete the add level" do
47
+ it "solves the add level" do
47
48
  `git add README`
48
49
  `githug`.should be_solved
49
50
  end
50
51
 
51
- it "should complete the commit level" do
52
+ it "solves the commit level" do
52
53
  `git commit -m "test message"`
53
54
  `githug`.should be_solved
54
55
  end
55
56
 
56
- it "should complete the clone level" do
57
+ it "solves the clone level" do
57
58
  `git clone https://github.com/Gazler/cloneme`
58
59
  `githug`.should be_solved
59
60
  end
60
61
 
61
- it "should complete the clone_to_folder level" do
62
+ it "solves the clone_to_folder level" do
62
63
  `git clone https://github.com/Gazler/cloneme my_cloned_repo`
63
64
  `githug`.should be_solved
64
65
  end
65
66
 
66
- it "should complete the ignore level" do
67
+ it "solves the ignore level" do
67
68
  `echo "*.swp" >> .gitignore`
68
69
  `githug`.should be_solved
69
70
  end
70
-
71
- it "should complete the include level" do
71
+
72
+ it "solves the include level" do
72
73
  `echo "*.a\n!lib.a" >> .gitignore`
73
74
  `githug`.should be_solved
74
75
  end
75
76
 
76
- it "should complete the status level" do
77
+ it "solves the status level" do
77
78
  `git ls-files --other --exclude-standard | githug`.should be_solved
78
79
  end
79
80
 
80
- it "should complete the number of files committed level" do
81
+ it "solves the number of files committed level" do
81
82
  `git diff --name-only --cached | wc -l | githug`.should be_solved
82
83
  end
83
84
 
84
- it "should complete the rm level" do
85
+ it "solves the rm level" do
85
86
  file_name = `git status | grep deleted | cut -d " " -f 5`
86
87
  `git rm #{file_name}`
87
88
  `githug`.should be_solved
88
89
  end
89
90
 
90
- it "should complete the rm cached level" do
91
+ it "solves the rm cached level" do
91
92
  file_name = `git status | grep "new file" | cut -d " " -f 5`
92
93
  `git rm --cached #{file_name}`
93
94
  `githug`.should be_solved
94
95
  end
95
96
 
96
- it "should complete the stash level" do
97
+ it "solves the stash level" do
97
98
  `git stash save`
98
99
  `githug`.should be_solved
99
100
  end
100
101
 
101
- it "should complete the rename level" do
102
+ it "solves the rename level" do
102
103
  `git mv oldfile.txt newfile.txt`
103
104
  `githug`.should be_solved
104
105
  end
105
106
 
106
- it "should complete the restructure level" do
107
+ it "solves the restructure level" do
107
108
  `mkdir src`
108
109
  `git mv *.html src`
109
110
  `githug`.should be_solved
110
111
  end
111
112
 
112
- it "should complete the log level" do
113
+ it "solves the log level" do
113
114
  `git log --pretty=short | grep commit | cut -c 8-14 | githug`.should be_solved
114
115
  end
115
116
 
116
- it "should complete the tag level" do
117
+ it "solves the tag level" do
117
118
  `git tag new_tag`
118
119
  `githug`.should be_solved
119
120
  end
120
121
 
121
- it "should complete the push_tags level" do
122
+ it "solves the push_tags level" do
122
123
  `git push origin master --tags`
123
124
  `githug`.should be_solved
124
125
  end
125
126
 
126
- it "should complete the commit_amend level" do
127
+ it "solves the commit_amend level" do
127
128
  `git add forgotten_file.rb`
128
129
  `git commit --amend -C HEAD`
129
130
  `githug`.should be_solved
130
131
  end
131
132
 
132
- it "should complete the commit_in_future level" do
133
+ it "solves the commit_in_future level" do
133
134
  authored_date = Time.now + 14
134
135
  authored_date = authored_date.rfc2822
135
136
 
@@ -137,85 +138,85 @@ describe "The Game" do
137
138
  `githug`.should be_solved
138
139
  end
139
140
 
140
- it "should complete the reset level" do
141
+ it "solves the reset level" do
141
142
  `git reset HEAD to_commit_second.rb`
142
143
  `githug`.should be_solved
143
144
  end
144
145
 
145
- it "should complete the reset_soft level" do
146
+ it "solves the reset_soft level" do
146
147
  `git reset --soft HEAD^`
147
148
  `githug`.should be_solved
148
149
  end
149
150
 
150
- it "should complete the checkout_file level" do
151
+ it "solves the checkout_file level" do
151
152
  `git checkout -- config.rb`
152
153
  `githug`.should be_solved
153
154
  end
154
155
 
155
- it "should complete the remove level" do
156
+ it "solves the remove level" do
156
157
  `git remote | githug`.should be_solved
157
158
  end
158
159
 
159
- it "should complete the remote_url level" do
160
+ it "solves the remote_url level" do
160
161
  `git remote -v | tail -2 | head -1 | cut -c 17-52 | githug`.should be_solved
161
162
  end
162
163
 
163
- it "should complete the pull level" do
164
+ it "solves the pull level" do
164
165
  `git pull origin master`
165
166
  `githug`.should be_solved
166
167
  end
167
168
 
168
- it "should complete the remote_add level" do
169
+ it "solves the remote_add level" do
169
170
  `git remote add origin https://github.com/githug/githug`
170
171
  `githug`.should be_solved
171
172
  end
172
173
 
173
- it "should complete the push level" do
174
+ it "solves the push level" do
174
175
  `git rebase origin/master`
175
176
  `git push origin`
176
177
  `githug`.should be_solved
177
178
  end
178
179
 
179
- it "should complete the diff level" do
180
+ it "solves the diff level" do
180
181
  `echo "26" | githug`.should be_solved
181
182
  end
182
183
 
183
- it "should complete the blame level" do
184
+ it "solves the blame level" do
184
185
  `echo "spider man" | githug`.should be_solved
185
186
  end
186
187
 
187
- it "should complete the branch level" do
188
+ it "solves the branch level" do
188
189
  `git branch test_code`
189
190
  `githug`.should be_solved
190
191
  end
191
192
 
192
- it "should complete the checkout level" do
193
+ it "solves the checkout level" do
193
194
  `git checkout -b my_branch`
194
195
  `githug`.should be_solved
195
196
  end
196
197
 
197
- it "should complete the checkout_tag level" do
198
+ it "solves the checkout_tag level" do
198
199
  `git checkout v1.2`
199
200
  `githug`.should be_solved
200
201
  end
201
202
 
202
- it "should complete the checkout_tag_over_branch level" do
203
+ it "solves the checkout_tag_over_branch level" do
203
204
  `git checkout tags/v1.2`
204
205
  `githug`.should be_solved
205
206
  end
206
207
 
207
- it "should complete the branch_at level" do
208
+ it "solves the branch_at level" do
208
209
  commit = `git log HEAD~1 --pretty=short | head -1 | cut -d " " -f 2`
209
210
  `git branch test_branch #{commit}`
210
211
  `githug`.should be_solved
211
212
  end
212
213
 
213
- it "should complete the delete_branch level" do
214
+ it "solves the delete_branch level" do
214
215
  `git branch -d delete_me`
215
216
  `githug`.should be_solved
216
217
  end
217
218
 
218
- it "should complete the push_branch level" do
219
+ it "solves the push_branch level" do
219
220
  `git push origin test_branch`
220
221
  `githug`.should be_solved
221
222
  end
@@ -225,73 +226,79 @@ describe "The Game" do
225
226
  `githug`.should be_solved
226
227
  end
227
228
 
228
- it "should complete the fetch level" do
229
+ it "solves the fetch level" do
229
230
  `git fetch`
230
231
  `githug`.should be_solved
231
232
  end
232
233
 
233
- it "should complete the repack level" do
234
+ it "solves the rebase level" do
235
+ `git checkout feature`
236
+ `git rebase master`
237
+ `githug`.should be_solved
238
+ end
239
+
240
+ it "solves the repack level" do
234
241
  `git repack -d`
235
242
  `githug`.should be_solved
236
243
  end
237
244
 
238
- it "should complete the cherry-pick level" do
245
+ it "solves the cherry-pick level" do
239
246
  commit = `git log new-feature --oneline -n 3 | tail -1 | cut -d " " -f 1`
240
247
  `git cherry-pick #{commit}`
241
248
  `githug`.should be_solved
242
249
  end
243
250
 
244
- it "should complete the grep level" do
251
+ it "solves the grep level" do
245
252
  `echo "4" | githug`.should be_solved
246
253
  end
247
254
 
248
- it "should complete the rename_commit level" do
255
+ it "solves the rename_commit level" do
249
256
  skip_level
250
257
  end
251
258
 
252
- it "should complete the squash level" do
259
+ it "solves the squash level" do
253
260
  skip_level
254
261
  end
255
262
 
256
- it "should complete the merge squash level" do
263
+ it "solves the merge squash level" do
257
264
  `git merge --squash long-feature-branch`
258
265
  `git commit -m "Merged Long Feature Branch"`
259
266
  `githug`.should be_solved
260
267
  end
261
268
 
262
- it "should complete the reorder level" do
269
+ it "solves the reorder level" do
263
270
  skip_level
264
271
  end
265
272
 
266
- it "should complete the bisect level" do
273
+ it "solves the bisect level" do
267
274
  `echo "18ed2ac" | githug`.should be_solved
268
275
  end
269
276
 
270
- it "should complete the stage_lines level" do
277
+ it "solves the stage_lines level" do
271
278
  skip_level
272
279
  end
273
280
 
274
- it "should complete the find_old_branch level" do
281
+ it "solves the find_old_branch level" do
275
282
  `git checkout solve_world_hunger`
276
283
  `githug`.should be_solved
277
284
  end
278
285
 
279
- it "should complete the revert level" do
286
+ it "solves the revert level" do
280
287
  sleep 1
281
288
  `git revert HEAD~1 --no-edit`
282
289
  `githug`.should be_solved
283
290
  end
284
291
 
285
- it "should complete the restore level" do
292
+ it "solves the restore level" do
286
293
  `git reflog | grep "Restore this commit" | awk '{print $1}' | xargs git checkout`
287
294
  `githug`.should be_solved
288
295
  end
289
296
 
290
- it "should complete the conflict level" do
297
+ it "solves the conflict level" do
291
298
  skip_level
292
299
  end
293
300
 
294
- it "should complete the contribute level" do
301
+ it "solves the contribute level" do
295
302
  skip_level
296
303
  end
297
304