Displaying 20 results from an estimated 1000 matches similar to: "Proxies"
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!
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
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
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
2007 Nov 13
5
how to ensure signature compliance while mocking in ruby
On 13/11/2007, Pradeep Gatram <pradeep.gatram at gmail.com> wrote:
>
> Let me put my dilemma as an example. Take a look at a snippet from
> FooTest.
>
> #using mocha
> def test_method1
> Bar.expects(:method2).with(''param1'', ''param2'').once
> Foo.method1
> end
>
> And now the implementation
>
> class Foo
> def
2007 Apr 11
0
Fwd: [ mocha-Feature Requests-7119 ] ability to specify call order
---------- Forwarded message ----------
From: noreply at rubyforge.org <noreply at rubyforge.org>
Date: 11-Apr-2007 15:39
Subject: [ mocha-Feature Requests-7119 ] ability to specify call order
To: noreply at rubyforge.org
Feature Requests item #7119, was opened at 2006-12-06 00:30
You can respond by visiting:
2007 Aug 22
1
mock framework ethics question
Hi James, Jim, and everyone else who''s listening.
I''ve been investigating an interesting bug related to mocks and rails
AssociationProxies. See
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=12547&group_id=797
for details.
The crux is that if you do this (rspec mock syntax):
obj.should_receive(:msg).with(mock_of_a_model)
and the implementation does
2007 Jul 30
6
Object.stubs doesn''t seem to work.
Hi
I''m using Mocha 0.5.3 and I want to stub out a call to Time.now, just
like the example in the post
http://blog.floehopper.org/articles/2007/06/08/mocha-0-5-released
However, trying it in irb gets me the following error:
>> require ''mocha''
=> true
>> Time.stubs(:now).returns(Time.parse(''Thu Feb 01 00:00:00 UTC 2007''))
NoMethodError:
2007 Mar 23
2
Mocha 0.4.0 Hates My App
Hi all -
I''ve recently made the leap from FlexMock to Mocha for mocks within
my app. Today I decided to upgrade from Mocha 0.3.2 to Mocha 0.4.0.
So I updated the gem, started rake and went to get some coffee. I
came back 5 mins later and my units (which were clean) are now
reporting 97 failures (!!!). Every failure reports a callstack like
this:
18) Error:
2007 Sep 11
1
Fwd: [ mocha-Feature Requests-13763 ] add with_any_arguments method
---------- Forwarded message ----------
From: noreply at rubyforge.org <noreply at rubyforge.org>
Date: 7 Sep 2007 22:43
Subject: [ mocha-Feature Requests-13763 ] add with_any_arguments method
To: noreply at rubyforge.org
Feature Requests item #13763, was opened at 2007-09-07 17:43
You can respond by visiting:
2008 Jan 20
2
Bug #17118 - expectations should take precedence over stubs
I wanted to draw attention to this bug report [A] which highlights a change
that was made between Mocha 0.4 and 0.5.
It may have lead to tests which pass unexpectedly. Does my explanation
(below) make sense to people?
It feels like we should at least add some warnings to the documentation.
You are correct that this behaviour did change between Mocha v0.4.0 and
> v0.5.0 (in revision 115).
2007 Dec 23
0
Fwd: [ mocha-Bugs-16523 ] Ruby 1.9 gives warning
FYI - I''ve just released Mocha 0.5.6 to make Ruby 1.9 compatibility
fixes available for those using released packages rather than
subversion trunk. I''m not feeling well and so haven''t been able to
test it other than by running all the tests using Ruby 1.9. Please let
me know if you have any problems using it. Remember that it sometimes
takes a while for a new gem
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 07
0
Supressing RDoc links
I recently noticed some anomalies in the Mocha RDoc. Within a method RDoc
comment, any word that happens to be the same as a method in the same class
gets turned into a link. You can see an example [2] with the word "once" and
another [3] with the words "yields", "times" and "with".
Does anyone know how to stop these words incorrectly being made into
2007 Apr 16
0
Fwd: ANN: FlexMock 0.6.0 Released
FYI - Jim Weirich just released an rspec-compatible version of
FlexMock. For those of you using trunk, you can now use either
FlexMock, Mocha, or RSpec''s built-in mocking framework by saying:
Spec::Runner.configure do |config|
config.mock_with :flexmock # or :mocha or :rspec (default)
end
The choice is yours. Mock in peace.
Cheers,
David
---------- Forwarded message ----------
From:
2008 Jun 12
2
Anyone using trunk?
Has anybody been using Mocha trunk over the last month or two?
I''ve done quite a bit of internal refactoring and wondered whether
anyone had any problems.
There are also a bunch of new features e.g. states, sequences, extra
parameter matchers & configurable warnings, but these are not
documented in the on-line rdoc.
I wondered if anyone has been looking at the rdoc in trunk and
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 Oct 15
0
Fwd: Content filtered message notification
I''m not sure why mailman bounced your message (perhaps because you are not
subscribed to the mailing list), but I''m glad you have solved your problem.
Cheers, James.
---------- Forwarded message ----------
From: mailman-bounces at rubyforge.org <mailman-bounces at rubyforge.org>
Date: 14 Oct 2007 17:21
Subject: Content filtered message notification
To:
2007 May 07
6
mock frameworks
Just curious - now that rspec (as of 0.9) let''s you choose your mock
framework, how many of you are actually using (or planning to use)
mocha or flexmock?
Anybody planning to use any other mock framework besides rspec, mocha
or flexmock?
Thanks,
David
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