spec/spec/runner/options_spec.rb in rspec-1.1.12 vs spec/spec/runner/options_spec.rb in rspec-1.2.0

- old
+ new

@@ -310,9 +310,43 @@ @options.example_groups.should_not include(@example_group) end end describe "#run_examples" do + describe "with global predicate matchers" do + it "defines global predicate matcher methods on ExampleMethods" do + Spec::Runner.configuration.stub!(:predicate_matchers).and_return({:this => :that?}) + group = Class.new(::Spec::Example::ExampleGroupDouble).describe("Some Examples") + example = group.new("") + + @options.run_examples + example.this + end + + after(:each) do + Spec::Example::ExampleMethods.class_eval "undef :this" + end + end + + describe "with a mock framework defined as a Symbol" do + it "includes Spec::Adapters::MockFramework" do + Spec::Runner.configuration.stub!(:mock_framework).and_return('spec/adapters/mock_frameworks/rspec') + + Spec::Example::ExampleMethods.should_receive(:include).with(Spec::Adapters::MockFramework) + + @options.run_examples + end + end + + describe "with a mock framework defined as a Module" do + it "includes the module in ExampleMethods" do + mod = Module.new + Spec::Runner.configuration.stub!(:mock_framework).and_return(mod) + Spec::Example::ExampleMethods.should_receive(:include).with(mod) + @options.run_examples + end + end + describe "when not given a custom runner" do it "should use the standard" do runner = ::Spec::Runner::ExampleGroupRunner.new(@options) ::Spec::Runner::ExampleGroupRunner.should_receive(:new). with(@options).