Walther Diechmann
2010-Jul-19 18:05 UTC
[rspec-users] How do I setup Rspec, Cucumber to test a Gem?
Hi, my question unwields me as a complete noob - which is okay - but I apologize for this totally basic question <:) I''ve bought the PragProg Rspec Book and googled, been reading blogs and what-have-I-not, but nowhere have I been able to find information detailing how I setup a BDD environment for testing the construction of a Gem. I have a ../gem_folder which I hope eventually will be a Gem to use with Rails 3 and I really would like to upload it to GitHub with a good test coverage.>From the Rspec Book I''ve learned that within Rails Apps, I use Cucumberand WebRat (among others) - but the book does not (or at least I?ve not been able to discover it) show how to setup the environment, without the Rails App. I guess my question could boil down to: how do I create the environment (folders, files) to test a Gem meant to work with Rails? So far I have: ../gem_folder ../gem_folder/features ../gem_folder/lib ../gem_folder/pkg ../gem_folder/spec and a few files like Rakefile, Manifest, CHANGELOG, LICENSE - and I''m able to push to Gemcutter and GitHub but where in this picture does the Rails App fit in? How do I make sure that the Gem will work went installed/utilized on Rails App''s best regards, Walther -- Posted via http://www.ruby-forum.com/.
Matt Wynne
2010-Jul-19 19:12 UTC
[rspec-users] How do I setup Rspec, Cucumber to test a Gem?
On 19 Jul 2010, at 19:05, Walther Diechmann wrote:> Hi, > > my question unwields me as a complete noob - which is okay - but I > apologize for this totally basic question <:) > > I''ve bought the PragProg Rspec Book and googled, been reading blogs and > what-have-I-not, but nowhere have I been able to find information > detailing how I setup a BDD environment for testing the construction of > a Gem. > > I have a ../gem_folder which I hope eventually will be a Gem to use with > Rails 3 and I really would like to upload it to GitHub with a good test > coverage. > > From the Rspec Book I''ve learned that within Rails Apps, I use Cucumber > and WebRat (among others) - but the book does not (or at least I?ve not > been able to discover it) show how to setup the environment, without the > Rails App. > > I guess my question could boil down to: how do I create the environment > (folders, files) to test a Gem meant to work with Rails? > > So far I have: > > ../gem_folder > ../gem_folder/features > ../gem_folder/lib > ../gem_folder/pkg > ../gem_folder/spec > > and a few files like Rakefile, Manifest, CHANGELOG, LICENSE - and I''m > able to push to Gemcutter and GitHub > > but where in this picture does the Rails App fit in? How do I make sure > that the Gem will work went installed/utilized on Rails App''s > > best regards, > Walther > -- > Posted via http://www.ruby-forum.com/.The rspec-rails gem is probably a good example for you to read for ideas. http://github.com/rspec/rspec-rails/tree/master> _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-userscheers, Matt http://blog.mattwynne.net +44(0)7974 430184
Ben Mabey
2010-Jul-20 02:39 UTC
[rspec-users] How do I setup Rspec, Cucumber to test a Gem?
Walther Diechmann wrote:> Hi, > > my question unwields me as a complete noob - which is okay - but I > apologize for this totally basic question <:) > > I''ve bought the PragProg Rspec Book and googled, been reading blogs and > what-have-I-not, but nowhere have I been able to find information > detailing how I setup a BDD environment for testing the construction of > a Gem. > > I have a ../gem_folder which I hope eventually will be a Gem to use with > Rails 3 and I really would like to upload it to GitHub with a good test > coverage. > > From the Rspec Book I''ve learned that within Rails Apps, I use Cucumber > and WebRat (among others) - but the book does not (or at least I?ve not > been able to discover it) show how to setup the environment, without the > Rails App. > > I guess my question could boil down to: how do I create the environment > (folders, files) to test a Gem meant to work with Rails? > > So far I have: > > ../gem_folder > ../gem_folder/features > ../gem_folder/lib > ../gem_folder/pkg > ../gem_folder/spec > > and a few files like Rakefile, Manifest, CHANGELOG, LICENSE - and I''m > able to push to Gemcutter and GitHub > > but where in this picture does the Rails App fit in? How do I make sure > that the Gem will work went installed/utilized on Rails App''s > > best regards, > Walther >I like using jeweler to create the structure of my gems. It is like Rail''s generators but for gems. Try it out: gem install jeweler jeweler my_gem --rspec --cucumber HTH, Ben
Walther Diechmann
2010-Jul-20 12:57 UTC
[rspec-users] How do I setup Rspec, Cucumber to test a Gem?
Ben Mabey wrote:> I like using jeweler to create the structure of my gems. It is like > Rail''s generators but for gems. Try it out: > > gem install jeweler > jeweler my_gem --rspec --cucumber > > > HTH, > Bennot really - but thanks for offering help <:) I followed the Rspec Book, railscast''s on the subject and used echoe and jeweller and had myself a genuine push''able Gem - but as my question was: how for Pete''s sake am I going to be able to test Rails Controllers and Rails Models? (even tried reading the rspec-rails gem as suggested by matt wynne - and implementing parts from that. I partly see where dchelimsky is going, but it''s just to complex to me, alas) - anyways, I''m on my 4th day on this gem-quest - and about to fold and walk away with the knowledge that testing is just a tad out of my league <:/ But - thanks a bunch for trying to steer me afloat :) /Walther -- Posted via http://www.ruby-forum.com/.