1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require 'mspec/runner/actions/debug'
3 require 'mspec/runner/mspec'
4 require 'mspec/runner/context'
5 require 'mspec/runner/example'
7 describe DebugAction do
9 MSpec.stub!(:read_tags).and_return([])
12 it "creates an MatchFilter with its tag and desc arguments" do
13 filter = mock('action filter', :null_object => true)
14 MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
15 DebugAction.new ["tag", "key"], ["some", "thing"]
19 describe DebugAction, "#before" do
21 MSpec.stub!(:read_tags).and_return([])
22 @state = ExampleState.new ContextState.new("Catch#me"), "if you can"
25 it "does not invoke the debugger if the description does not match" do
26 Kernel.should_not_receive(:debugger)
27 action = DebugAction.new nil, "match"
31 it "invokes the debugger if the description matches" do
32 Kernel.should_receive(:debugger)
33 action = DebugAction.new nil, "can"
38 describe DebugAction, "#register" do
40 MSpec.stub!(:read_tags).and_return([])
41 MSpec.stub!(:register)
42 @action = DebugAction.new nil, nil
45 it "registers itself with MSpec for the :before action" do
46 MSpec.should_receive(:register).with(:before, @action)
51 describe DebugAction, "#unregister" do
53 MSpec.stub!(:read_tags).and_return([])
54 MSpec.stub!(:unregister)
55 @action = DebugAction.new nil, nil
58 it "unregisters itself with MSpec for the :before action" do
59 MSpec.should_receive(:unregister).with(:before, @action)