Displaying 20 results from an estimated 100 matches similar to: ".class call to the mock object (or any existing methods)"
2006 Apr 20
11
dynamic mock object anyone?
Hi guys, got this problem with creating such a thing... hope anyone
could help..
the problem:
ok, now i have this mock object that would simulate a external rpc call.
eg
require ''models/xmlrpc_agent''
class XmlrpcAgent
def create(params)
200
end
end
but the value of the value returned is fixed. which is quite hard for me
to test the controller when different
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded
correctly to the id message. Here''s the change I put into my copy of
head.
Index: lib/mocha/mock_methods.rb
===================================================================
--- lib/mocha/mock_methods.rb (revision 1114)
+++ lib/mocha/mock_methods.rb (working copy)
@@ -68,6 +68,7 @@
method_names =
2006 Jun 14
9
Controller testing and mocks...
So far I''ve been doing my controller testing against "real" (testing)
objects; however, I''ve been beginning to wonder if I should "default" to
using mocks in most cases -- both for performence and to enforce a
looser coupling.
In part this is driven by my viewpoint that rail''s "functional" tests
are still "unit" tests, so they
2006 Jun 05
1
file_column & RMagick
Hi,
I have a site where I wish to upload a resize a picture, and store it in
the file system. The best solution that I have found for this so far is
using file_column. This was working great, for about an hour, but all of
the sudden I began to get the following error (only when i attempt to
resize).
NameError (undefined method `assoc'' for class `Magick::ImageList''):
2006 Jul 24
1
XMLRPC WebService and Structs
Hi
First off, I apologise if this is covered somewhere and I just don''t
get it... I''ve looked far and wide ....
As a part of my current project I need to hook up to a particular
XMLRPC webservice that won''t be available for me to use until close
to launch date... So I am trying to recreate the webservice that
mirrors the live one so I can test my application
2007 Jul 30
4
Win32 namespace
I''ve been working on a library called ruby-wmi, that is basically just
an abstraction layer around wmi. I''m a windows sys admin, and I use
wmi scripts a lot at work.
My code looks like this:
disks = WMI::Win32_LogicalDisk.find(:all, :conditions => {:drivetype => 5})
It''s supposed to mimic the active_record interface, and it works
pretty well. My next thought
2013 May 29
0
CEBA-2013:0836 CentOS 6 perl-Test-MockObject FASTTRACK Update
CentOS Errata and Bugfix Advisory 2013:0836
Upstream details at : https://rhn.redhat.com/errata/RHBA-2013-0836.html
The following updated files have been uploaded and are currently
syncing to the mirrors: ( sha256sum Filename )
i386:
d4bf3d056da18202bc6f7710d274c1ff2079f9867eb774c40fcfd36ccb9b3be4 perl-Test-MockObject-1.09-4.el6.noarch.rpm
x86_64:
2007 Mar 04
4
Rails functional testing and Mocha
I''ve always wanted to be able to do stuff like this in my functional
tests
c = customers(:customer_1)
c.expects(:great_customer_service)
post :service_customer, :id => c.id
This of course fails because inside the rails action a different
instance of customer is used. Some of the time setting your
expectation/stubbing on Customer.any_instance works, but it''s not
2006 Mar 26
4
edge and 1.8.2/1.8.4 issues
I recently upgraded to 1.8.4 to try out mongrel, and so far have been in
a kind of hell where I can''t get my app working!
Currently running (or trying to run):
Ruby version 1.8.4 (i386-mswin32)
RubyGems version 0.8.11
Rails version 1.0.0
Active Record version 1.13.2
Action Pack version 1.11.2
Action Web Service version 1.0.0
Action Mailer version 1.1.5
Active Support version
2010 May 06
5
Garbage collection outside of request cycle?
I''ve been analyzing our Unicorn-powered Rails app''s performance, and have found that garbage collection is a big factor in slow requests.
In the interest of avoiding those performance hits while handling requests, would it be possible to have a unicorn worker run garbage collection after handling a request and before waiting for the next one? Would this be a good idea?
Cheers,
2008 Mar 17
8
should have_tag outside Rails
Hi
Google has not helped me here. I''m looking for a way to use the have_tag
assert_select wrapper outside RSpec on Rails (but in a Rails project) so I
can use it to check text strings.
Has anyone managed this?
Thanks
Ashley
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2008 Feb 02
0
Adding methods to Object in Rails -- WARNING
I wanted to do:
foo.wrap
and wrap would go to a specialized wrap for some types of foo and a
general Object#wrap for all the others.
So I added wrap to Object
class Object
def wrap
self
end
end
This worked except for objects which are actually AssociationProxy
objects pretending to be some other object. The reason is that
AssociationProxy removes all but a few methods from itself.
2013 May 30
0
CentOS-announce Digest, Vol 99, Issue 15
Send CentOS-announce mailing list submissions to
centos-announce at centos.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.centos.org/mailman/listinfo/centos-announce
or, via email, send a message with subject or body 'help' to
centos-announce-request at centos.org
You can reach the person managing the list at
centos-announce-owner at centos.org
When
2007 Aug 26
2
ror app with advanced rspec?
Hi!
Can anybody link to some ror based project what is using rspec, so
nuby as me can learn from it. So it should have updated and practising
advanced rspec.
After reading last threat about "testing behaviour or testing code?",
I just realised that I would definitely learn something from app like
that. Some casual googling didn''t help me this time.
Thanks!
Priit at
2007 Feb 05
10
how does Mocha compare in terms of classical vs mock-based testing, and stubbing???
Hi guys,
I''ve just been reading Martin Fowler''s article re mock versus
stubbing<http://martinfowler.com/articles/mocksArentStubs.html>where
he compares traditional TDD testing techniques with mock based
testing. I''d be interested in comments from a ruby on rails perspective in
terms of this and Mocha? For example:
a) Do you see Mocha as a robust way to test Ruby
2008 Jun 12
1
Does anyone know how to mock the Rails Logger then set expectations with should_receive?
Hey Guys,
I''m trying to mock the Rails Logger for the following code:
...
rescue TimeoutError => error
$logger.error("#{self.name} Timeout for #{path}: #{error}") and return
rescue SocketError => error
$logger.error("#{self.name} SocketError for #{path}: #{error}") and
return
rescue StandardError => error
2011 Jul 14
0
subclasses with inherited_resources?
I''m trying out inherited_resources and so far so good. However, one
problem I''ve run into is that it''s very difficult to customize
inherited_resource behaviour in subclasses. Looking through the
source I see it uses things like undef_method and class_attribute.
For example, if I have the following controllers:
class ItemsController
inherit_resources
actions :new,
2005 May 04
0
New win32-dir
Hi all,
In lieu of Timothy''s pure Ruby junction code, and Zach''s VC++ 6 issues,
I decided to just rewrite the dang thing in pure Ruby using Win32API.
That will solve''s Zach''s problem and make it easier to add Timothy''s
code, which I plan to add (slightly modified) to the 0.2.0 release.
The code is below. One thing I have a question about is how to
2006 Mar 10
0
WEBrick crashing
ruby 1.8.2 (2004-12-25) [i386-mswin32]
latest version of edge rails - patched to make the server work with
win32 (http://dev.rubyonrails.org/ticket/4139)
On some pages WEBrick is crashing with the following:
d:/programming/ruby/lib/ruby/1.8/profiler.rb:27: You have a nil object
when you
didn''t expect it! (NoMethodError)
You might have expected an instance of Array.
The error occured
2007 Aug 26
4
howto regressions on environment.rb in Rails projects
How would one write a spec on environment.rb in a rails app?
I was requiring a gem in environment.rb, but received a
"MissingSourceError". Generally, ruby raises a LoadError when it
can''t find a gem, but rails overrides this to raise a
MissingSourceError (since rails is expecting a required file to be in
lib/...). How would I write a spec to override this behavior,