1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require 'mspec/runner/actions/gdb'
3 require 'mspec/runner/mspec'
4 require 'mspec/runner/example'
8 MSpec.stub!(:read_tags).and_return([])
11 it "creates an MatchFilter with its tag and desc arguments" do
12 filter = mock('action filter', :null_object => true)
13 MatchFilter.should_receive(:new).with(nil, "some", "thing").and_return(filter)
14 GdbAction.new ["tag", "key"], ["some", "thing"]
18 describe GdbAction, "#before" do
20 MSpec.stub!(:read_tags).and_return([])
21 @state = ExampleState.new ContextState.new("Catch#me"), "if you can"
24 it "does not invoke the debugger if the description does not match" do
25 Kernel.should_not_receive(:yield_gdb)
26 action = GdbAction.new nil, "match"
30 it "invokes the debugger if the description matches" do
31 Kernel.should_receive(:yield_gdb).with(true)
32 action = GdbAction.new nil, "can"
37 describe GdbAction, "#register" do
39 MSpec.stub!(:read_tags).and_return([])
40 MSpec.stub!(:register)
41 @action = GdbAction.new nil, nil
44 it "registers itself with MSpec for the :before action" do
45 MSpec.should_receive(:register).with(:before, @action)
50 describe GdbAction, "#unregister" do
52 MSpec.stub!(:read_tags).and_return([])
53 MSpec.stub!(:unregister)
54 @action = GdbAction.new nil, nil
57 it "unregisters itself with MSpec for the :before action" do
58 MSpec.should_receive(:unregister).with(:before, @action)