# Rspec + Oracle

**URL:** <https://www.ruby-forum.com/t/rspec-oracle/121797>\
**Category:** Ruby\
**Created:** [May 15, 2007, 12:25pm UTC](https://www.ruby-forum.com/t/rspec-oracle/121797 "2007-05-15T12:25:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 15, 2007, 12:25pm UTC](https://www.ruby-forum.com/t/rspec-oracle/121797/1 "2007-05-15T12:25:59Z")

</div>

Hi all.  
Does anybody use Rspec with Oracle? I have RoR app + Oracle DB. I use  
Rspec 0.9.4.  
I have installed Rspec plugin and generated spec for model Country.  
If I use “@countries = Country.new” in my spec I get  
“ArgumentError in ‘Country should be valid’  
block not supplied  
/vendor/plugins/rspec\_on\_rails/lib/spec/rails/extensions/kernel.rb:  
12:in `describe’”

“@countries = Country.find(:first)” works but “@countries =  
Country.new” doesn’t work.

I have found some modifications for Rspec 0.9.2 in files  
“/vendor/plugins/rspec\_on\_rails/lib/spec/rails/extensions/kernel.rb”  
and  
“usr/lib/ruby/gems/1.8/gems/rspec-0.9.4/lib/spec/runner/extensions/  
kernel.rb”  
but those modifications have not helped me.

This is my spec:  
"  
require File.dirname( **FILE** ) + ‘/…/spec\_helper’  
describe Country do  
before(:each) do  
@countries = Country.new

# @countries = Country.find(:first)

end

it “should be valid” do  
@countries.should be\_valid  
end  
end  
"  
Does anybody know how I can use method “new” of model in my Rspec’s  
files with Oracle?  
Thanks.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 18, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/rspec-oracle/121797/2 "2007-05-18T13:51:06Z")

</div>

I make work rspec with oracle.  
I have a spec what contains Model.find(1) cause (record with id=1  
exists in the table).  
Model.find(:first) works well

Spec uses method “instance\_eval” where name of ruby file and row  
number are passed as parameter.  
When script invokes “describe” method of OCI8 Class  
(oracle\_adapter.rb) it is failed with error message “block not  
supplied”.  
When I added an alias: “alias\_method :my\_describe,:describe” and  
called ‘my\_describe’ instead of ‘describe’ spec did work well.  
Whose is this bug - ruby,spec, or oracle\_adapter I have not known  
yet :).
