[ANN] view_test 0.9.0 view_test is a similar implementation of rspec''s controller and view specs for test/unit. It allows you to migrate existing tests one test at a time to create simpler functional tests by extracting out all of the view assertions into their own view_test. Check it out at http://www.continuousthinking.com/tags/view_test The goal of view_test is to allow people who are using test/unit to achieve a better level of testing. Zach Dennis http://www.continuousthinking.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Forgot to point out the right subclass for controllers. The original post has been updated on http://www.continuousthinking.com/tags/view_test Functional tests need to subclass Rails::ControllerTest::TestCase View tests need to subclass Rails::ViewTest::TestCase Zach On Aug 24, 12:38 pm, zdennis <zach.den...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> [ANN] view_test 0.9.0 > > view_test is a similar implementation of rspec''s controller and view > specs for test/unit. > > It allows you to migrate existing tests one test at a time to create > simpler functional tests > by extracting out all of the view assertions into their own view_test. > > Check it out athttp://www.continuousthinking.com/tags/view_test > > The goal of view_test is to allow people who are using test/unit to > achieve a better level of > testing. > > Zach Dennishttp://www.continuousthinking.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 24, 2007, at 09:38, zdennis wrote:> [ANN] view_test 0.9.0 > > view_test is a similar implementation of rspec''s controller and view > specs for test/unit. > > It allows you to migrate existing tests one test at a time to create > simpler functional tests > by extracting out all of the view assertions into their own view_test. > > Check it out at http://www.continuousthinking.com/tags/view_test > > The goal of view_test is to allow people who are using test/unit to > achieve a better level of > testing.Have you looked at Test::Rails in ZenTest? I think rSpec got several of its ideas for view testing from there. http://zentest.rubyforge.org/ZenTest/classes/Test/Rails.html http://zentest.rubyforge.org/ZenTest/classes/Test/Rails/ ControllerTestCase.html http://zentest.rubyforge.org/ZenTest/classes/Test/Rails/ ViewTestCase.html I do like your expect_render. May I steal it? -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
zdennis wrote:> [ANN] view_test 0.9.0> It allows you to migrate existing tests one test at a time to create > simpler functional tests > by extracting out all of the view assertions into their own view_test. > > Check it out athttp://www.continuousthinking.com/tags/view_testDoes it peacefully coexist with form_test_helper? I''m naturally incapable of excluding pilot error, but I suspect that ZenTest''s ViewTestCase and form_test_helper collude to produce a nasty error. I will reproduce it on request... -- Phlip http://www.oreilly.com/catalog/9780596510657/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 24, 4:51 pm, Eric Hodel <drbr...-48TerJ1FxhPk1uMJSBkQmQ@public.gmane.org> wrote:> On Aug 24, 2007, at 09:38, zdennis wrote: > > > [ANN] view_test 0.9.0 > > > view_test is a similar implementation of rspec''s controller and view > > specs for test/unit. > > > It allows you to migrate existing tests one test at a time to create > > simpler functional tests > > by extracting out all of the view assertions into their own view_test. > > > Check it out athttp://www.continuousthinking.com/tags/view_test > > > The goal of view_test is to allow people who are using test/unit to > > achieve a better level of > > testing. > > Have you looked at Test::Rails in ZenTest? I think rSpec got several > of its ideas for view testing from there.A while back I checked it out, I think I need to give it a better look.> > http://zentest.rubyforge.org/ZenTest/classes/Test/Rails.htmlhttp://zentest.rubyforge.org/ZenTest/classes/Test/Rails/ > ControllerTestCase.htmlhttp://zentest.rubyforge.org/ZenTest/classes/Test/Rails/ > ViewTestCase.html > > I do like your expect_render. May I steal it?Absolutey, stealeth away! Zach --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> zdennis wrote: > > > [ANN] view_test 0.9.0 > > > It allows you to migrate existing tests one test at a time to create > > simpler functional tests > > by extracting out all of the view assertions into their own view_test. > > > > Check it out athttp://www.continuousthinking.com/tags/view_test > > Does it peacefully coexist with form_test_helper?Here''s the ZenTest + form_test_helper code that fails: class ForumViewTest < Test::Rails::ViewTestCase self.use_transactional_fixtures = mysql_tests? # true fixtures :users, :rings def test_host_ring login_as :BunBun render :action => ''index'' submit_form ''host_ring_form'' do |post| assert_equal users(:BunBun).id, post[''user[id]''].value.to_i post[''ring_name''] = ''progidy'' end end ... The failure message complains about @session being both deprecated and already set. It appears below my sig. The only overt @session assignment I can find in our beloved maze of metaprogrammed Rails code and plugins is up in ZenTest, but if I change that to ''session'' the error persists. I can then add a ''p @session'' to anywhere in my test case, and it returns nil. So should I switch to view_test? -- Phlip http://www.oreilly.com/catalog/9780596510657/ ^ assert_xpath http://tinyurl.com/yrc77g <-- assert_latest Model 1) Error: test_host_ring(ForumViewTest): RuntimeError: Deprecating @session, but it''s already set to #<ActionController::TestSession:0xb68a6450 @attributes=nil, @session_id="", @saved_attributes={:user=>6, "flash"=>{}}>! Use the session= writer method instead of setting @session directly. /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1074:in `assign_deprecated_shortcuts'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1069:in `each'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1069:in `assign_deprecated_shortcuts'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:1060:in `assign_shortcuts_without_flash'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/flash.rb:140:in `assign_shortcuts'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:424:in `process_without_filters'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in `process_without_session_management_support'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in `process_without_test'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:15:in `process'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:382:in `process'' /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:353:in `post'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:361:in `send'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:361:in `make_request'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:31:in `submit_without_clicking_button'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:40:in `submit'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:311:in `select_form'' /var/lib/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/object/misc.rb:23:in `returning'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:308:in `select_form'' /home/phlip/projects/witz/champion/config/../vendor/plugins/form_test_helper/lib/form_test_helper.rb:320:in `submit_form'' ./test/functional/forum_view_test.rb:17:in `test_host_ring'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 24, 2007, at 19:16, Phlip wrote:>> zdennis wrote: >> >>> [ANN] view_test 0.9.0 >> >>> It allows you to migrate existing tests one test at a time to create >>> simpler functional tests >>> by extracting out all of the view assertions into their own >>> view_test. >>> >>> Check it out athttp://www.continuousthinking.com/tags/view_test >> >> Does it peacefully coexist with form_test_helper? > > Here''s the ZenTest + form_test_helper code that fails:Did you file a bug? I don''t see one in the tracker. -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Here''s the ZenTest + form_test_helper code that fails: > > Did you file a bug? I don''t see one in the tracker.Will do. I didn''t yet because form_test_helper could need the bug report... -- Phlip http://www.oreilly.com/catalog/9780596510657/ ^ assert_xpath http://tinyurl.com/yrc77g <-- assert_latest Model --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8/24/07, Eric Hodel <drbrain-48TerJ1FxhPk1uMJSBkQmQ@public.gmane.org> wrote:> > On Aug 24, 2007, at 09:38, zdennis wrote: > > [ANN] view_test 0.9.0 > > > > view_test is a similar implementation of rspec''s controller and view > > specs for test/unit. > > > > It allows you to migrate existing tests one test at a time to create > > simpler functional tests > > by extracting out all of the view assertions into their own view_test. > > > > Check it out at http://www.continuousthinking.com/tags/view_test > > > > The goal of view_test is to allow people who are using test/unit to > > achieve a better level of > > testing. > > Have you looked at Test::Rails in ZenTest? I think rSpec got several > of its ideas for view testing from there.Eric - it definitely did. Initially RSpec''s Rails plugin wrapped ZenTest, but there were some things that I wanted to do differently so I took what was needed and broke the dependency. You and Ryan are credited in the license: http://rspec.rubyforge.org/license.html> > http://zentest.rubyforge.org/ZenTest/classes/Test/Rails.html > http://zentest.rubyforge.org/ZenTest/classes/Test/Rails/ > ControllerTestCase.html > http://zentest.rubyforge.org/ZenTest/classes/Test/Rails/ > ViewTestCase.html > > I do like your expect_render. May I steal it? > > -- > Poor workers blame their tools. Good workers build better tools. The > best workers get their tools to do the work for them. -- Syndicate Wars > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 24, 6:05 pm, Phlip <phlip2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Does it peacefully coexist with form_test_helper?For view tests yes. For functional/controller tests no because the views are no longer rendered here. Zach http://www.continuousthinking.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
zdennis wrote:> Forgot to point out the right subclass for controllers. The original > post has been updated on http://www.continuousthinking.com/tags/view_test > > Functional tests need to subclass Rails::ControllerTest::TestCase > View tests need to subclass Rails::ViewTest::TestCaseDoes anyone have a reason for this error message? rake aborted! uninitialized constant Mocha::ParameterMatchers We have sufficient mocha: $ gem list | grep -i mocha mocha (0.5.4, 0.5.1) I will add a require to our test case and keep going... -- Phlip http://www.oreilly.com/catalog/9780596510657/ ^ assert_xpath http://tinyurl.com/yrc77g <-- assert_latest Model --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 04/09/07, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Does anyone have a reason for this error message? > > rake aborted! > uninitialized constant Mocha::ParameterMatchers > > We have sufficient mocha: > > $ gem list | grep -i mocha > mocha (0.5.4, 0.5.1) >If you think this might be a Mocha bug (which it may well be), can you send some more details to the mocha mailing list ( http://rubyforge.org/mailman/listinfo/mocha-developer) and we''ll look into it for you. Thanks. -- James. http://blog.floehopper.org http://tumble.floehopper.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---