search for: 82ask

Displaying 8 results from an estimated 8 matches for "82ask".

2006 Sep 22
2
I''m misunderstanding how stubs works
..._equal end_time - start_time, 20 end But I''d be interested to understand why the first version doesn''t. Thanks in advance for any help you can offer! ------------------------------------------------- Paul Butcher CTO RE5ULT Limited 74 Eden Street, Cambridge CB1 1EL http://www.82ask.com/ Office: +44 (0) 1223 309080 Mobile: +44 (0) 7740 857648 Email: paul at 82ask.com MSN: paul at paulbutcher.com AIM: paulrabutcher Skype: paulrabutcher LinkedIn: https://www.linkedin.com/in/paulbutcher ------------------------------------------------- 82ASK: text any question to 82ASK (82275)...
2007 Jun 11
12
Mocking system/`
This drives me insane on a regular basis. How does one mock system(''blah'') or `blah` ? Adding expectations on Kernel doesn''t do it. Adding expectations on Object just makes me sad: Object.any_instance.expects(:system).with(''ls'') # => #<Mock:0x12b584e>.system(''ls'') - expected calls: 0, actual calls: 1 And this really
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
2007 Mar 18
5
Automatically mocking ActiveRecord methods
Seems like I do a fair amount of mocking ActiveRecord''s automatically generated routines when I''m testing controllers. Things like: @portalspace = PortalSpace.new :public_readable => true, :public_writable => true, :name => ''public'' @portalspace.stubs(:id).returns(203) PortalSpace.stubs(:find).with(203).returns(@portalspace)
2007 Mar 03
11
Beyond multiple return values
First off, I love mocha and have been using it all over the place ever since I found it a few months ago. So I noticed the other day rather belatedly that mocha-0.4.0 had been released and that we can now do the object.stubs(:method).returns (:first_value, :second_value). Much neater than fiddling with lambdas everytime this sort of behaviour is needed But can we go further ? I was
2006 Oct 07
10
When Rails speed matters
I''m developing small intranet solution that displays some data from another internal HTTP server. Using ''net/http'' I''m getting data via rails controller action from another server, this works quite well. Processing data on another server takes approx. 1-2 seconds, what is fine and acceptable, but now rails application takes 1-2 sec to respond to the user.
2006 Jul 03
0
Slow bulk insert query
As part of my application I calculate/generate a fair chunk of data, and I then stick the reults into the database (mysql). This takes the form of a single "INSERT INTO foo(...) VALUES(...) " statement that is approx ~500k The dats itself consists of pairs of integers. If I dump the query string to disk and paste it into the query browser and run it then execution is <1 second. If
2006 Jul 04
1
ActiveRecord write stops script from responding to SIGTERM
We''ve got a small daemon we run on our servers, which looks something like this require File.dirname(__FILE__) + ''/../config/boot'' require File.dirname(__FILE__) + ''/../config/environment'' ActiveRecord::Base.establish_connection do m = Message.next_pending if m m.do_something else sleep 5 end end Stuff gets place in this queue