Displaying 20 results from an estimated 6000 matches similar to: "unit testing active resource - mock or connect?"
2008 Jan 11
2
guide to good mocking?
Hi all - does anyone know of a good blog post or wiki or something
with a good guide to mocking? I''ve got some degree of responsibility
for people who are creating mocks. I''m supposed to actually be telling
them the best way to do it.
In some cases we have code with like a bazillion mock(:x) statements
and it''s kind of out of control. I have an idea how the specs should
2006 Mar 28
3
coolest software ("coolest startups" re-asked)
Asked a little while back about "coolest startups" using Rails, I
think it''d have been better had I asked "coolest software." Besides
the obvious (37Signals, Typo, Yakima Herald, Odeo, Measure Map, etc.),
I''m just curious about other developments where people are using it to
make nifty stuff.
--
Giles Bowkett
www.gilesgoatboy.org
2006 Apr 22
2
put variable in session each time any controller runs?
Hi -- well, that''s what I''m trying to do. Does anyone know what the
best way to do it is? I have three controllers, each one has a hidden
tag, and I want each one to salt its respective tag with the name of
the action in effect, at the time that action runs, for every action
in the controller.
--
Giles Bowkett
http://www.gilesgoatboy.org
2008 Jan 17
5
unusual challenges speccing external software
This is something I''ve come up against twice. First, I have an
interactive editor which calls vi, emacs, or TextMate (etc.) via Unix,
and then loads the file handed to the editor back into IRB after it''s
edited and saved. I guess that makes it a special case of a more
general question, which is how do you spec external processes, with a
slightly more complicated version of the
2008 Mar 01
5
rspec with continuations: very strange
I appear to have written code which travels backwards through time:
http://www.vimeo.com/742590
This disturbs me immensely. If anyone can explain it, that would be cool.
I think it''s an illusion brought about by how RSpec wraps the code it
executes, and by the sheer weirdness of continuations.
--
Giles Bowkett
Blog: http://gilesbowkett.blogspot.com
Portfolio:
2006 Mar 06
11
coolest startup?
OK, general question for the community -- what''s the coolest startup
using Rails? I don''t think "37 Signals" is a fair answer. I''m curious
as to what kind of other developments are happening. Are there a lot
of startups using Rails in the first place? Or do most of you who are
lucky enough to do Rails for a living (I''m coding Java, bleah) work in
large
2006 Mar 27
4
widgets on rails?
Here''s my crazy question of the day.
Has anybody played around with using Rails to create Mac OS X Dashboard Widgets?
Or is that just sick and wrong?
Giles
2008 Jan 26
6
UI Integration with RSpec?
Hi all,
Is there any integration with testing tools such as RSpec or
Test::Unit planned? I see that the cruise task is run correctly, but
the tests show up underneath the build log. Ideally I''d like them to
show up the same way that they do in ''java'' CruiseControl, in their
own section of tests.
Will.
2006 Mar 30
25
TextMate for Rails development -- why?
Greetings,
I am curious, I see quite a few references to using TextMate for
rails development. I downloaded TextMate and used it for 30 days. I
do not see what everyone is raving about. Snipplets are nice, but
other editors do the same thing, some with much more power.
Can anyone tell me what makes people draw to TextMate? Maybe I am
missing the whole reason, I''d really like to
2008 Jan 04
7
best way to modify spec (the command-line tool)?
Hi all, where I work we''ve cooked up a kind of ghetto profiler for our
specs. It basically just does this:
time = Time.now
# run the spec
puts "woah! dude. long spec." if time > 1.second
I''m simplifying here. I think the threshold is actually 0.1 seconds,
and we use more precise language, and highlight the spec in red via
terminal colors, etc.
But the way it works
2007 Jul 01
1
how many Mongrels?
Hi - I''ve got a pretty popular Rails app on a Mongrel cluster with
Apache and mod_proxy_balancer. How do I decide how many Mongrel
servers to put in the cluster?
I don''t have stats for the number of requests hitting the server yet,
but I should have that data soon. The server has 2GB of RAM and has to
do a lot of work with RMagick, including generating and storing lots
of
2006 Jul 27
1
form_tag vs form_remote_tag ----- the :condition option
form_remote_tag has a really useful little thingamob called
:condition. you give it a string which is then interpolated into the
form tag in such a way that the form is only submitted if :condition
evaluates in javascript to true.
so the logical thing to do is give it a JavaScript function
<%= form_remote_tag ( :condition => ''your_function_here()'',
2006 Apr 30
13
Programming with designers in mind
Gents,
We''re hard at work on a new Rails app. We''re a small group of
developers...not a web designer in the bunch. We know CSS enough to be
dangerous, but we shy away from the "softer" skills (all the while
envious of those with that capability).
We intend to grow our application in terms of functionality, but I need
to make sure we keep an eye towards
2006 Jun 15
3
How to mock a model method for unit tests?
I have a model class, say, model.rb, and in the normal course of things
it creates an instance of another class, say utility.rb (also in the
models directory).
class Utility
def initialize(obj)
# do stuff...
end
def do_something_expensive
# lots of stuff here
end
end
During testing, I want to mock out do_something_expensive because it''s
not important for the tests,
2007 Jul 12
3
Agh, this is annoying. Why is this happening?
My problem:
Mock ''Task_1005'' received unexpected message :user_id= with (1)
No matter what I do to try to stub that out it will still fail out and give
me that message.
Here is my spec
describe TasksController, "handling POST /tasks" do
before(:each) do
@task = mock_model(Task, :to_param => "1", :save => true)
2006 Mar 28
74
Is this an elaborate hoax/troll?
I sure hope so:
http://duckdown.blogspot.com/2006/03/additional-thoughts-on-why-ruby-isnt.html
Seems like it''s getting genuine rebuttals, though. It''s actually kind
of amusing.
2007 Feb 07
5
Mocking ActiveResource
I want to use ActiveResource in my app. Instead of hitting server
though, I want it to load from a file when I call find. Any clue how
I do that?
Pat
2009 Jan 09
2
Confused about to_xml() in ActiveRecord::Base subclass
Since all my efforts to control how to_xml() is formatting dates has
failed, I''m now considering writing my own to_xml(). However, from
the limited examples I''ve found, I just don''t understand how to
actually reference the columns for the records in my record set.
Here''s a simplified view of my ActiveRecord object:
class Errors < ActiveRecord::Base
2007 May 17
4
Namespaced model valid #to_xml support in ActiveRecord, ActiveSupport and ActiveResource
Hi,
Attached are links to two patches I submitted via the RoR Trac system
a week or so ago:
http://dev.rubyonrails.org/ticket/8305
http://dev.rubyonrails.org/ticket/8308
I refrained from creating a new Trac ticket for ARes, which will be
affected if both of these patches are accepted by Core.
There are a couple of workarounds for this issue, but it would be nice
for AR, AS and ARes to output
2006 Jun 19
6
to_xml depth ...
hello,
The "render :xml => myFriends.to_xml", return something like:
<people>
<person>
<id type="integer">2</id>
...
<person>
But a Person has a "has_many" relationship and they are not in the xml,
=> so is it possible to change the depth of the marshall process ?
if it not possible, what are the "rails