Sha256: c17a67e846097589b9185f1dd95d79f2751e4d2740a84bebf2807a9d9c94183f

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 Bytes

Contents

# coding: utf-8

require 'spec_helper'
require 'grit'

describe 'Retter::Command#commit', clean: :all do
  let(:repo) { Grit::Repo.new(Retter.config.retter_home) }
  let(:article) { '今日の記事' }

  before do
    command.stub!(:say) { true }
    wip_file.open('w') {|f| f.puts article }
    command.rebind

    Grit::Repo.init Retter.config.retter_home.to_path
  end

  context 'with no options' do
    before do
      command.should_receive(:invoke_after).with(:commit)

      command.commit
    end

    subject { repo.commits.first }

    its(:message) { should == 'Retter commit' }
  end

  context 'with silent option' do
    before do
      command.stub!(:options) { {silent: true} }
    end

    specify 'callback should not called' do
      command.should_not_receive(:invoke_after)

      command.commit
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
retter-0.2.2 spec/command/commit_spec.rb
retter-0.2.1 spec/command/commit_spec.rb