require 'spec_helper'

describe Overcommit::GitHook::Whitespace do
  let(:staged_filename) { 'filename.txt' }

  around do |example|
    repo do
      File.open(staged_filename, 'w') { |f| f.write(file_contents) }
      `git add #{staged_filename}`
      example.run
    end
  end

  context 'when file contains hard tabs' do
    let(:file_contents) { "Some\thard\ttabs" }
    it { should stop }
  end

  context 'when file has no hard tabs' do
    let(:file_contents) { 'Just some text' }
    it { should pass }
  end
end

Add spec for Whitespace check
Add spec for Whitespace check

Now that we have a convenient way to test anything involving
`StagedFile`s, we should try to add tests for these files.

Change-Id: If1c6cfee179cbd2dd13f2ed450b04f23cbe19195
Reviewed-on: https://gerrit.causes.com/25161
Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>
Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
