Since Capistrano tasks are just like every other kind of Rake task, I
test them the same way I test any .rake file. Here''s a generic Rake
example:
---------BEGIN CODE FILE test/tasks/deflector_dish_test.rb-------------------
require File.dirname(__FILE__) + ''/../test_helper''
load RAILS_ROOT + ''/Rakefile''
#Ye Olde Rakefile
load RAILS_ROOT + ''/lib/tasks/deflector_dish.rake''
class DeflectorDishTest < Test::Unit::TestCase
fixtures :leads, :tags, :taggings
include Rake
def test_dd_import_nslc_exists
assert get_task_names.include?("deflector_dish:import_nslc_leads")
end
#Setting an Enviroment variable. This would be
# "rake deflector_dish:import_nslc_leads
INFILE="./test/fixtures/nslc_leads/edloan.csv" at the command line
def test_dd_import_nslc_leads
ENV[''INFILE''] = File.expand_path(RAILS_ROOT +
"/test/fixtures/nslc_leads/edloan.csv")
assert Task[''deflector_dish:import_nslc_leads''].invoke
end
end
-------END CODE--------
Rob Kaufman
On 12/22/06, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Railsers:
>
> The time has come for me to learn some Cap. Imagine my surprise when I
> discover the Rails test/ folder contains no capistrano/ sub-folder.
>
> How do y''all write tests showing what your cap tasks will do? Or
is
> Capistrano code fire-and-forget, unlike everything else in Rails?
>
> (Note this is not the question "how to run tests before
deploying?"
> That''s easy, and more Googlable...)
>
> --
> Phlip
> http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---