Hi All
I am new to rspec. How can I write specs for this class
Anyone please provide me the detail specs for this class
thanks
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
on 2012-01-08 21:18
on 2012-01-08 23:39
On Sun, Jan 8, 2012 at 8:18 PM, umair iqbal <lists@ruby-forum.com> wrote: > Hi All > I am new to rspec. How can I write specs for this class > Anyone please provide me the detail specs for this class > thanks > 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
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.