Problems with RSpec

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

Problems with RSpec

by msturm10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm trying to run RSpec tests from within NetBeans 6.5, but for some reason it won't work as supposed.

I've installed the rspec, rspec-rails and rspec-generators gems and transformed my project to using rspec by left clicking on my project -> Generate.. -> rspec

This added a generators directory in my vendor dir of my RoR app and created a RSpec folder in Netbeans containing spec_helper.rb amongst other files and folders.



I've created one rspec test, but when trying to run this file using 'Run file' (as is supposed to work according to various tutorials and screencasts) I get the following error message:


Code:


/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- /Users/martin/Projects/ruby/BataApp/spec/../vendor/generators/rspec/lib/rspec_on_rails (MissingSourceFile)

        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'

        from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'

        from /Users/martin/Projects/ruby/BataApp/spec/spec_helper.rb:3





There are some other small problems too, for example, when running the rake task 'gems:install' using the rake task runner, it says that it can't finde the file rspec_rails.



I google'd a lot on all those errors and problems, but can't find a proper solution. I even get the feeling that there is some compatibility issue with newer RSpec releases and Netbeans 6.5. Is anybody using this combination? And if so, is it working?






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Hassan Schroeder-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Feb 2, 2009 at 10:32 AM, msturm10 <msturm@...> wrote:

> newer RSpec releases and Netbeans 6.5. Is anybody using this
> combination? And if so, is it working?

Yes, and yes :-)

`gem list --local rspec` :

rspec (1.1.11, 1.1.4)
rspec-rails (1.1.11)

Have you tried running your test from the command line? That's
what I usually do anyway, but it would help determine where the
problem is.

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Problems with RSpec

by msturm10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


This is my RSpec version (a bit newer apparently). I will try tomorrow morning to run my test from the command line (not at work right now).



gem list --local rspec



*** LOCAL GEMS ***



rspec (1.1.12, 0.5.15)

rspec-rails (1.1.12)

rspec_generator (0.5.15)






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Hassan Schroeder-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Feb 2, 2009 at 4:32 PM, msturm10 <msturm@...> wrote:
>
> This is my RSpec version (a bit newer apparently).

> rspec (1.1.12, 0.5.15)
> rspec-rails (1.1.12)

Heh. I upgraded to 1.1.12, and it broke big-time  :-)

In NetBeans I get "No tests executed" in the left panel and
-----------------------
[Using spec/spec.opts; create spec/spec.opts.netbeans to set options
used under the IDE. Suppress this warning message by adding
-J-Druby.rspec.specopts.warn=false to the flags in etc/netbeans.conf]

        from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/options.rb:111:in
`run_examples'
        from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/command_line.rb:9:in
`run'
        from /Users/hassan/projects/calendar/script/spec:5
Finished in  seconds

0 examples, 0 failures
-----------------------
in the right.

The tests still run properly from the command line, though, thankfully.
But it definitely appears to be an NB bug.

Caveat: My NB install is not at the latest patch level; will do that
this evening and test again.

> rspec_generator (0.5.15)

FWIW, I'm not using the above at all.

--
Hassan Schroeder ------------------------ hassan.schroeder@...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Hassan Schroeder-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Feb 2, 2009 at 5:10 PM, Hassan Schroeder
<hassan.schroeder@...> wrote:

>> rspec (1.1.12, 0.5.15)
>> rspec-rails (1.1.12)
>
> Heh. I upgraded to 1.1.12, and it broke big-time  :-)
>
> In NetBeans I get "No tests executed" in the left panel and
> -----------------------
> [Using spec/spec.opts; create spec/spec.opts.netbeans to set options
> used under the IDE. Suppress this warning message by adding
> -J-Druby.rspec.specopts.warn=false to the flags in etc/netbeans.conf]
>
>        from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/options.rb:111:in
> `run_examples'
>        from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/command_line.rb:9:in
> `run'
>        from /Users/hassan/projects/calendar/script/spec:5
> Finished in  seconds
>
> 0 examples, 0 failures
> -----------------------
> in the right.
>
> The tests still run properly from the command line, though, thankfully.
> But it definitely appears to be an NB bug.
>
> Caveat: My NB install is not at the latest patch level; will do that
> this evening and test again.

Updates installed, failure remains the same.

Platform detail:
Mac OS 10.5.5

ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

