Peter Fitzgibbons
2008-Apr-05 04:28 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
Hello all, I have the RSpec sample in ./rspec_bowling, with... ./rspec_bowling/lib/bowling.rb ./rspec_bowling/spec/spec.opts ./rspec_bowling/spec/bowling_spec.rb when I autotest, I get this: $autotest loading autotest/rspec /usr/local/bin/ruby -S /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec -O spec/spec.opts spec/spec_helper.rb spec/bowling_spec.rb F 1) ArgumentError in ''Bowling should score 0 for gutter game'' wrong number of arguments (1 for 0) [..snip..] Finished in 0.254 seconds 1 example, 1 failure /usr/local/bin/ruby -S /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec -O spec/spec.opts spec/bowling_spec.rb *./spec/bowling_spec.rb:3:in `require'': no such file to load -- bowling (LoadError) * from ./spec/bowling_spec.rb:3 My RUBYPATH = ../lib:./lib:$PATH, which caused autotest to load the 1st run correctly. Could someone help me understand how to correctly set the search path for repeated loading under autotest ? Thanks! -- Peter Fitzgibbons ------------------------------ iPhone -- "IT"-ness. hrefhttp://www.macdailynews.com/index.php/weblog/comments/apples_iphone_could_become_iconic_it_object ------------------------------ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080404/bdcff836/attachment.html
David Chelimsky
2008-Apr-05 04:38 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
On Apr 5, 2008, at 12:28 AM, "Peter Fitzgibbons" <peter.fitzgibbons at gmail.com > wrote:> Hello all, > > I have the RSpec sample in ./rspec_bowling, with... > ./rspec_bowling/lib/bowling.rb > ./rspec_bowling/spec/spec.opts > ./rspec_bowling/spec/bowling_spec.rb > > when I autotest, I get this: > $autotest > loading autotest/rspec > /usr/local/bin/ruby -S /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/ > bin/spec -O spec/spec.opts spec/spec_helper.rb spec/bowling_spec.rb > F > > 1) > ArgumentError in ''Bowling should score 0 for gutter game'' > wrong number of arguments (1 for 0) > [..snip..]This is the error - no path problem. There is a method expecting no arguments that is being called with one. HTH, David> > Finished in 0.254 seconds > > 1 example, 1 failure > /usr/local/bin/ruby -S /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/ > bin/spec -O spec/spec.opts spec/bowling_spec.rb > ./spec/bowling_spec.rb:3:in `require'': no such file to load -- > bowling (LoadError) > from ./spec/bowling_spec.rb:3 > > My RUBYPATH = ../lib:./lib:$PATH, which caused autotest to load the > 1st run correctly. > > Could someone help me understand how to correctly set the search > path for repeated loading under autotest ? > > Thanks! > > > -- > Peter Fitzgibbons > ------------------------------ > iPhone -- "IT"-ness. > href=http://www.macdailynews.com/index.php/weblog/comments/apples_iphone_could_become_iconic_it_object > ------------------------------ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080405/893beee1/attachment.html
Scott Taylor
2008-Apr-05 05:03 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
On Apr 5, 2008, at 12:38 AM, David Chelimsky wrote:> On Apr 5, 2008, at 12:28 AM, "Peter Fitzgibbons" <peter.fitzgibbons at gmail.com > > wrote: > >> Hello all, >> >> I have the RSpec sample in ./rspec_bowling, with... >> ./rspec_bowling/lib/bowling.rb >> ./rspec_bowling/spec/spec.opts >> ./rspec_bowling/spec/bowling_spec.rb >> >> when I autotest, I get this: >> $autotest >> loading autotest/rspec >> /usr/local/bin/ruby -S /usr/local/lib/ruby/gems/1.8/gems/ >> rspec-1.1.3/bin/spec -O spec/spec.opts spec/spec_helper.rb spec/ >> bowling_spec.rb >> F >> >> 1) >> ArgumentError in ''Bowling should score 0 for gutter game'' >> wrong number of arguments (1 for 0) >> [..snip..] > > This is the error - no path problem. There is a method expecting no > arguments that is being called with one. > > HTH, > DavidSure - that test fails - but why do we see the next result? (see below) What is rails doing in the background? Scott> > > >> >> Finished in 0.254 seconds >> >> 1 example, 1 failure >> /usr/local/bin/ruby -S /usr/local/lib/ruby/gems/1.8/gems/ >> rspec-1.1.3/bin/spec -O spec/spec.opts spec/bowling_spec.rb >> ./spec/bowling_spec.rb:3:in `require'': no such file to load -- >> bowling (LoadError) >> from ./spec/bowling_spec.rb:3 >> >> My RUBYPATH = ../lib:./lib:$PATH, which caused autotest to load the >> 1st run correctly. >> >> Could someone help me understand how to correctly set the search >> path for repeated loading under autotest ? >> >> Thanks! >> >> >> -- >> Peter Fitzgibbons >> ------------------------------ >> iPhone -- "IT"-ness. >> href=http://www.macdailynews.com/index.php/weblog/comments/apples_iphone_could_become_iconic_it_object >> ------------------------------ >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080405/cf7be1f9/attachment-0001.html
Peter Fitzgibbons
2008-Apr-05 11:08 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
On Sat, Apr 5, 2008 at 12:03 AM, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > On Apr 5, 2008, at 12:38 AM, David Chelimsky wrote: > > On Apr 5, 2008, at 12:28 AM, "Peter Fitzgibbons" < > peter.fitzgibbons at gmail.com> wrote: > > Hello all, > > I have the RSpec sample in ./rspec_bowling, with... > ./rspec_bowling/lib/bowling.rb > ./rspec_bowling/spec/spec.opts > ./rspec_bowling/spec/bowling_spec.rb > > when I autotest, I get this: > $autotest > loading autotest/rspec > /usr/local/bin/ruby -S > /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec -O spec/spec.opts > spec/spec_helper.rb spec/bowling_spec.rb > F > > 1) > ArgumentError in ''Bowling should score 0 for gutter game'' > wrong number of arguments (1 for 0) > [..snip..] > > > This is the error - no path problem. There is a method expecting no > arguments that is being called with one. > > HTH, > David > > > Sure - that test fails - but why do we see the next result? (see below) > What is rails doing in the background? > > Scott >This is not a rails app, it''s standalone ruby. And yes, as I highlighted,the interesting bit is the second run where instead ''require'' fails. Thanks in advance for further discussion! Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080405/8cfff371/attachment.html
Peter Fitzgibbons
2008-Apr-05 15:42 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
On Sat, Apr 5, 2008 at 6:08 AM, Peter Fitzgibbons < peter.fitzgibbons at gmail.com> wrote:> > On Sat, Apr 5, 2008 at 12:03 AM, Scott Taylor < > mailing_lists at railsnewbie.com> wrote: > > > > > On Apr 5, 2008, at 12:38 AM, David Chelimsky wrote: > > > > On Apr 5, 2008, at 12:28 AM, "Peter Fitzgibbons" < > > peter.fitzgibbons at gmail.com> wrote: > > > > Hello all, > > > > I have the RSpec sample in ./rspec_bowling, with... > > ./rspec_bowling/lib/bowling.rb > > ./rspec_bowling/spec/spec.opts > > ./rspec_bowling/spec/bowling_spec.rb > > > > when I autotest, I get this: > > $autotest > > loading autotest/rspec > > /usr/local/bin/ruby -S > > /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec -O spec/spec.opts > > spec/spec_helper.rb spec/bowling_spec.rb > > F > > > > 1) > > ArgumentError in ''Bowling should score 0 for gutter game'' > > wrong number of arguments (1 for 0) > > [..snip..] > > > > > > This is the error - no path problem. There is a method expecting no > > arguments that is being called with one. > > > > HTH, > > David > > > > > > Sure - that test fails - but why do we see the next result? (see below) > > What is rails doing in the background? > > > > Scott > > > > > This is not a rails app, it''s standalone ruby. > > And yes, as I highlighted,the interesting bit is the second run where > instead ''require'' fails. > > Thanks in advance for further discussion! > > Peter > >Hello All, Thanks for your tips. In the end, what I needed was a lesson on Ruby Load Path. Pickaxe 2 pp172 "Where Ruby finds its modules" gave me the answer. I needed to set environment variable RUBYLIB export RUBYLIB=./lib:../lib so that $ruby -e ''puts $:'' ./lib ../lib /usr/local/lib/ruby/site_ruby/1.8 /usr/local/lib/ruby/site_ruby/1.8/i386-cygwin /usr/local/lib/ruby/site_ruby /usr/local/lib/ruby/1.8 /usr/local/lib/ruby/1.8/i386-cygwin . Now autotest gets the proper require twice in a row, when the spec file reads : require ''bowling'' Hope this helps you, next grasshopper of the RSpec FU! -- Peter Fitzgibbons ------------------------------ iPhone -- "IT"-ness. hrefhttp://www.macdailynews.com/index.php/weblog/comments/apples_iphone_could_become_iconic_it_object ------------------------------ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080405/cd015626/attachment.html
Pat Maddox
2008-Apr-05 15:57 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
On Sat, Apr 5, 2008 at 8:42 AM, Peter Fitzgibbons <peter.fitzgibbons at gmail.com> wrote:> "Where Ruby finds its modules" gave me the answer. I needed to set > environment variable RUBYLIB > > export RUBYLIB=./lib:../libInstead of setting an environment variable before running the app, you can modify the load path in your code with: $:.unshift(*[''./lib'', ''../lib'']) Pat
Corey Haines
2008-Apr-05 21:47 UTC
[rspec-users] Newbie : how to require to lib from spec under autotest?
Sweet! That''s a cool command. Thanks for posting! On Sat, Apr 5, 2008 at 11:42 AM, Peter Fitzgibbons < peter.fitzgibbons at gmail.com> wrote:> > > On Sat, Apr 5, 2008 at 6:08 AM, Peter Fitzgibbons < > peter.fitzgibbons at gmail.com> wrote: > > > > > On Sat, Apr 5, 2008 at 12:03 AM, Scott Taylor < > > mailing_lists at railsnewbie.com> wrote: > > > > > > > > On Apr 5, 2008, at 12:38 AM, David Chelimsky wrote: > > > > > > On Apr 5, 2008, at 12:28 AM, "Peter Fitzgibbons" < > > > peter.fitzgibbons at gmail.com> wrote: > > > > > > Hello all, > > > > > > I have the RSpec sample in ./rspec_bowling, with... > > > ./rspec_bowling/lib/bowling.rb > > > ./rspec_bowling/spec/spec.opts > > > ./rspec_bowling/spec/bowling_spec.rb > > > > > > when I autotest, I get this: > > > $autotest > > > loading autotest/rspec > > > /usr/local/bin/ruby -S > > > /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.3/bin/spec -O spec/spec.opts > > > spec/spec_helper.rb spec/bowling_spec.rb > > > F > > > > > > 1) > > > ArgumentError in ''Bowling should score 0 for gutter game'' > > > wrong number of arguments (1 for 0) > > > [..snip..] > > > > > > > > > This is the error - no path problem. There is a method expecting no > > > arguments that is being called with one. > > > > > > HTH, > > > David > > > > > > > > > Sure - that test fails - but why do we see the next result? (see > > > below) What is rails doing in the background? > > > > > > Scott > > > > > > > > > This is not a rails app, it''s standalone ruby. > > > > And yes, as I highlighted,the interesting bit is the second run where > > instead ''require'' fails. > > > > Thanks in advance for further discussion! > > > > Peter > > > > > Hello All, > > Thanks for your tips. > In the end, what I needed was a lesson on Ruby Load Path. Pickaxe 2 pp172 > "Where Ruby finds its modules" gave me the answer. I needed to set > environment variable RUBYLIB > > export RUBYLIB=./lib:../lib > > so that > > $ruby -e ''puts $:'' > ./lib > ../lib > /usr/local/lib/ruby/site_ruby/1.8 > /usr/local/lib/ruby/site_ruby/1.8/i386-cygwin > /usr/local/lib/ruby/site_ruby > /usr/local/lib/ruby/1.8 > /usr/local/lib/ruby/1.8/i386-cygwin > . > Now autotest gets the proper require twice in a row, when the spec file > reads : > > require ''bowling'' > > Hope this helps you, next grasshopper of the RSpec FU! > > > -- > Peter Fitzgibbons > ------------------------------ > iPhone -- "IT"-ness. > href> http://www.macdailynews.com/index.php/weblog/comments/apples_iphone_could_become_iconic_it_object > ------------------------------ > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- http://www.coreyhaines.com The Internet''s Premiere source of information about Corey Haines -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080405/bf76d21a/attachment-0001.html