Sha256: 741e683f8f81ece61f3d72ffe322b4e7cc2d8724a3a8bc00f4baa67258fd7c4a

Contents?: true

Size: 885 Bytes

Versions: 8

Compression:

Stored size: 885 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'mspec/guards/quarantine'

describe QuarantineGuard, "#match?" do
  it "returns false" do
    QuarantineGuard.new.match?.should == false
  end
end

describe Object, "#quarantine!" do
  before :each do
    ScratchPad.clear

    @guard = QuarantineGuard.new
    QuarantineGuard.stub!(:new).and_return(@guard)
  end

  it "does not yield" do
    quarantine! { ScratchPad.record :yield }
    ScratchPad.recorded.should_not == :yield
  end

  it "sets the name of the guard to :quarantine!" do
    quarantine! { }
    @guard.name.should == :quarantine!
  end

  it "calls #unregister even when an exception is raised in the guard block" do
    @guard.should_receive(:match?).and_return(true)
    @guard.should_receive(:unregister)
    lambda do
      quarantine! { raise Exception }
    end.should raise_error(Exception)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mspec-1.5.17 spec/guards/quarantine_spec.rb
mspec-1.5.16 spec/guards/quarantine_spec.rb
mspec-1.5.15 spec/guards/quarantine_spec.rb
mspec-1.5.14 spec/guards/quarantine_spec.rb
mspec-1.5.13 spec/guards/quarantine_spec.rb
mspec-1.5.10 spec/guards/quarantine_spec.rb
mspec-1.5.12 spec/guards/quarantine_spec.rb
mspec-1.5.11 spec/guards/quarantine_spec.rb