Displaying 20 results from an estimated 4000 matches similar to: "advice on a spec''ing best practice"
2006 Nov 15
3
using expects with (for Hash and Array)
First off, thanks for the great library.
Is there a way setup expects with this:
runtime_options[:property] = properties_option_string
or do i have to use:
runtime_options.store(:property, properties_option_string)
which results in this:
runtime_options.expects(:store).with(:property, ''prop1=1'')
Thanks for your help.
jeremy
2007 Jun 04
8
Bug in Configurator.change_privilege?
Hello.
I have discovered that mongrel does not correctly take on all the
groups of the requested user/group combination. It seems that while
the specified user and group is correctly activated, all the other
groups that are associated with this user are not enabled and the
group permissions remain the same as the caller (i.e. root).
This problem (and solution) is discussed in the Ruby Forum:
2007 Feb 05
1
long jumping out of code in specs
I wrote this abomination just now, and wonder if anyone else has had
experience with the pattern behind it. In short, I''m specing an
after_create hook on an ActiveRecord model, that calls a bunch of
private methods. Instead of stubbing all those private methods (which
is verboten anyway, as well as impossible because creating the object
which owns those methods is what I''m
2006 Jun 05
3
possible bug in trunk base.rb? BREAK_RE.
Hello All, first post to the list.
I just checked out trunk and it broke my tests.
Turns out that the BREAK_RE regex found in base.rb is missing the "/m"
mode modifier.
I am still getting my head around the library so i may be missing
something but was that done on purpose?
Thanks.
jeremy
Index: base.rb
===================================================================
--- base.rb
2007 Apr 13
1
spec''ing out a trap/SIGINT
How would you spec out a call to Signal.trap (a ^C or a unix SIGINT)?
Scott
2008 Apr 29
1
Spec''ing controller macros
Hi,
(This is my first post after months of appreciative lurking...)
I''m trying to spec the following conditional controller macro:
class ApplicationController < ActionController::Base
# turn off session management for robots
session :off, :if => lambda {|req| req.user_agent =~ /(Google|Slurp)/i }
# ...
end
My current attempt seems to be quite unsuccessful:
1) when I
2009 Apr 07
3
Best Practice Advice?
Dear All,
I have a asterisk setup that is currently running on version 1.4.15 - I
wish to upgrade or migrate this instance to the current asterisk stable,
1.6.0.6. It is my intention to build a FC8 box, then install asterisk
from source, and begin to migrate over the configuration. The thing is,
this sounds so simple in my head, and I've had enough issues with
asterisk, to know that life
2004 Sep 01
1
Advice on good programming practice, lexical scope
In "An Introduction to R" (See R help menu), there is an example of a function 'open.account' that makes use of the lexical scope in R.
I have a set of functions that can be used to output R tables and graphics into a single report document. (I am aware that several tools can do this already).
While reorganizing my code, I realize that I can collect my functions in a list, in
2008 Jul 26
1
Ice Cast referral?
Greetings,
I am having a couple issues setting up Icecast on my server and I am in need
of assistance.
1) the front end page is not building ( files exposed )
2) I got it started but only 1 mount can connect at a time. I have EZstream
running perfectly but I can not have 2 people connected to different mounts
at the same time.
Can you give me some guidance or point me to the right direction? I
2007 May 22
3
Comments wanted about spec''ing out a couple controller methods
(oops, accidentally sent this to the rspec-devel list, sorry about that)
Could someone help me spec out these Rails controller methods? I
don''t know where to get started, especially with the transaction
stuff. Or, if anyone else could suggest ways I could improve the
code, that would be great as well.
Puzzle has_one Media. Both are AR model objects.
class PuzzlesController <
2007 Apr 23
1
X-Sendfile, static files, windows
i wrote a little camping app which serves the css, js and images
statically using the Static class example i found on the camping wiki.
everything works perfectly on my mac. once on windows the static files
don''t get served. a 404 is returned.
i have tried running the app using camping, webrick and mongrel, all
give the same 404 response.
here is an example value of X-Sendfile. I have
2006 Jun 29
5
Memory usage issues
Hello all,
I''m new to Mongrel and am very impressed with what I see so far. This
thing beats FastCGI hands down, and is even simpler to use than SCGI.
Great job Zed! Thanks for all the hard work.
I am a bit surprised at the memory usage patterns though. I''m not
sure if I''m doing something wrong (most likely I am), or if this is a
problem with the app I''m
2007 Jan 21
35
Collection proxies need to be stubbed ?
Hi all !
I just started writing specs on a new project. I would just like to
validate that this is the way you would write it. I know about mocks,
stubs and expectations. I don''t think this is a problem for me.
My question really boils down to:
def index
@projects = current_user.projects.active
end
My spec needs to return the proxy, no ? Here''s my code:
context "A
2007 Aug 14
2
Spec''ing ApplicationController
Folks,
I''d like to spec the behaviors that I''m adding to ApplicationController.
Specifically, I''m adding:
def authenticated?
session[:username] != nil
end
I described ApplicationController, but couldn''t figure out how to call the
authenticated method. I''m probably going about this quite wrongly and would
appreciate any hints?
Thanks,
Scott
--
2007 Apr 18
2
spec''ing a call to exit
How would I spec a call to exit? I can''t seem to stub it - rspec
throws an error.
Scott
2007 Apr 19
1
Spec''ing Namespaced Controllers
I''m stucking trying to figure out how to write a spec for a namespaced
controller. Any help is appreciated.
Thanks,
Marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070419/75a167fa/attachment.html
2007 Jan 18
1
spec''ing models with observers that send mail
I''m spec''ing a model with an observer that sends mail. Mailers behave
similarly to controllers, so to make the whole thing work, I believe
something like integrate_views has to be available. Has anyone dealt
with observers and ActionMailer?
Thanks
2007 Jul 24
4
spec''ing helpers that use controller
Hi all,
I''m in the process of creating rspecs for my helpers. One of the
helpers in app/helpers/application_helper.rb looks like this:
def page_name
@page_name || "Define @page_name in
#{controller.controller_name}::#{controller.action_name}"
end
The rspec is simply:
it "should something" do
page_name
end
2008 Jan 13
1
View spec''ing style
I''ve been getting my head around view spec''ing lately for a fairly
complex project that makes heavy use of partials in views and I have hit
up against a style puzzle.
I see two strategies for spec''ing views:
First:
Develop detailed specs for each partial and then make sure that the
final view expects that the appropriate partials are included and used.
Pros:
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers,
and live in application.rb.
Whereas I usually also provide examples in individual controllers
that use these methods, not necessarily all the edge cases and I''d
like to isolate the examples.
This is the approach I''m taking (thanks to bryanl for suggestions and
http://pastie.caboo.se/123626). WDYT?
This