--
Hassan Schroeder ------------------------ hassan.schroeder@...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Erno Mononen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

Hassan Schroeder wrote:

> On Mon, Feb 2, 2009 at 5:10 PM, Hassan Schroeder
> <hassan.schroeder@...> wrote:
>
>  
>>> rspec (1.1.12, 0.5.15)
>>> rspec-rails (1.1.12)
>>>      
>> Heh. I upgraded to 1.1.12, and it broke big-time  :-)
>>
>> In NetBeans I get "No tests executed" in the left panel and
>> -----------------------
>> [Using spec/spec.opts; create spec/spec.opts.netbeans to set options
>> used under the IDE. Suppress this warning message by adding
>> -J-Druby.rspec.specopts.warn=false to the flags in etc/netbeans.conf]
>>
>>        from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/options.rb:111:in
>> `run_examples'
>>        from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/command_line.rb:9:in
>> `run'
>>        from /Users/hassan/projects/calendar/script/spec:5
>> Finished in  seconds
>>
>> 0 examples, 0 failures
>> -----------------------
>> in the right.
>>
>> The tests still run properly from the command line, though, thankfully.
>> But it definitely appears to be an NB bug.
>>
>> Caveat: My NB install is not at the latest patch level; will do that
>> this evening and test again.
>>    
>
> Updates installed, failure remains the same.
>
> Platform detail:
> Mac OS 10.5.5
>
> ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
>  

I think you're running into
http://www.netbeans.org/issues/show_bug.cgi?id=156839. You can patch NB
by downloading
http://hg.netbeans.org/main/file/d0d0c86837b0/ruby.testrunner/release/nb_rspec_mediator.rb 
and copying it into <nb install dir>/ruby2/. Unfortunately, there is
another issue with Rspec edge that I haven't yet had time to look at,
but with the patch 1.1.12 should work fine. Being forward compatible
with RSpec has proven to be rather difficult, but hopefully in 7.0 we'll
have a better solution RSpec integration.

Erno


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Problems with RSpec

by msturm10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ah, thanks guys! I'm glad that it's not just me having problems with Netbeans and Rails (I'm currently in the process of learning it, and was just having the feeling to understand everything a little bit until I stumbled upon this problem...). I will try the suggestions of Erno Mononen and will post my results here!






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Problems with RSpec

by msturm10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've applied the patch mentioned by Erno,  and it solved my problems! Thanks.



The only issue which I now have is that I don't see an obvious way to generate rspec models and controllers, and to make your project 'rspec aware' (running `ruby scripts/generate rspec`). This seems to be possible to do when you've installed rspec-generators in Netbeans, but the generated stuff by this gem is not really working. But I think I can live with that :)






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Hassan Schroeder-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Feb 3, 2009 at 2:18 AM, msturm10 <msturm@...> wrote:
>
> I've applied the patch mentioned by Erno,  and it solved my problems! Thanks.

Yep, confirm that solved the issue for me as well.

Thanks, Erno!

--
Hassan Schroeder ------------------------ hassan.schroeder@...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Erno Mononen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hassan Schroeder wrote:
> On Tue, Feb 3, 2009 at 2:18 AM, msturm10 <msturm@...> wrote:
>  
>> I've applied the patch mentioned by Erno,  and it solved my problems! Thanks.
>>    
>
> Yep, confirm that solved the issue for me as well.
>
> Thanks, Erno!
>  

Glad to hear it's working for both of you now. Thanks should go to
Richard Poirier though, he found the cause and provided a fix.

Cheers,
Erno


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Piergiuliano Bossi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Erno,

I'm using NetBeans 6.5.1 on a Mac OS/X 10.5.8, java 1.6.0_13, rspec 1.2.4, ruby MRI 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]

If I apply the patch that is mentioned here finally rspec files work in NB with MRI, but they give the following warning (one for every spec example):

*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from a future version of RSpec.


* ExampleProxy#backtrace is deprecated.
* please use ExampleProxy#location instead.
*****************************************************************

Is this still the recommended way to get around the problem or is there any update on this?

Thanks,
Giuliano

On Tue, Feb 3, 2009 at 11:02 AM, Erno Mononen <Erno.Mononen@...> wrote:
Hassan Schroeder wrote:
On Tue, Feb 3, 2009 at 2:18 AM, msturm10 <msturm@...> wrote:
 
