0
require File.dirname(__FILE__) + '/../../spec_helper'
0
require File.dirname(__FILE__) + '/../../bin/script'
0
+require File.dirname(__FILE__) + '/../../runner/mspec'
0
+require File.dirname(__FILE__) + '/../../runner/filters'
0
+require File.dirname(__FILE__) + '/../../runner/actions/filter'
0
+require File.dirname(__FILE__) + '/../../runner/actions/debug'
0
+require File.dirname(__FILE__) + '/../../runner/actions/gdb'
0
describe MSpecScript, ".config" do
0
@@ -90,11 +95,125 @@ describe MSpecScript, "#initialize" do
0
describe MSpecScript, "#load" do
0
+ File.stub!(:exist?).and_return(false)
0
+ @script = MSpecScript.new
0
+ @file = "default.mspec"
0
+ it "attempts to locate the file through the expanded path name" do
0
+ File.should_receive(:expand_path).with(@file).and_return(@file)
0
+ File.should_receive(:exist?).with(@file).and_return(true)
0
+ Kernel.should_receive(:load).with(@file).and_return(:loaded)
0
+ @script.load(@file).should == :loaded
0
+ it "attemps to locate the file in '.'" do
0
+ path = File.join ".", @file
0
+ File.should_receive(:exist?).with(path).and_return(true)
0
+ Kernel.should_receive(:load).with(path).and_return(:loaded)
0
+ @script.load(@file).should == :loaded
0
+ it "attemps to locate the file in 'spec'" do
0
+ path = File.join "spec", @file
0
+ File.should_receive(:exist?).with(path).and_return(true)
0
+ Kernel.should_receive(:load).with(path).and_return(:loaded)
0
+ @script.load(@file).should == :loaded
0
+describe MSpecScript, "#register" do
0
+ @script = MSpecScript.new
0
+ @formatter = mock("formatter", :null_object => true)
0
+ @script.config[:formatter] = @formatter
0
+ it "creates and registers the formatter" do
0
+ @formatter.should_receive(:new).and_return(@formatter)
0
+ @formatter.should_receive(:register)
0
describe MSpecScript, "#register" do
0
+ @script = MSpecScript.new
0
+ @formatter = mock("formatter", :null_object => true)
0
+ @script.config[:formatter] = @formatter
0
+ @filter = mock("filter")
0
+ @filter.should_receive(:register)
0
+ @ary = ["some", "spec"]
0
+ it "creates and registers a MatchFilter for include specs" do
0
+ MatchFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:includes] = @ary
0
+ it "creates and registers a MatchFilter for excluded specs" do
0
+ MatchFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:excludes] = @ary
0
+ it "creates and registers a RegexpFilter for include specs" do
0
+ RegexpFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:patterns] = @ary
0
+ it "creates and registers a RegexpFilter for excluded specs" do
0
+ RegexpFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:xpatterns] = @ary
0
+ it "creates and registers a TagFilter for include specs" do
0
+ TagFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:tags] = @ary
0
+ it "creates and registers a TagFilter for excluded specs" do
0
+ TagFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:xtags] = @ary
0
+ it "creates and registers a ProfileFilter for include specs" do
0
+ ProfileFilter.should_receive(:new).with(:include, *@ary).and_return(@filter)
0
+ @script.config[:profiles] = @ary
0
+ it "creates and registers a ProfileFilter for excluded specs" do
0
+ ProfileFilter.should_receive(:new).with(:exclude, *@ary).and_return(@filter)
0
+ @script.config[:xprofiles] = @ary
0
+ it "creates and registers a DebugAction for excluded specs" do
0
+ @script.config[:atags] = ["some"]
0
+ @script.config[:astrings] = ["string"]
0
+ DebugAction.should_receive(:new).with(["some"], ["string"]).and_return(@filter)
0
+ @script.config[:debugger] = true
0
+ it "creates and registers a GdbAction for excluded specs" do
0
+ @script.config[:atags] = ["some"]
0
+ @script.config[:astrings] = ["string"]
0
+ GdbAction.should_receive(:new).with(["some"], ["string"]).and_return(@filter)
0
+ @script.config[:gdb] = true
0
describe MSpecScript, "#signals" do
Comments
No one has commented yet.