Is there somewhere a real documentation about using Cucumber + Webrat in a Rails project? For instance it seems that Cucumber doesn''t understand the word "Given" like Story Runner does. -- Posted via http://www.ruby-forum.com/.
On Sep 28, 2008, at 2:50 PM, Fernando Perez wrote:> Is there somewhere a real documentation about using Cucumber + > Webrat in > a Rails project? > > For instance it seems that Cucumber doesn''t understand the word > "Given" > like Story Runner does. > --How about this? http://github.com/aslakhellesoy/cucumber/wikis Scott
Bloody keyboard! del and enter keys are too close to one another... So my other questions are: - Where does Cucumber take its DB data from? Does it use the dev DB? Does it copy the data from my dev DB into the test DB? When I run rake features while my dev mongrel is running, I see some stuff going on in the DB. - Can I use Autotest with Cucumber+Webrat? How to automate it? - Any tutorials to suggest? -- Posted via http://www.ruby-forum.com/.
On Sun, Sep 28, 2008 at 1:55 PM, Fernando Perez <lists at ruby-forum.com> wrote:> Bloody keyboard! del and enter keys are too close to one another... > > So my other questions are: > > - Where does Cucumber take its DB data from? Does it use the dev DB? > Does it copy the data from my dev DB into the test DB? When I run rake > features while my dev mongrel is running, I see some stuff going on in > the DB.If you follow the directions at http://github.com/aslakhellesoy/cucumber/wikis/ruby-on-rails, the ''script/generate cucumber'' step will configure things so it runs against your test db and wraps each scenario in a transaction.> - Can I use Autotest with Cucumber+Webrat? How to automate it?There is no support for that.> - Any tutorials to suggest?Check out whatever you can find for RSpec''s Story Runner. It''s almost the same except the feature files should use the .feature extension, there is no steps_for or with_steps_for methods, and directory structure is treated differently (per cucumber wiki).
Thank you David, Is there a way to skip database initialization? Because it takes too much time to run each test. Is there a similar way to mock objects or create objects and have them "saved" in memory? I don''t understand how to do that. I use for instance Product.create!(:title => ''title'', :price => ''15''), but I am not sure the object gets saved or is accessible by RSpec. Do you have an exmaple for that? -- Posted via http://www.ruby-forum.com/.
> Is there a way to skip database initialization? Because it takes too > much time to run each test.So do you handle data inside the testing environment. Let''s say: Given there are 2 products available on the site. Currently I am using 1.upto(2) do |i|; Product.create!(:title => "title#{i}"...); ... end But this uses the testing DB isn''t it?> I use for instance Product.create!(:title => ''title'', :price => ''15''), > but I am not sure the object gets saved or is accessible by RSpec. Do > you have an example for that?I fixed this problem, it was related to my other problem about request.domain during tests. With Story Runner, it gets set to example.com, whereas during controller testing it is set to test.host. -- Posted via http://www.ruby-forum.com/.
On Sun, Sep 28, 2008 at 4:24 PM, Fernando Perez <lists at ruby-forum.com> wrote:> Thank you David, > > Is there a way to skip database initialization? Because it takes too > much time to run each test. Is there a similar way to mock objects or > create objects and have them "saved" in memory? I don''t understand how > to do that.Recommended practice is to use the database so you''re exercising as close to the full stack as possible. Depending on whether or not you use any custom sql, you could try running against an in-memory sqlite3 database http://nubyonrails.com/articles/2006/06/01/san-francisco-sqlite3-memory-tests-asteroids> > I use for instance Product.create!(:title => ''title'', :price => ''15''), > but I am not sure the object gets saved or is accessible by RSpec. Do > you have an exmaple for that? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Mon, Sep 29, 2008 at 5:10 AM, Fernando Perez <lists at ruby-forum.com> wrote:>> Is there a way to skip database initialization? Because it takes too >> much time to run each test. > So do you handle data inside the testing environment. Let''s say: Given > there are 2 products available on the site. > > Currently I am using 1.upto(2) do |i|; Product.create!(:title => > "title#{i}"...); ... end > > But this uses the testing DB isn''t it?Yes, but that''s OK w/ cucumber. This isn''t unit testing.> > >> I use for instance Product.create!(:title => ''title'', :price => ''15''), >> but I am not sure the object gets saved or is accessible by RSpec. Do >> you have an example for that? > I fixed this problem, it was related to my other problem about > request.domain during tests. With Story Runner, it gets set to > example.com, whereas during controller testing it is set to test.host. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Thanks Dave, I am starting to understand better the workflow to adopt with cucumber and webrat. By the way I am having some issues with the: I should see "..." regexp. If what I want to see has double quotes or brackets, it seems to fail and not properly detect the string. -- Posted via http://www.ruby-forum.com/.
On Mon, Sep 29, 2008 at 3:14 PM, Fernando Perez <lists at ruby-forum.com> wrote:> Thanks Dave, I am starting to understand better the workflow to adopt > with cucumber and webrat. > > By the way I am having some issues with the: I should see "..." regexp. > If what I want to see has double quotes or brackets, it seems to fail > and not properly detect the string.Please file a bug report... Aslak> -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >