Sha256: 633b75e484f15b9647503209ce30d3dd10374f113e9b593dfb908b57c73c2f5a

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe Fourchette::PullRequest do
  describe '#perform' do
    let!(:fork) { double('fork') }
    subject { described_class.new }

    after do
      Fourchette::Fork.stub(:new).and_return(fork)
      subject.perform(params)
    end

    context 'action == synchronize' do
      let!(:params) { { 'action' => 'synchronize', 'pull_request' => { 'title' => 'Test Me' } } }

      it { fork.should_receive(:update) }
    end

    context 'action == closed' do
      let!(:params) { { 'action' => 'closed', 'pull_request' => { 'title' => 'Test Me' } } }

      it { fork.should_receive(:delete) }
    end

    context 'action == reopened' do
      let!(:params) { { 'action' => 'reopened', 'pull_request' => { 'title' => 'Test Me' } } }

      it { fork.should_receive(:create) }
    end

    context 'action == opened' do
      let!(:params) { { 'action' => 'opened', 'pull_request' => { 'title' => 'Test Me' } } }

      it { fork.should_receive(:create) }
    end

    context 'title includes [qa skip]' do
      let!(:params) { { 'action' => 'opened', 'pull_request' => { 'title' => 'Skip Me [QA Skip]' } } }

      it { fork.should_not_receive(:create) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fourchette-0.1.2 spec/lib/fourchette/pull_request_spec.rb
fourchette-0.1.1 spec/lib/fourchette/pull_request_spec.rb
fourchette-0.1.0 spec/lib/fourchette/pull_request_spec.rb