I've applied the patch mentioned by Erno,  and it solved my problems! Thanks.
   

Yep, confirm that solved the issue for me as well.

Thanks, Erno!
 

Glad to hear it's working for both of you now. Thanks should go to Richard Poirier though, he found the cause and provided a fix.

Cheers,
Erno



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...




--
Piergiuliano Bossi
Coming soon... http://ThinkCode.TV
http://thinkingbox.wordpress.com/
http://twitter.com/thinkingbox
http://stacktrace.it

Re: Problems with RSpec

by Erno Mononen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Giuliano,

The deprecation warning is fixed in NB 6.7.1, so upgrading would solve
this. If you can't upgrade for any reason, I think just copying the
latest version of nb_rspec_mediator.rb to <nb_install_dir>/ruby2 may
work (but I haven't tested with 6.5). You can get the file from
http://hg.netbeans.org/main-silver/file/932e8b838a47/ruby.testrunner/release/nb_rspec_mediator.rb.
If that doesn't work, at least this version should:
http://hg.netbeans.org/main-silver/file/e08bb29ab793/ruby.testrunner/release/nb_rspec_mediator.rb.


Let me know if that doesn't help,
Erno

Piergiuliano Bossi wrote:

> Hi Erno,
>
> I'm using NetBeans 6.5.1 on a Mac OS/X 10.5.8, java 1.6.0_13, rspec
> 1.2.4, ruby MRI 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
>
> If I apply the patch that is mentioned here finally rspec files work
> in NB with MRI, but they give the following warning (one for every
> spec example):
>
> *****************************************************************
> DEPRECATION WARNING: you are using deprecated behaviour that will
> be removed from a future version of RSpec.
>
>
> * ExampleProxy#backtrace is deprecated.
> * please use ExampleProxy#location instead.
> *****************************************************************
>
> Is this still the recommended way to get around the problem or is
> there any update on this?
>
> Thanks,
> Giuliano
>
> On Tue, Feb 3, 2009 at 11:02 AM, Erno Mononen <Erno.Mononen@...
> <mailto:Erno.Mononen@...>> wrote:
>
>     Hassan Schroeder wrote:
>
>         On Tue, Feb 3, 2009 at 2:18 AM, msturm10 <msturm@...
>         <mailto:msturm@...>> wrote:
>          
>
>             I've applied the patch mentioned by Erno,  and it solved
>             my problems! Thanks.
>                
>
>
>         Yep, confirm that solved the issue for me as well.
>
>         Thanks, Erno!
>          
>
>
>     Glad to hear it's working for both of you now. Thanks should go to
>     Richard Poirier though, he found the cause and provided a fix.
>
>     Cheers,
>     Erno
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@...
>     <mailto:users-unsubscribe@...>
>     For additional commands, e-mail: users-help@...
>     <mailto:users-help@...>
>
>
>
>
> --
> Piergiuliano Bossi
> Coming soon... http://ThinkCode.TV
> http://thinkingbox.wordpress.com/
> http://twitter.com/thinkingbox
> http://stacktrace.it


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Problems with RSpec

by Piergiuliano Bossi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Sep 4, 2009 at 2:47 AM, Erno Mononen <Erno.Mononen@...> wrote:
Hi Giuliano,

The deprecation warning is fixed in NB 6.7.1, so upgrading would solve this. If you can't upgrade for any reason, I think just copying the latest version of nb_rspec_mediator.rb to <nb_install_dir>/ruby2 may work (but I haven't tested with 6.5). You can get the file from http://hg.netbeans.org/main-silver/file/932e8b838a47/ruby.testrunner/release/nb_rspec_mediator.rb. If that doesn't work, at least this version should: http://hg.netbeans.org/main-silver/file/e08bb29ab793/ruby.testrunner/release/nb_rspec_mediator.rb.


Thanks a lot. I'm in the middle of struggling with having a decent dev environment after a painful upgrade to snow leopard. When the situation will be stable I'll upgrade to NB 6.7.1.
 
Let me know if that doesn't help,

Sure.
Cheers
Giuliano


--
Piergiuliano Bossi
Coming soon... http://ThinkCode.TV
http://thinkingbox.wordpress.com/
http://twitter.com/thinkingbox
http://stacktrace.it