[rspec-devel] [ rspec-Bugs-10577 ] Rails with Oracle breaks 0.9.2
noreply at rubyforge.org
noreply at rubyforge.org
Fri May 4 11:57:40 EDT 2007
Bugs item #10577, was opened at 2007-05-04 11:57
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=10577&group_id=797
Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: John Andrews (jandrews)
Assigned to: Nobody (None)
Summary: Rails with Oracle breaks 0.9.2
Initial Comment:
Upgrading to rspec 0.9.2 from 0.8.2 using Oracle database with ActiveRecord breaks due to the following:
oracle_adapter.rb:316
(owner, table_name) = @connection.describe(table_name)
@connection is an instance of OCI8AutoRecover which itself delegates the describe method to OCI8.
class OCI8AutoRecover < DelegateClass(OCI8)
#...
# no def describe method
end
DelegateClass internally uses method_missing to call the delegate class' describe
class OCI8 #:nodoc:
def describe(name)
#...
end
#...
end
The problem is that rspec defines Kernel#describe, so method_missing never catches the call to delegate and it fails from rspec because there is obviously no block given.
My work-around modifies 2 files. I will just include the methods I changed because I don't have diffs from trunk.
from file: rspec_on_rails/lib/spec/rails/extensions/kernel.rb
def describe(*args, &block)
# assuming that if a block is not given that it is not a call
# for rspec
if block_given?
args << {} unless Hash === args.last
args.last[:spec_path] = caller(0)[1]
end
original_describe(*args, &block)
end
from file: rspec-0.9.2/lib/spec/runner/extensions/kernel.rb
def describe(*args, &block)
if block_given?
raise ArgumentError if args.empty?
register_behaviour(Spec::DSL::BehaviourFactory.create(*args, &block))
else
# not the describe that we are looking for
# it's probably a call from the oracle adapter
super *args
end
end
I don't know if this is the best way to fix the issue, but it works for me and all my specs pass again. if you need more info or someone to test a fix for Oracle I am able to help.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=10577&group_id=797
More information about the rspec-devel
mailing list