On 31/08/06, Bryan Liles <bryan-POHHIXKJOJcAvxtiuMwx3w@public.gmane.org>
wrote:>
>
> I have an active record model which roughly looks like this:
>
> require ''soap/rpc/driver''
> class Job < ActiveRecord::Base
> def self.submit(item)
> ... do soap call ...
> ... create Job ...
> return job
> end
>
> def status(status_type)
> ... do soap call ..
> return soap_message
> end
> end
>
> I''m trying to stub it out under test/mock/tests/job.rb.
>
> class EnvoyJob
>
> def self.submit(item)
> j = Job.create({:foo => item, :bar => ''constant value
for
> testing''})
> end
>
> def availability(status_type)
> case status_type
> when 1
> item = {"Local Channel" => "1 mile",
"LoopCost" => 918.24 }
> return item.to_yaml
> end
> end
>
> end
>
> This code doesn''t work. What do I need to do to mock out an
> ActiveRecord model?
>
> >
>
You need to name the mock class the same as the class you want to mock.
--
James.
http://blog.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
-~----------~----~----~----~------~----~------~--~---