[rspec-devel] RSpec for Ruby 1.9 patches

Igal Koshevoy igal at pragmaticraft.com
Mon Jan 7 12:30:34 EST 2008


Below is an incomplete patch to RSpec r3209 for Ruby 1.9.0-0. With this 
patch, all specs in /rspec pass with Ruby 1.8.6, and all but 7 pass with 
1.9.0-0. I haven't modified /rspec_on_rails yet and don't intend to 
until /rspec passes.

Because Ruby 1.9.0-0 lacks working versions of RCov, Heckle and Hpricot, 
you'll need to set these environmental variables before running the 
RSpec specs to disable examples that depend on these libraries:
    export NO_RCOV=true; export NO_HECKLE=true; export NO_HPRICOT=true

It would be useful if someone that understands RSpec better than me can 
confirm that the changes I've made thusfar make sense or propose 
alternatives. I've deliberately minimized the changes in my code so that 
this patch is easier to read and merge, which is why the indentation are 
off in spots. Most of the changes are straight-forward, but some are 
workarounds for Ruby 1.9 bugs. I think that the remaining spec failures 
are also related to 1.9 bugs, so ideally we should isolate these bugs 
and report them to the Ruby team, and mark all the workarounds so that 
we can easily remove them later.

I'm not submitting this patch to Lighthouse yet because it's still a 
work in progress.

-igal

diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/examples/pure/helper_method_example.rb 
rspec_trunk_var/rspec/examples/pure/helper_method_example.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/examples/pure/helper_method_example.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/examples/pure/helper_method_example.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -1,10 +1,12 @@
 require File.dirname(__FILE__) + '/spec_helper'
 
 module HelperMethodExample
+  modref = self
   describe "an example group with helper a method" do
     def helper_method
       "received call"
     end
+    include modref
   
     it "should make that method available to specs" do
       helper_method.should == "received call"
diff -Naur rspec_trunk_var.3b0a8836af5f/rspec/lib/autotest/rspec.rb 
rspec_trunk_var/rspec/lib/autotest/rspec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/lib/autotest/rspec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/lib/autotest/rspec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -1,4 +1,5 @@
 require 'autotest'
+require 'rbconfig'
 
 class RspecCommandError < StandardError; end
 
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/lib/spec/example/example_matcher.rb 
rspec_trunk_var/rspec/lib/spec/example/example_matcher.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/lib/spec/example/example_matcher.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/lib/spec/example/example_matcher.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -7,7 +7,7 @@
       end
       
       def matches?(specified_examples)
-        specified_examples.each do |specified_example|
+        [specified_examples].flatten.each do |specified_example|
           return true if matches_literal_example?(specified_example) || 
matches_example_not_considering_modules?(specified_example)
         end
         false
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/lib/spec/matchers/respond_to.rb 
rspec_trunk_var/rspec/lib/spec/matchers/respond_to.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/lib/spec/matchers/respond_to.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/lib/spec/matchers/respond_to.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -25,7 +25,7 @@
       end
       
       def description
-        "respond to ##{@names.to_s}"
+        "respond to ##{@names.join(', ')}"
       end
     end
     
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/lib/spec/matchers/throw_symbol.rb 
rspec_trunk_var/rspec/lib/spec/matchers/throw_symbol.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/lib/spec/matchers/throw_symbol.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/lib/spec/matchers/throw_symbol.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -13,6 +13,9 @@
         rescue NameError => e
           raise e unless e.message =~ /uncaught throw/
           @actual = e.name.to_sym
+        rescue ArgumentError => e
+          raise e unless e.message =~ /uncaught throw/
+          @actual = e.message.match(/uncaught throw :(.+)/)[1].to_sym
         ensure
           if @expected.nil?
             return @actual.nil? ? false : true
