Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ability to paste SHA instead of line #. added specs. some refac…
…toring.
- Loading branch information
1 parent
52d4450
commit d27abff
Showing
7 changed files
with
133 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# Load nothing - just keep the file here to keep bundler happy. | ||
|
||
require 'rubygems' | ||
require 'colorize' | ||
require 'optparse' | ||
require 'git-blame-game/git_blame_game' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'spec_helper' | ||
|
||
describe GitBlameGame do | ||
|
||
let(:git_blame_game) { GitBlameGame.new('some_file') } | ||
let(:sha_list) { %w(de2a1d78 5087eab5 5087eab5 de2a1d78 de2a1d78) } | ||
|
||
before do | ||
$stdout.stub(:print) | ||
end | ||
|
||
describe "#get_sha_list" do | ||
let(:git_blame_out) { | ||
<<-END.gsub(/^[ \t]+/m, '') | ||
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 1) module Add | ||
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 2) def add_4(y) | ||
5087eab5 (Danny Dover 2012-01-14 14:50:06 -0800 3) y + 5 | ||
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 4) end | ||
de2a1d78 (Carmen Cummings 2012-01-14 14:49:00 -0800 5) end | ||
END | ||
} | ||
|
||
it "should return a list of shas" do | ||
git_blame_game.get_sha_list(git_blame_out).should == sha_list | ||
end | ||
end | ||
|
||
describe "prompt_for_sha" do | ||
before do | ||
$stdin.should_receive(:gets).and_return(input) | ||
end | ||
context "when user enters a correct sha" do | ||
let(:input) { '5087eab5' } | ||
it "should return the correct sha" do | ||
git_blame_game.prompt_for_sha(sha_list).should == '5087eab5' | ||
end | ||
end | ||
context "when user enters a correct number" do | ||
let(:input) { '1' } | ||
it "should return the correct sha" do | ||
git_blame_game.prompt_for_sha(sha_list).should == 'de2a1d78' | ||
end | ||
end | ||
context "when user enters an incorrect value" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'git-blame-game' |