spec/lib/fourchette/pull_request_spec.rb in fourchette-0.1.2 vs spec/lib/fourchette/pull_request_spec.rb in fourchette-0.1.3
- old
+ new
@@ -1,43 +1,68 @@
require 'spec_helper'
describe Fourchette::PullRequest do
describe '#perform' do
- let!(:fork) { double('fork') }
+ let(:fork) { double('fork') }
subject { described_class.new }
after do
- Fourchette::Fork.stub(:new).and_return(fork)
+ allow(Fourchette::Fork).to receive(:new).and_return(fork)
subject.perform(params)
end
context 'action == synchronize' do
- let!(:params) { { 'action' => 'synchronize', 'pull_request' => { 'title' => 'Test Me' } } }
+ let(:params) do
+ {
+ 'action' => 'synchronize',
+ 'pull_request' => { 'title' => 'Test Me' }
+ }
+ end
- it { fork.should_receive(:update) }
+ it { expect(fork).to receive(:update) }
end
context 'action == closed' do
- let!(:params) { { 'action' => 'closed', 'pull_request' => { 'title' => 'Test Me' } } }
+ let(:params) do
+ {
+ 'action' => 'closed',
+ 'pull_request' => { 'title' => 'Test Me' }
+ }
+ end
- it { fork.should_receive(:delete) }
+ it { expect(fork).to receive(:delete) }
end
context 'action == reopened' do
- let!(:params) { { 'action' => 'reopened', 'pull_request' => { 'title' => 'Test Me' } } }
+ let(:params) do
+ {
+ 'action' => 'reopened',
+ 'pull_request' => { 'title' => 'Test Me' }
+ }
+ end
- it { fork.should_receive(:create) }
+ it { expect(fork).to receive(:create) }
end
context 'action == opened' do
- let!(:params) { { 'action' => 'opened', 'pull_request' => { 'title' => 'Test Me' } } }
+ let(:params) do
+ {
+ 'action' => 'opened',
+ 'pull_request' => { 'title' => 'Test Me' }
+ }
+ end
- it { fork.should_receive(:create) }
+ it { expect(fork).to receive(:create) }
end
context 'title includes [qa skip]' do
- let!(:params) { { 'action' => 'opened', 'pull_request' => { 'title' => 'Skip Me [QA Skip]' } } }
+ let(:params) do
+ {
+ 'action' => 'opened',
+ 'pull_request' => { 'title' => 'Skip Me [QA Skip]' }
+ }
+ end
- it { fork.should_not_receive(:create) }
+ it { expect(fork).not_to receive(:create) }
end
end
end