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
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
Start by asking yourself what this class does. Then try to come up
with an example. Then, think about what the initial state of this
example is, what happens and what you expect the end result/state to
be.
Now, implement that in a spec.
If all of this sounds hard, there is a more detailed description in
http://pragprog.com/book/achbd/the-rspec-book
Aslak