Displaying 10 results from an estimated 10 matches for "duncanbeevers".
2008 Jan 02
2
Proxies
...g
the Mock Proxy to exercise the behavior of simple private instance
methods of my class which are kind of a pain to test currently, which
leads to my not making anything private.
On Jan 2, 2008 6:50 AM, James Mead <jamesmead44 at gmail.com> wrote:
>
> On 05/11/2007, Duncan Beevers <duncanbeevers at gmail.com> wrote:
> > The block syntax looks excellent, and reads very nicely. I especially
> > like the idea of not having to pass in the mock to the block to stick
> > the expectations onto, and instead just continue fluently adding
> > expectations.
> >
>...
2007 Nov 04
3
Returning the mock associated with an expectation.
I was reading through the FlexMock docs and noticed the expectation
method .mock, which returns the original mock associated with an
expectation.
It looks really handy for writing nice all-in-one mocks like:
mock_user = mock(''User'').expects(:first_name).returns(''Jonah'').mock
So I started playing around with mocha and found I could actually
already do this!
2008 Jan 28
9
Nested matchers
We''re encountering a failure with Mocha 0.5.6.
We had this expectation:
game_version.expects(:attributes=).with(:game_file =>
kind_of(GameFile), :game_id => @game.id)
This expectation was passing with 0.5.5, but fails with 0.5.6.
I added this test to parameter_matcher_acceptance_test.rb, which
passes in 0.5.5 and fails in 0.5.6
def test_should_match_nested_parameters
2008 Jun 12
2
Google Group?
A number of people have had difficulties subscribing and/or sending
messages to the existing mailing list.
Also I have to spend quite a bit of time moderating spam and the
mailman interface is pretty clunky.
So I was contemplating setting a Google Group up instead. Does anyone
have any objections?
--
James.
http://blog.floehopper.org
http://tumble.floehopper.org
2007 Sep 11
3
Expectations on portions of arguments called.
I''d like to create expectations on just portions of the arguments a
function takes.
For example, I want to verify that the a certain ActiveRecord
association extension adds an order clause to the find options hash.
Currently I simply check the entire argument structure, something like this
def test_referring_journals_should_order_by_citation_count
article =
2007 Oct 25
4
Insure a method is called with no arguments.
We''ve been working with the ParameterMatchers (so cool!) but I don''t
see a way to insure a method is called with no arguments.
I imagined something like:
user = mock(''User'')
user.expects(:friends).with(nothing)
Anyone run into this?
2007 Sep 21
5
Stubbing yielding methods
I''ve just been tying my brain in knots looking at bug #8687 (
http://rubyforge.org/tracker/index.php?func=detail&aid=8687&group_id=1917&atid=7477
).
I''ve been (1) trying to work out whether there is anything logically wrong
with Mocha''s existing behaviour and (2) whether Mocha should support the
requested functionality.
It all centres around the use of the
2013 Feb 18
13
Correct Use or Naming of Migrations
Hi Folks,
There is much discussion where I work at present regarding migrations, and
the ''correct'' usage or not of them.
TL;DR
Should migrations be used just to modify schema, and other ''deploy'' tasks
done other ways? If yes, how to ensure no repeat runs of such tasks
(seeds, jobs etc)
Background
Once you''re live there are often additional things
2006 Nov 04
0
ActiveRecord Observers and Model breakage.
I''m attempting to assign ActiveRecord Observers to some of my models,
specified in config/environment.rb like so,
config.active_record.observers = :presentation_observer,
:asset_observer, :tag_observer
My models use plugins which extend ActiveRecord::Base, including
Sebastian Kanthak''s file_column
Attempting to boot mongrel yields:
2007 Aug 08
1
Mocking Time, delegating to original object
In my Unit tests, I run into the all-too-common problem of
Time.expects(:now) being called by Benchmark before the method is
unmocked.
Instead of messing around with the teardown order, I decided to modify
the Expectation with a new method, .stops_mocking.
Here are the changes I use, including a few monkey patches to push
relevant objects down to where I want them, all wrapped up in a big
ugly