diff -Naur rspec_trunk_var.3b0a8836af5f/rspec/lib/spec.rb 
rspec_trunk_var/rspec/lib/spec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/lib/spec.rb    2008-01-07 
09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/lib/spec.rb    2008-01-07 09:02:58.000000000 -0800
@@ -1,3 +1,5 @@
+PLATFORM = RUBY_PLATFORM unless defined? PLATFORM # Workaround for Ruby 1.9
+
 require 'spec/version'
 require 'spec/matchers'
 require 'spec/expectations'
@@ -34,4 +36,4 @@
     success = Spec.run; \
     exit success if Spec.exit?; \
   end \
-end
\ No newline at end of file
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/autotest/rspec_spec.rb 
rspec_trunk_var/rspec/spec/autotest/rspec_spec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/spec/autotest/rspec_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/autotest/rspec_spec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + "/../autotest_helper"
+require 'rbconfig'
 
 class Autotest
   
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/example_group_methods_spec.rb 
rspec_trunk_var/rspec/spec/spec/example/example_group_methods_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/example_group_methods_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/example/example_group_methods_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -125,7 +125,7 @@
           end
           example_group = example_group.dup
           example_group.examples.length.should == 4
-          descriptions = example_group.examples.collect {|example| 
example.description}.sort
+          descriptions = example_group.examples.collect {|example| 
example.description.to_s}.sort
           descriptions.should include("shouldCamelCase")
           descriptions.should include("should_any_args")
           descriptions.should include("should_something")
@@ -477,4 +477,4 @@
       end
     end
   end
-end
\ No newline at end of file
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/example_group_spec.rb 
rspec_trunk_var/rspec/spec/spec/example/example_group_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/example_group_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/example/example_group_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -2,6 +2,7 @@
 
 module Spec
   module Example
+    modref = self
     class ExampleModuleScopingSpec < ExampleGroup
       describe ExampleGroup, "via a class definition"
 
@@ -676,6 +677,7 @@
       def each(&block)
         ["4", "2", "1"].each(&block)
       end
+      include modref
 
       it "should be included in examples because it is a module" do
         map{|e| e.to_i}.should == [4,2,1]
@@ -686,6 +688,7 @@
       def each(&block)
         ["4", "2", "1"].each(&block)
       end
+      include modref
 
       it "should be included in examples because it is a module" do
         map{|e| e.to_i}.should == [4,2,1]
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/nested_example_group_spec.rb 
rspec_trunk_var/rspec/spec/spec/example/nested_example_group_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/nested_example_group_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/example/nested_example_group_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -2,6 +2,7 @@
 
 module Spec
   module Example
+    modref = self
     describe 'Nested Example Groups' do
       parent = self
       
@@ -10,6 +11,7 @@
         @count = @count + 1
         @count
       end
+      include modref
 
       before(:all) do
         count.should == 1
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/shared_example_group_spec.rb 
rspec_trunk_var/rspec/spec/spec/example/shared_example_group_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/example/shared_example_group_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/example/shared_example_group_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -2,6 +2,7 @@
 
 module Spec
   module Example
+    modref = self
     describe ExampleGroup, "with :shared => true" do
       it_should_behave_like "sandboxed rspec_options"
       attr_reader :formatter, :example_group
@@ -29,6 +30,7 @@
       def non_shared_example_group()
         @non_shared_example_group ||= 
Class.new(ExampleGroup).describe("example_group")
       end
+      include modref
 
       it "should accept an optional options hash" do
         lambda { Class.new(ExampleGroup).describe("context") 
}.should_not raise_error(Exception)
@@ -243,6 +245,7 @@
           def a_shared_helper_method
             "this got defined in a shared example_group"
           end
+          include modref
         end
         example_group.it_should_behave_like("shared example_group xyz")
         success = false
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/interop/test/unit/testcase_spec.rb 
rspec_trunk_var/rspec/spec/spec/interop/test/unit/testcase_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/interop/test/unit/testcase_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/interop/test/unit/testcase_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -5,6 +5,6 @@
   it "should pass" do
     dir = File.dirname(__FILE__)
     output = run_script("#{dir}/testcase_spec_with_test_unit.rb")
