Topic: Rspec Help Please
Hi
How can I write tests for this class
module Sitemap
class Job
def initialize(country_version, directory, country_host)
@country_version = country_version
@directory = directory
@country_host = country_host
@locale = country_version.name
end
def get_data
::Function.find_each(:conditions => {:country_version_id => @country_version.id}) do |function|
::Job.find_each(:conditions => {:country_version_id => @country_version.id, :function_id => function.id}) do |job|
I18n.locale=(@locale)
yield entry(job)
end
end
end
private
def entry(job)
{
:loc => ActionController::Integration::Session.new.url_for(:controller => 'jobs', :action => 'show', :title_urlified_with_job_ref_id => job.title_urlified + "-" + job.id.to_s, :host => @country_host.value),
:changefreq => 0.8,
:priority => 'monthly',
:lastmod => job.updated_at
}
end
end
end
Thanks in advance
Last edited by gikian (2012-01-08 14:04:30)