Skip to content

Commit 5946e68

Browse files
committed
Add rspec test for Git.changed_files method
1 parent 302b2f4 commit 5946e68

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

spec/fixtures/git_log_name_status

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
commit e5be953469f603f113ff065d3619853a1dbe4336
2+
Author: zoltan <ilozkaa@yahoo.com>
3+
Date: Thu Oct 30 15:58:42 2008 +0200
4+
5+
add install script
6+
7+
M README.rdoc
8+
D git_commit_notifier/Rakefile
9+
M post-receive
10+

spec/lib/git_commit_notifier/git_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,14 @@
9292
end
9393
end
9494

95+
describe :changed_files do
96+
it "should run git log --name-status with given args and strip out the result" do
97+
files = ["M README.rdoc\n",
98+
"D git_commit_notifier/Rakefile\n",
99+
"M post-receive"]
100+
puts FIXTURES_PATH
101+
mock(GitCommitNotifier::Git).from_shell("git log #{SAMPLE_REV}..#{SAMPLE_REV_2} --name-status" ) { IO.read(FIXTURES_PATH + 'git_log_name_status') }
102+
GitCommitNotifier::Git.changed_files(SAMPLE_REV, SAMPLE_REV_2).should == files
103+
end
104+
end
95105
end

0 commit comments

Comments
 (0)