diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-16 16:30:16 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-16 16:30:16 +0300 |
commit | be41d0e1bfb61abeb12c33c2344e374adc7803cf (patch) | |
tree | 6bd8c6d6451031d950ff496b92493b3729ba8598 /spec/lib | |
parent | 14798b8e686aafaa9ea3bc9b18294fefa54801f5 (diff) | |
download | gitlab-ce-be41d0e1bfb61abeb12c33c2344e374adc7803cf.tar.gz |
Gitlab::Git::Diff specs
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git/diff_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/diff_spec.rb b/spec/lib/gitlab/git/diff_spec.rb new file mode 100644 index 00000000000..5191b1190a6 --- /dev/null +++ b/spec/lib/gitlab/git/diff_spec.rb @@ -0,0 +1,34 @@ +require "spec_helper" + +describe Gitlab::Git::Diff do + before do + @raw_diff_hash = { + diff: 'Hello world', + new_path: 'temp.rb', + old_path: 'test.rb', + a_mode: '100644', + b_mode: '100644', + new_file: false, + renamed_file: true, + deleted_file: false, + } + + @grit_diff = double('Grit::Diff', @raw_diff_hash) + end + + context 'init from grit' do + before do + @diff = Gitlab::Git::Diff.new(@raw_diff_hash) + end + + it { @diff.to_hash.should == @raw_diff_hash } + end + + context 'init from hash' do + before do + @diff = Gitlab::Git::Diff.new(@grit_diff) + end + + it { @diff.to_hash.should == @raw_diff_hash } + end +end |