Sha256: c3ee40a58a65c7cd8b525a0b0089d4d0eea9745915076c4f9d4bd4e4829dec50

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

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

    after do
      allow(Fourchette::Fork).to receive(:new).and_return(fork)
      subject.perform(params)
    end

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

      it { expect(fork).to receive(:update) }
    end

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

      it { expect(fork).to receive(:delete) }
    end

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

      it { expect(fork).to receive(:create) }
    end

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

      it { expect(fork).to receive(:create) }
    end

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

      it { expect(fork).not_to receive(:create) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fourchette-0.1.4 spec/lib/fourchette/pull_request_spec.rb
fourchette-0.1.3 spec/lib/fourchette/pull_request_spec.rb