Sha256: 3cd6dc2ac6c16e8a56ba57642392805b37344b4bbea0a12383413ad7d7d099ef

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 KB

Contents

# -*- coding: utf-8 -*-

require 'spec_helper.rb'

module GitObjectBrowser::Models
  describe GitObject do

    let(:infile) { File.join(FIXTURES_DIR, 'worktree/_git/objects', sha1[0,2], sha1[2,40]) }
    let(:input) { File.open(infile) }
    subject { GitObject.new(input) }

    describe 'tag object' do
      let(:sha1) { '00cb8bfeb5b8ce906d39698e4e33b38341f5448f' }

      it 'should be parsed' do
        expect = load_json('test3-tag.json')
        JSON.pretty_generate(subject.parse.to_hash).should eq expect
      end
    end

    describe 'commit object' do
      let(:sha1) { '37d1632d3f1159dad9cfb58e6c34312ab4355c49' }

      it 'should be parsed' do
        expect = load_json('merge-a.json')
        JSON.pretty_generate(subject.parse.to_hash).should eq expect
      end
    end

    describe 'tree object' do
      let(:sha1) { 'c36491256978d26c08cd7aa97eee0f5631f96659' }

      it 'should be parsed' do
        expect = load_json('tree.json')
        JSON.pretty_generate(subject.parse.to_hash).should eq expect
      end
    end

    describe 'blob object' do
      let(:sha1) { 'd234c5e057fe32c676ea67e8cb38f4625ddaeb54' }

      it 'should be parsed' do
        expect = load_json('blob.json')
        JSON.pretty_generate(subject.parse.to_hash).should eq expect
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
git-object-browser-0.1.3 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.1.2 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.1.1 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.1.0 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.9 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.8 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.7 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.6 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.4 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.3 spec/git-object-browser/models/git_object_spec.rb
git-object-browser-0.0.2 spec/git-object-browser/models/git_object_spec.rb