Sha256: 711efe5c2177b82919ed0f0159d0cfa9f6f22a9c057ae4e71fbb81d6525b59b4

Contents?: true

Size: 1.69 KB

Versions: 19

Compression:

Stored size: 1.69 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'mspec/runner/actions/debug'
require 'mspec/runner/mspec'
require 'mspec/runner/context'
require 'mspec/runner/example'

describe DebugAction do
  before :each do
    MSpec.stub!(:read_tags).and_return([])
  end

  it "creates an MatchFilter with its tag and desc arguments" do
    filter = mock('action filter', :null_object => true)
    MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
    DebugAction.new ["tag", "key"], ["some", "thing"]
  end
end

describe DebugAction, "#before" do
  before :each do
    MSpec.stub!(:read_tags).and_return([])
    @state = ExampleState.new ContextState.new("Catch#me"), "if you can"
  end

  it "does not invoke the debugger if the description does not match" do
    Kernel.should_not_receive(:debugger)
    action = DebugAction.new nil, "match"
    action.before @state
  end

  it "invokes the debugger if the description matches" do
    Kernel.should_receive(:debugger)
    action = DebugAction.new nil, "can"
    action.before @state
  end
end

describe DebugAction, "#register" do
  before :each do
    MSpec.stub!(:read_tags).and_return([])
    MSpec.stub!(:register)
    @action = DebugAction.new nil, nil
  end

  it "registers itself with MSpec for the :before action" do
    MSpec.should_receive(:register).with(:before, @action)
    @action.register
  end
end

describe DebugAction, "#unregister" do
  before :each do
    MSpec.stub!(:read_tags).and_return([])
    MSpec.stub!(:unregister)
    @action = DebugAction.new nil, nil
  end

  it "unregisters itself with MSpec for the :before action" do
    MSpec.should_receive(:unregister).with(:before, @action)
    @action.unregister
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mspec-1.5.17 spec/runner/actions/debug_spec.rb
mspec-1.5.16 spec/runner/actions/debug_spec.rb
mspec-1.5.15 spec/runner/actions/debug_spec.rb
mspec-1.5.14 spec/runner/actions/debug_spec.rb
mspec-1.5.13 spec/runner/actions/debug_spec.rb
mspec-1.4.0 spec/runner/actions/debug_spec.rb
mspec-1.5.1 spec/runner/actions/debug_spec.rb
mspec-1.5.10 spec/runner/actions/debug_spec.rb
mspec-1.5.0 spec/runner/actions/debug_spec.rb
mspec-1.5.12 spec/runner/actions/debug_spec.rb
mspec-1.5.4 spec/runner/actions/debug_spec.rb
mspec-1.5.11 spec/runner/actions/debug_spec.rb
mspec-1.5.3 spec/runner/actions/debug_spec.rb
mspec-1.5.2 spec/runner/actions/debug_spec.rb
mspec-1.5.5 spec/runner/actions/debug_spec.rb
mspec-1.5.9 spec/runner/actions/debug_spec.rb
mspec-1.5.6 spec/runner/actions/debug_spec.rb
mspec-1.5.7 spec/runner/actions/debug_spec.rb
mspec-1.5.8 spec/runner/actions/debug_spec.rb