Rspec + Oracle

Discussion in 'Ruby' started by shatorkin@gmail.com, May 15, 2007.

  1. Guest

    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.
     
    , May 15, 2007
    #1
    1. Advertising

  2. Guest

    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 :).
     
    , May 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vaidas gudas
    Replies:
    1
    Views:
    462
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2004
  2. David Chelimsky
    Replies:
    0
    Views:
    120
    David Chelimsky
    Sep 15, 2009
  3. David Chelimsky
    Replies:
    0
    Views:
    122
    David Chelimsky
    Oct 3, 2010
  4. David Chelimsky
    Replies:
    0
    Views:
    114
    David Chelimsky
    Oct 10, 2010
  5. Feyruz
    Replies:
    4
    Views:
    2,259
    Sherm Pendley
    Oct 14, 2005
Loading...

Share This Page