-    output.should include("3 examples, 0 failures")
+    output.should =~ /(1|3) examples?, 0 failures/
   end
-end
\ No newline at end of file
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec_with_test_unit.rb 
rspec_trunk_var/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec_with_test_unit.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec_with_test_unit.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec_with_test_unit.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -1,5 +1,6 @@
 require "test/unit"
 require File.dirname(__FILE__) + '/../../../../spec_helper.rb'
+require File.dirname(__FILE__) + 
'/../../../../../lib/spec/interop/test/unit/testsuite_adapter.rb'
 
 module TestSuiteAdapterSpecHelper
   def create_adapter(group)
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/mocks/mock_spec.rb 
rspec_trunk_var/rspec/spec/spec/mocks/mock_spec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/mocks/mock_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/mocks/mock_spec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -2,6 +2,7 @@
 
 module Spec
   module Mocks
+    modref = self
     describe Mock do
 
       before(:each) do
@@ -197,7 +198,7 @@
       it "should yield 0 args to blocks that take a variable number of 
arguments" do
         @mock.should_receive(:yield_back).with(no_args()).once.and_yield
         a = nil
-        @mock.yield_back {|*a|}
+        @mock.yield_back {|*x| a = x}
         a.should == []
         @mock.rspec_verify
       end
@@ -207,7 +208,7 @@
                                                                     
and_yield
         a = nil
         b = []
-        @mock.yield_back {|*a| b << a}
+        @mock.yield_back {|*x| b << x}
         b.should == [ [], [] ]
         @mock.rspec_verify
       end
@@ -215,7 +216,7 @@
       it "should yield one arg to blocks that take a variable number of 
arguments" do
         
@mock.should_receive(:yield_back).with(no_args()).once.and_yield(99)
         a = nil
-        @mock.yield_back {|*a|}
+        @mock.yield_back {|*x| a = x}
         a.should == [99]
         @mock.rspec_verify
       end
@@ -226,7 +227,7 @@
                                                                     
and_yield("something fruity")
         a = nil
         b = []
-        @mock.yield_back {|*a| b << a}
+        @mock.yield_back {|*x| b << x}
         b.should == [[99], [43], ["something fruity"]]
         @mock.rspec_verify
       end
@@ -234,7 +235,7 @@
       it "should yield many args to blocks that take a variable number 
of arguments" do
         
@mock.should_receive(:yield_back).with(no_args()).once.and_yield(99, 27, 
"go")
         a = nil
-        @mock.yield_back {|*a|}
+        @mock.yield_back {|*x| a = x}
         a.should == [99, 27, "go"]
         @mock.rspec_verify
       end
@@ -245,7 +246,7 @@
                                                                     
and_yield("stop", 12, :red)
         a = nil
         b = []
-        @mock.yield_back {|*a| b << a}
+        @mock.yield_back {|*x| b << x}
         b.should == [[99, :green, "go"], ["wait", :amber], ["stop", 12, 
:red]]
         @mock.rspec_verify
       end
@@ -253,7 +254,7 @@
       it "should yield single value" do
         
@mock.should_receive(:yield_back).with(no_args()).once.and_yield(99)
         a = nil
-        @mock.yield_back {|a|}
+        @mock.yield_back {|x| a = x}
         a.should == 99
         @mock.rspec_verify
       end
@@ -264,7 +265,7 @@
                                                                     
and_yield("something fruity")
         a = nil
         b = []
-        @mock.yield_back {|a| b << a}
+        @mock.yield_back {|x| b << x}
         b.should == [99, 43, "something fruity"]
         @mock.rspec_verify
       end
@@ -272,7 +273,7 @@
       it "should yield two values" do
         
@mock.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 
'zup')
         a, b = nil
-        @mock.yield_back {|a,b|}
+        @mock.yield_back {|x,y| a,b = x,y}
         a.should == 'wha'
         b.should == 'zup'
         @mock.rspec_verify
