Sha256: d384745b76924dea31ced59e935ca69188a89afe4661c798c83386153de9b322

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe GitFile do
  context 'initialize' do
    it 'requires a path' do
      expect {
        GitFile.new('dir/path.txt')
      }.not_to raise_error
    end

    it 'accepts content' do
      expect {
        GitFile.new('dir/path.txt', 'content')
      }.not_to raise_error
    end
  end

  context '#name' do
    it 'has a name' do
      file = GitFile.new('file.txt')
      expect(file.name).to eq(:file)
    end
  end

  context '#extension?' do
    it 'checks if extension is the same' do
      file = GitFile.new('path.txt')
      expect(file).to be_extension('.txt')
    end
  end

  context '#content' do
    it 'returns the content of file' do
      file = GitFile.new('file.txt', 'content')
      expect(file.content).to eq('content')
    end
  end

  context '#nil?' do
    it 'is always false' do
      file = GitFile.new('file.txt')
      expect(file.nil?).to be_falsey
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proxy_tester-0.1.10 spec/git_file_spec.rb
proxy_tester-0.1.8 spec/git_file_spec.rb