Sha256: 4d880e3aff2cb5a156969efb696db11defac062b87ecd7540c96347c89bf5dc0

Contents?: true

Size: 981 Bytes

Versions: 14

Compression:

Stored size: 981 Bytes

Contents

require 'spec_helper'

describe Gitmine do
  before do
    File.stub!(:read) { "ref: refs/heads/wip" }
  end

  let(:gitmine) { Gitmine.new }

  let(:commit_1) do
    mock(
      :message => "Commit 1 #1234",
      :committer => "Sam",
      :committed_date => Time.now
    )
  end

  let(:repo) do
    mock(Grit::Repo, :commits => [commit_1])
  end

  before do
    Grit::Repo.stub!(:new) { repo }
  end
     
  describe "#commits" do
    it "should return Gitmine commits" do
      gitmine.commits.first.should be_a Gitmine::Commit
    end
    it "should return commits for the current branch" do
      repo.should_receive(:commits).with('wip')
      gitmine.commits
    end
  end

  describe "#initialize" do
    let(:grit_repo) { mock(:checkout => true)}
    before do
      Grit::Repo.stub!(:new) { grit_repo }
    end

    it "should check out to the current branch" do
      Grit::Repo.should_receive(:new).with(ENV['PWD']) { grit_repo }
      Gitmine.new
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gitmine-0.2.1 spec/gitmine_spec.rb
gitmine-0.2.0 spec/gitmine_spec.rb
gitmine-0.1.16 spec/gitmine_spec.rb
gitmine-0.1.15 spec/gitmine_spec.rb
gitmine-0.1.14 spec/gitmine_spec.rb
gitmine-0.1.13 spec/gitmine_spec.rb
gitmine-0.1.12 spec/gitmine_spec.rb
gitmine-0.1.11 spec/gitmine_spec.rb
gitmine-0.1.10 spec/gitmine_spec.rb
gitmine-0.1.9 spec/gitmine_spec.rb
gitmine-0.1.8 spec/gitmine_spec.rb
gitmine-0.1.7 spec/gitmine_spec.rb
gitmine-0.1.6 spec/gitmine_spec.rb
gitmine-0.1.3 spec/gitmine_spec.rb