Sha256: e430d99b893037194f6685d6564ebfe25c22c36748bf0c3f5b3dde84f47f8f6d

Contents?: true

Size: 1 KB

Versions: 16

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Gitmine::Commit do
  let(:grit_commit) { Grit::Commit.create(nil, {:message => "Commit message"}) }
  let(:commit) { Gitmine::Commit.new(grit_commit) }
  let(:issue)  { Gitmine::Issue.new }

  describe "#new" do
    it "should take a grit_commit object and store it" do
      commit.grit_commit.should == grit_commit
    end
  end

  it "should delegate methods to the grit_commit object" do
    commit.message.should == grit_commit.message
  end

  it "should delegate #id to the grit_commit object" do
    commit.id.should == grit_commit.id
  end

  it "should respond_to :issue" do
    commit.should respond_to :issue
  end

  it "should return issue via #Issue.get_for_commit" do
    Gitmine::Issue.should_receive(:get_for_commit).with("Commit message") { issue }
    commit.issue.should == issue
  end

  it "should memoize issue" do
    Gitmine::Issue.should_receive(:get_for_commit).with("Commit message") { issue }.once
    2.times do
      commit.issue.should == issue
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gitmine-0.2.1 spec/commit_spec.rb
gitmine-0.2.0 spec/commit_spec.rb
gitmine-0.1.16 spec/commit_spec.rb
gitmine-0.1.15 spec/commit_spec.rb
gitmine-0.1.14 spec/commit_spec.rb
gitmine-0.1.13 spec/commit_spec.rb
gitmine-0.1.12 spec/commit_spec.rb
gitmine-0.1.11 spec/commit_spec.rb
gitmine-0.1.10 spec/commit_spec.rb
gitmine-0.1.9 spec/commit_spec.rb
gitmine-0.1.8 spec/commit_spec.rb
gitmine-0.1.7 spec/commit_spec.rb
gitmine-0.1.6 spec/commit_spec.rb
gitmine-0.1.5 spec/commit_spec.rb
gitmine-0.1.4.pre.1 spec/commit_spec.rb
gitmine-0.1.4.pre spec/commit_spec.rb