Sha256: f9bd49f98561908ef48a96c056e55883617d41f30ca12f88bb89855d54775069

Contents?: true

Size: 837 Bytes

Versions: 3

Compression:

Stored size: 837 Bytes

Contents

# coding: utf-8

require 'spec_helper'
require 'grit'

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

  before do
    command.stub!(:say) { true }

    write_to_wip_file article

    invoke_command :rebind

    Grit::Repo.init retter_home.to_path
  end

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

      invoke_command :commit
    end

    subject { repo.commits.first }

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

  context 'with silent option' do
    specify 'callback should not called' do
      command.should_not_receive(:after_callback).with(:commit)

      invoke_command :commit, silent: :true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
retter-0.2.5 spec/command/commit_spec.rb
retter-0.2.4 spec/command/commit_spec.rb
retter-0.2.3 spec/command/commit_spec.rb