Woohoo! I was aware of the block construct, but didn't know it worked
with stub! as well (with should_receive, I had to use at_least... and
it broke the system, making it unusable).
Thanks!
___
rspec-users mailing list
rspec-users@rubyforge.org
http://ru
Hi,
My scenario is as follows, and so far I have not found the clean way
to implement the following.
In a method I have a method called allowed_for?(*args) used as
follows:
...
if o.allowed_for?(:foo, :bar)
#case a
elsif o.allowed_for(:quux, :bif)
#case b
elsif o.allowed_for(:baz)
#case c
On Thu, May 29, 2008 at 9:25 AM, zuo peng <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've got trouble when describe infinite loop.
>
> code snippet:
>
> def start_loop
>while true
Not a reply to your specific question, but hopefully even better.
I stumbled into similar situation a while ago, when
Hi,
>def do_verb(params = @params)
> post :create, :album => params
>end
>
>it "should change the Albums count by 1 after POST" do
> lambda do
>@album.should_receive(:save).and_return(true)
>do_verb
> end.should change(Album, :count).by(1)
>end
You e
On Wed, Apr 16, 2008 at 2:54 PM, Ashley Moran
<[EMAIL PROTECTED]> wrote:
> Or equally, you could have a Factory class that knows how to create
> valid objects. This can be handy for generating test data, and
> separates it from the class under test. (Some metaprogramming would
> let you defi
On Wed, Apr 16, 2008 at 1:05 AM, Zubin Henner <[EMAIL PROTECTED]> wrote:
> I'm testing an ActiveRecord model using rspec and mocha, and found that
> if I stub out the :valid? method, all before_validation callbacks are
> also skipped!
Naturally, as it is AR's valid method which triggers those ca
On Sat, Apr 12, 2008 at 4:17 PM, Ashley Moran
<[EMAIL PROTECTED]> wrote:
> Yeah! Don't know why I didn't think of just sending stderr to a log
> file myself...
..because you're likely smart enough to avoid using file as a
temporary variable whenever possible :)
First off, using the method sim
On Sat, Apr 12, 2008 at 11:54 AM, Ashley Moran
<[EMAIL PROTECTED]> wrote:
> Hi
>
> I have a story step that looks like this:
>
>When /(the user|then) runs "migrate (.*)"/ do |_, args|
> cd project_dir do
>@output = `#{migrate} #{args}`
> end
>@output_lines = @output.s
On Wed, Mar 19, 2008 at 1:12 AM, Ashley Moran
<[EMAIL PROTECTED]> wrote:
> > sufficient to me, but of course, YNMDFTOM.
> Please put me out of my misery and explain the acronym :D
My bad. My favorite hobby is to invent new acronyms on the fly, of
which the one concerned is an example.
It is sh
> The idea is that you can specify that certain tests exist in groups,
> and can be run as a set. You can define groups and groups of groups,
> and so you can run a set of functional tests or all the tests dealing
> with a specific feature without running through the entire thing.
> It's kind
> Yeah but then I get to say RTFM. Right now, TFM doesn't exist :(
rant << EOF
Indeed. People see much trouble in writing documentation so that they
don't have to answer the same questions ad nauseam.
It would be nice if we appreciated their efforts and check the
documentation first.
EOF
--
"
> My problems seem to be arising from the fact that when i run the test, the
> objects i created last time are still in the database. Shouldn't they be
> cleared out automatically? This in turn is preventing me from saving root
I don't know RSpec that well, but I'd guess before(:all) is run only
On Sat, Feb 23, 2008 at 10:39 PM, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
> For example, one test runner could repeatedly run (or once a minute,
> or whatever) the entire test suite. And one test runner could run the
> related tests for the file you change.
>
> Perhaps two autotest instances,
> I would think just have the spec_helper.rb file for the specs try to load
> config/rspec.rb or something along those lines. Similar to how rspec for
> rails just loads the rails env. It would then be up to the user to do the
> necessary loading in that file. There's really no way to know what cra
> Obvious 'rails mocking associations' seemed to work for me, unless I
...make that '...Googling for ...'. Duh.
--
"One day, when he was naughty, Mr Bunnsy looked over the hedge into
Farmer Fred's field and it was full of fresh green lettuces. Mr
Bunnsy, however, was not full of lettuces. This d
On Feb 11, 2008 1:43 PM, Wes Shaddix <[EMAIL PROTECTED]> wrote:
> I've got a "group" model that has a user_id attribute and a
> validates_existence_of :user and validates_presence_of :user_id
> validations. What method(s) do I need to stub on the User mock to
> intercept those validation calls? My
This is a short reply, but thinking about it a bit deeper, I have to
agree with Dan. What especially caught my
attention was this piece:
> If you start with a narrow, end-to-end piece of functionality and drill into
> it from the outside, right through until you have it working, you will find
> th
> Not if you fill it out...and the BDD way is to write one example at a
> time, not a complete spec beforehand.
I've done it this way too (being lazy), but is it really good thing?
Often I get more insight on how an interface should look like,
if I think even superficially what kinds of services a
18 matches
Mail list logo