You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Dan King <da...@yahoo.com> on 2011/06/01 02:28:11 UTC

Re: Possible to Test Groovy Code with RSpec/JRuby?

> Just require 'buildr/groovy', put your groovy files under  src/main/groovy

Do you know why buildr pulls in groovy 1.7.5 even though I set the buildfile to 
pull version 1.8.0 via:

GROOVY = transitive('org.codehaus.groovy:groovy:jar:1.8.0')
compile.with GROOVY

> and your rspec files under src/test/spec 

Did you mean src/spec? 

> One word of caution, though, the integration is fragile  because JRuby and
> RSpec have been moving targets and I don't think many  people have been using
> RSpec to test Java/Groovy stuff.   The code is  good but it's heavily
> dependent on the environment configuration being right  -- I believe the
> magic combination is JRuby v1.5.6, RSpec 2.1.0, with the  jruby 0.1 gem
> installed.

Thanks for the warning; so far it 'works,' but should it start to get 
troublesome, I'll probably switch over to easyb.

-Dan

Re: Possible to Test Groovy Code with RSpec/JRuby?

Posted by Dan King <da...@yahoo.com>.
> You have to override the plugin's default version;  otherwise you're just

> adding yet-another-version of Groovy on the classpath  (a sure recipe for
> failure!).  Instead, add the following near the top  of your buildfile:
 
> Buildr::Groovy::Groovyc::REQUIRES.groovy.version =  '1.8.0'

Was this information available in buildr's documentation? I searched for a while 
yesterday and didn't find anything.

> Unfortunately, I wouldn't qualify the easyb  integration as easier to work
> with... if you get into trouble, I'd rather fix  the rspec integration
> (assuming that's your preferred option).

I'll keep that in mind and yes, RSpec is my preferred option.

Speaking of options, do you know how to pass options to RSpec? The "Languages" 
section of the documentation states that I can use the :format option, but it 
does not state how to. I assumed I had to use -- test.using :format => ['doc'] 
-- but that didn't work. 


Lastly, when I run -- buildr test -- the reports directory (under the project 
root directory) always contains an empty (0 bytes) file whereas the reports 
directory under target contains a yaml file that indicates which *_spec files 
passed/failed. From buildr's documentation I thought that the 
/project-root/reports directory would, by default, contain an html 
representation of the test results. Am I mistaken?

Thanks for all the clarifications; I appreciate it.

Best,
Dan


Re: Possible to Test Groovy Code with RSpec/JRuby?

Posted by Alex Boisvert <al...@gmail.com>.
On Tue, May 31, 2011 at 5:28 PM, Dan King <da...@yahoo.com> wrote:

> > Just require 'buildr/groovy', put your groovy files under
>  src/main/groovy
>
> Do you know why buildr pulls in groovy 1.7.5 even though I set the
> buildfile to
> pull version 1.8.0 via:
>
> GROOVY = transitive('org.codehaus.groovy:groovy:jar:1.8.0')
> compile.with GROOVY
>

You have to override the plugin's default version; otherwise you're just
adding yet-another-version of Groovy on the classpath (a sure recipe for
failure!).  Instead, add the following near the top of your buildfile:

Buildr::Groovy::Groovyc::REQUIRES.groovy.version = '1.8.0'

> and your rspec files under src/test/spec
>
> Did you mean src/spec?
>

Yes, sorry.


> > One word of caution, though, the integration is fragile  because JRuby
> and
> > RSpec have been moving targets and I don't think many  people have been
> using
> > RSpec to test Java/Groovy stuff.   The code is  good but it's heavily
> > dependent on the environment configuration being right  -- I believe the
> > magic combination is JRuby v1.5.6, RSpec 2.1.0, with the  jruby 0.1 gem
> > installed.
>
> Thanks for the warning; so far it 'works,' but should it start to get
> troublesome, I'll probably switch over to easyb.
>

Unfortunately, I wouldn't qualify the easyb integration as easier to work
with... if you get into trouble, I'd rather fix the rspec integration
(assuming that's your preferred option).

good luck,
alex