Rspec + Oracle

View: New views
6 Messages — Rating Filter:   Alert me  

Rspec + Oracle

by shatorkin@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Rspec + Oracle

by David Chelimsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 5/15/07, shatorkin@... <shatorkin@...> wrote:
>
> Hi all.
> Does anybody use Rspec with Oracle? I have RoR app + Oracle DB. I use
> Rspec 0.9.4.

This would be better targeted at
http://rubyforge.org/mailman/listinfo/rspec-users. I'll answer this
one here, but please post further rspec questions to that list. You're
much more likely to get a response from people who have experienced
the same issues you have there.

> 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'"

That's odd. In release 0.9.4, kernel.rb has only 9 lines of code so
there should not be an error coming from line 12 if you are using that
version. Have you modified that file yourself?

>
> "@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.

What do you mean by "found some modifications"?

Also - 0.9.2 - is that a typo or are you using the 0.9.2 plugin with
the 0.9.4 gem? If so, that's a no-no. Please be sure to read
http://rspec.rubyforge.org/documentation/rails/install.html for more
information.

>
> 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?

There's no reason this shouldn't just work if you've installed rspec
correctly and you put the specs where rspec wants them (the example
above should be in spec/models/country_spec.rb). I'd re-install rspec
and rspec_on_rails (per
http://rspec.rubyforge.org/documentation/rails/install.html).

You can also run the examples with the -b switch and get a full backtrace.

If this doesn't help, feel free to follow up on the rspec list
(prefered) or in this thread. If you think there is a bug, please
report it to rspec's tracker:
http://rubyforge.org/tracker/?atid=3149&group_id=797&func=browse

Cheers,
David

> Thanks.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Rspec + Oracle

by shatorkin@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks

On 15 май, 16:08, "David Chelimsky" <dchelim...@...> wrote:

> On 5/15/07, shator...@... <shator...@...> wrote:
>
>
>
> > Hi all.
> > Does anybody use Rspec with Oracle? I have RoR app + Oracle DB. I use
> > Rspec 0.9.4.
>
> This would be better targeted athttp://rubyforge.org/mailman/listinfo/rspec-users. I'll answer this
> one here, but please post further rspec questions to that list. You're
> much more likely to get a response from people who have experienced
> the same issues you have there.
>
> > 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'"
>
> That's odd. In release 0.9.4, kernel.rb has only 9 lines of code so
> there should not be an error coming from line 12 if you are using that
> version. Have you modified that file yourself?
>
>
>
> > "@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.
>
> What do you mean by "found some modifications"?
>
> Also - 0.9.2 - is that a typo or are you using the 0.9.2 plugin with
> the 0.9.4 gem? If so, that's a no-no. Please be sure to readhttp://rspec.rubyforge.org/documentation/rails/install.htmlfor more
> information.
>
>
>
>
>
> > 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?
>
> There's no reason this shouldn't just work if you've installed rspec
> correctly and you put the specs where rspec wants them (the example
> above should be in spec/models/country_spec.rb). I'd re-install rspec
> and rspec_on_rails (perhttp://rspec.rubyforge.org/documentation/rails/install.html).
>
> You can also run the examples with the -b switch and get a full backtrace.
>
> If this doesn't help, feel free to follow up on the rspec list
> (prefered) or in this thread. If you think there is a bug, please
> report it to rspec's tracker:http://rubyforge.org/tracker/?atid=3149&group_id=797&func=browse
>
> Cheers,
> David
>
> > Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Rspec + Oracle

by shatorkin@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> That's odd. In release 0.9.4, kernel.rb has only 9 lines of code so
> there should not be an error coming from line 12 if you are using that
> version. Have you modified that file yourself?
I'm sorry
vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/kernel.rb:6: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.
>
> What do you mean by "found some modifications"?
I mean this - http://rubyforge.org/tracker/index.php?func=detail&aid=10577&group_id=797&atid=3149

 Thanks.I will use http://rubyforge.org/mailman/listinfo/rspec-users


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Rspec + Oracle

by shatorkin@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 :).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Rspec + Oracle

by Anthony Carlos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I believe the bug was posted by John Andrews, and it's still open as  
of yesterday.

RSpec bug [#10577] Rails with Oracle breaks 0.9.2
http://rubyforge.org/tracker/index.php?
func=detail&aid=10577&group_id=797&atid=3149

Your solution might help them!

Thanks,

-Anthony

On May 18, 2007, at 7:46 AM, shatorkin@... wrote:

>
> 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 :).
>
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---