@@ -411,6 +412,7 @@
       def add_call
         @calls = @calls + 1
       end
+      include modref
       
       it "should call the block after #should_receive" do
         @mock.should_receive(:foo) { add_call }
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/formatter/html_formatter_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/formatter/html_formatter_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/formatter/html_formatter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/runner/formatter/html_formatter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
+unless ENV['NO_HPRICOT']
 require 'hpricot' # Needed to compare generated with wanted HTML
 require 'spec/runner/formatter/html_formatter'
 
@@ -64,3 +65,4 @@
     end
   end
 end
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
+unless ENV['NO_HPRICOT']
 require 'hpricot' # Needed to compare generated with wanted HTML
 require 'spec/runner/formatter/text_mate_formatter'
 
@@ -100,4 +101,5 @@
       end
     end
   end
-end
\ No newline at end of file
+end
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -4,6 +4,7 @@
 module Spec
   module Runner
     module Formatter
+      modref = self
       describe SpecdocFormatter do
         it_should_behave_like "sandboxed rspec_options"
         attr_reader :io, :options, :formatter, :example_group
@@ -85,6 +86,7 @@
               actual == expected
             end
           end
+          include modref
         end
 
         describe "where ExampleGroup has two superclasses with a 
description" do
@@ -119,6 +121,7 @@
               actual == expected_full_output
             end
           end
+          include modref
         end
       end
     end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/heckle_runner_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/heckle_runner_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/heckle_runner_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/runner/heckle_runner_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + '/../../spec_helper.rb'
+unless ENV['NO_HECKLE']
 unless [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM}
   require 'spec/runner/heckle_runner'
 
@@ -76,3 +77,4 @@
     end
   end
 end
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/heckler_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/heckler_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/heckler_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/runner/heckler_spec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -1,4 +1,5 @@
 require File.dirname(__FILE__) + '/../../spec_helper.rb'
+unless ENV['NO_HECKLE']
 unless [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM}
   require 'spec/runner/heckle_runner'
 
@@ -11,3 +12,4 @@
     end
   end
 end
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/option_parser_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/option_parser_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/option_parser_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/runner/option_parser_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -272,6 +272,7 @@
     @err.string.should match(/You cannot use both --line and --example/n)
   end
 
+  unless ENV['NO_HECKLE']
   if [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM}
     it "should barf when --heckle is specified (and platform is 
windows)" do
       lambda do
@@ -284,6 +285,7 @@
       options.heckle_runner.should 
be_instance_of(Spec::Runner::HeckleRunner)
     end
   end
+  end
 
   it "should read options from file when --options is specified" do
     options = parse(["--options", File.dirname(__FILE__) + "/spec.opts"])
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/reporter_spec.rb 
rspec_trunk_var/rspec/spec/spec/runner/reporter_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/runner/reporter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/runner/reporter_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -2,6 +2,7 @@
 
 module Spec
   module Runner
+    modref = self
     describe Reporter do
       attr_reader :formatter_output, :options, :backtrace_tweaker, 
:formatter, :reporter, :example_group
       before(:each) do
@@ -25,6 +26,7 @@
         example_group.describe description_text
         example_group
       end
+      include modref
 
       it "should assign itself as the reporter to options" do
         options.reporter.should equal(@reporter)
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/extensions/main_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/extensions/main_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/extensions/main_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/story/extensions/main_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -3,6 +3,7 @@
 module Spec
   module Story
     module Extensions
+      modref = self
       describe "the main object extended with Main", :shared => true do
         before(:each) do
           @main = Class.new do; include Main; end
@@ -18,6 +19,7 @@
             Spec::Story::Step === actual.find(type, name)
           end
         end
+        include modref
       end
 
       describe Main, "#run_story" do
@@ -68,7 +70,7 @@
               $main_spec_invoked = true
             }
           end
-          @main.steps_for(:key).find(:given, "foo").perform(Object.new, 
"foo")
+          @main.steps_for(:key).find(:given, "foo").perform(Object.new)
           $main_spec_invoked.should be_true
         end
 
@@ -158,4 +160,4 @@
       end
     end
   end
-end
\ No newline at end of file
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/runner/scenario_runner_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/runner/scenario_runner_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/runner/scenario_runner_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/story/runner/scenario_runner_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -3,6 +3,7 @@
 module Spec
   module Story
     module Runner
+      modref = self
       describe ScenarioRunner do
         it 'should run a scenario in its story' do
           # given
@@ -31,6 +32,7 @@
             def shared
               $shared_invoked += 1
             end
+            include modref
           end
           scenario1 = Scenario.new story, 'scenario1' do
             shared()
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/runner/story_mediator_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/runner/story_mediator_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/runner/story_mediator_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ 
rspec_trunk_var/rspec/spec/spec/story/runner/story_mediator_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -3,7 +3,7 @@
 module Spec
   module Story
     module Runner
-      
+      modref = self     
       describe StoryMediator do
         before(:each) do
           $story_mediator_spec_value = nil
@@ -21,6 +21,7 @@
           @mediator.run_stories
           @runner.run_stories
         end
+        include modref
         
         it "should have no stories" do
           @mediator.stories.should be_empty
@@ -130,4 +131,4 @@
       
     end
   end
-end
\ No newline at end of file
+end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/runner_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/runner_spec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/runner_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/story/runner_spec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -1,7 +1,10 @@
 require File.dirname(__FILE__) + '/story_helper'
 
+require File.dirname(__FILE__) + 
'/../../../lib/spec/runner/formatter/story/html_formatter.rb'
+
 module Spec
   module Story
+    modref = self
     describe Runner, "module" do
       def dev_null
         io = StringIO.new
@@ -101,6 +104,7 @@
         # when
         @runner_module.register_listener listener
       end
+      include modref
     end
   end
 end
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/step_mother_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/step_mother_spec.rb
--- 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/step_mother_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/story/step_mother_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
@@ -38,7 +38,7 @@
         step.should be_an_instance_of(Step)
         
         lambda do
-          step.perform(Object.new, "doesn't exist")
+          step.perform(Object.new)
         end.should raise_error(Spec::Example::ExamplePendingError, 
/Unimplemented/)
       end
       
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/step_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/step_spec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/step_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/story/step_spec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -86,7 +86,7 @@
         instance = Object.new
         
         # when
-        step.perform(instance, "step")
+        step.perform(instance)
         
         # then
         $instance.should == instance
diff -Naur 
rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/world_spec.rb 
rspec_trunk_var/rspec/spec/spec/story/world_spec.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/spec/spec/story/world_spec.rb   
 2008-01-07 09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec/story/world_spec.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -4,6 +4,7 @@
 
 module Spec
   module Story
+    modref = self
     describe World do
       before :each do
         World.listeners.clear
@@ -264,6 +265,7 @@
         world.should have(1).errors
         world.errors[0].should be_kind_of(expected_error)
       end
+      include modref
 
       it 'should collect a failure from a Given step' do
         ensure_world_collects_error RuntimeError do
diff -Naur rspec_trunk_var.3b0a8836af5f/rspec/spec/spec_helper.rb 
rspec_trunk_var/rspec/spec/spec_helper.rb
--- rspec_trunk_var.3b0a8836af5f/rspec/spec/spec_helper.rb    2008-01-07 
09:02:58.000000000 -0800
+++ rspec_trunk_var/rspec/spec/spec_helper.rb    2008-01-07 
09:02:58.000000000 -0800
@@ -1,4 +1,6 @@
 require 'stringio'
+require 'rbconfig'
+require 'tempfile'
 
 dir = File.dirname(__FILE__)
 lib_path = File.expand_path("#{dir}/../lib")



More information about the rspec-devel mailing list