Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Activity (RSS)

Sunday, November 14 2010
70 Mock#to_ary and Array#flatten problem was updated
  • James Mead
    James Mead commented at 7:05 PM

    Thanks for starting the discussion on the Ruby mailing list - I think it would be useful to find out if this behaviour is intentional. It's worth noting this r...

  • Robert Pankowecki
    Robert Pankowecki commented at 6:03 PM

    I started the discussion about it http://www.ruby-forum.com/topic/450307#961367
    I think that a nice and easy workaround would be to inherit Mocha::ExpectationEr...

Friday, November 12 2010
68 during block for mocha was updated
69 Allow unstubbing of methods was updated
  • James Mead
    • State changed from open to resolved
    by James Mead at 2:38 PM

    I've just pushed up changes to add Mocha::ObjectMethods#unstub. So I'm closing this ticket.

  • James Mead
    • State changed from new to open
    by James Mead at 1:19 PM
73 Consider adding jMock custom actions to provide side effect functionality was updated
1 Mocha::ExpectationError < Exception was updated
Thursday, November 11 2010
73 Consider adding jMock custom actions to provide side effect functionality was updated
  • Alex
    Alex commented at 7:42 PM

    Here's some code pulled from my tumblr-sync code.

    http://pastie.org/1290749

    I wanted to be able to get actual numbers for saves called etc. so that I could ensu...

  • James Mead
    James Mead commented at 6:59 PM

    @alex: to better understand your use case, it would be helpful to see the test and the code e.g. in a Gist

  • James Mead
    James Mead commented at 6:49 PM

    @alex: I thought that one key difference was that you are allowing side effects to change anything, not just parameters passed into the stubbed method.

    @eydaimo...

  • Alex
    Alex commented at 6:30 PM

    To add a use case, I mocked an API and was using some test data (tumblr posts: 5 normal, 4 pics, 3 quotes etc.)

    To check things were saving as they should, I ne...

  • Alex
    Alex commented at 6:29 PM

    Am I wrong, or is the JMock custom action essentially the same thing as this patch?

    JMock uses 'will', I used 'runs'.

    jmock: oneOf (mangoTree).pickFruit(with(an...

1 earlier change…
Monday, November 08 2010
72 Improve test coverage for Integration modules was created
Sunday, October 24 2010
71 Test Mocha under Ruby 1.8.5 was created
  • James Mead
    James Mead created the ticket at 5:47 PM

    I had a problem installing Ruby 1.8.5. I got this response from the author of RVM.

    From: Wayne E. Seguin wayneeseguin@gmail.com
    Date: 12 May 2010 15:01
    Subject:...

Saturday, October 23 2010
70 Mock#to_ary and Array#flatten problem was updated
  • James Mead
    • State changed from new to open
    • Tag changed from bug-report, ruby19 to bug-report, flatten, ruby19, to_a, to_ary
    by James Mead at 2:20 PM

    I can reproduce this problem in a slightly simpler way :-

    $ ruby -v
    ruby 1.9.2p14 (2010-10-02 revision 29393) [x86_64-darwin10.4.0]
    $ irb
    ruby-1.9.2-head > req...
Friday, October 22 2010
70 Mock#to_ary and Array#flatten problem was created
  • James Mead
    James Mead created the ticket at 6:18 PM

    From a message [1] on the mailing list from Robert Pankowecki :-

    ruby-1.9.2-head > m = ActiveSupport::TestCase.new('a').mock # => #<Mock:0xae73b64>
    ruby-1.9.2-...
69 Allow unstubbing of methods was updated
Sunday, October 17 2010
69 Allow unstubbing of methods was updated
  • Alex
    Alex commented at 5:40 PM

    I created a fix for this - http://github.com/alexheaton/mocha (alexheaton/unstubs or master branches)

    I'd really welcome some feedback, I'm sure there are thing...

Wednesday, October 13 2010
69 Allow unstubbing of methods was updated
  • Jamie Phelps
    Jamie Phelps commented at 5:49 PM

    I was looking for this exact functionality for unstubbing from any_instance and I think that providing at least a block-enabled variant is the way to go. Here a...

Monday, August 09 2010
69 Allow unstubbing of methods was updated
68 during block for mocha was updated
  • Deleted User
    Deleted User commented at 4:51 PM

    I agree that this is a better solution. With a solid #unstub in place, #during becomes trivial to write.

    The reason I suggested #during is specifically because ...

  • James Mead
    James Mead commented at 10:44 AM

    Thanks for all the discussion on this ticket. I think everyone has made some good points.

    I agree that it should be easier to "unstub" a method. I thought there...

Sunday, August 08 2010
14 [#8687] Block's return value is dropped on stubbed yielding methods. was updated
  • visnu
    • Assigned user set to James Mead
    • Milestone order changed from 0 to 0
    by visnu at 1:56 AM

    +1

    I just ran into this problem trying to test my code that uses the same idiom for open-uri:

    json = open(url) { |f| JSON.parse(f.read)['root'] }
    

    here, I want...

Thursday, July 29 2010
68 during block for mocha was updated
  • Deleted User
    Deleted User commented at 5:35 AM

    during seems like a reasonable and simple solution to the general problem that is:
    "it is hard to unstub"

    then is a fine solution if you're not worried about "t...

  • Josh Clayton
    Josh Clayton commented at 4:57 AM

    Those are great examples of stubbing, but why would you only need a stub for part of that test? Are you familiar with Mocha's then? This can be used to achieve ...

Wednesday, July 28 2010
68 during block for mocha was updated
  • Deleted User
    Deleted User commented at 4:42 PM

    Right - so the only reason (IMHO) that timecop exists is because these few lines of code are missing from Mocha. Why perpetuate the need for yet another gem?

    Ot...

  • Josh Clayton
    Josh Clayton commented at 1:46 PM

    Outside of stubbing Time, are there any decent use cases? I can't think of any. If this is what you're going for, why not use a library built specifically for t...

Tuesday, July 27 2010
68 during block for mocha was updated
  • Ken Collins
    Ken Collins commented at 7:09 PM

    Yea, totally can without.

    def blocked
      puts 'before'
      yield
      puts 'after'
    end
    
    blocked do
      puts 'doing'
    end
    
    # >> before
    # >> doing
    # >> after
    
  • Deleted User
    Deleted User commented at 5:45 PM

    I use this in rspec tests, mostly. It's also useful if you want to have part of a test say that "now" is 2 weeks ago, then 1 week ago, then really now.

    As for t...

  • Ken Collins
    Ken Collins commented at 2:39 PM

    Interesting, I might use this. It does seem very useful when you need discreet stubs during a long running test typically in integration/functional land. Possib...

  • James Mead
    James Mead created the ticket at 9:37 AM

    James,
    Thanks for Mocha!

    There are times when I want to stub something just briefly. Time.now, for instance; in rspecs, or even in cucumber. So I monkey patch m...

Saturday, June 05 2010
50 after mocha update from 0.9.5 to 0.9.6 unit tests fails to execute was updated
  • James Mead
    James Mead commented at 5:46 PM

    I've pushed up an attempted fix for this [1]. Is there any chance you could try it out?

    I'm not 100% convinced it's a sensible solution, but it seems to do the ...

Tuesday, June 01 2010
50 after mocha update from 0.9.5 to 0.9.6 unit tests fails to execute was updated
  • James Mead
    • State changed from resolved to open
    by James Mead at 8:13 AM
  • James Mead
    James Mead commented at 8:12 AM

    Hi James,

    That's really helpful - thanks.

    It might be worth trying the same experiment with Mocha built from HEAD. I suspect it won't actually fix the problem, ...

Monday, May 31 2010
50 after mocha update from 0.9.5 to 0.9.6 unit tests fails to execute was updated
  • James Adam
    James Adam commented at 10:26 PM

    I have hit this issue outwith any Rails context. With both Ruby 1.8.7 and 1.9.1, if you install the test-unit gem (2.0.7) and mocha (0.9.8), and then run the fo...

Sunday, May 16 2010
67 expectations changing visibility of methods was created
Monday, March 22 2010
66 Improve performance of backtrace filtering was updated
Wednesday, March 17 2010
66 Improve performance of backtrace filtering was created
  • James Mead
    James Mead created the ticket at 7:11 PM

    Nikolai Weibull posted the following to the Mocha mailing list :-

    Mocha::BacktraceFilter creates a new Regexp object for every line of every backtrace it filte...

65 Improve documentation for Expectation#raises was created
  • James Mead
    James Mead created the ticket at 7:06 PM

    You can pass an instance of the exception as an alternative to the exception class. This is particularly useful when you have an exception with a constructor wi...

Thursday, March 11 2010
64 Investigate RunCodeRun build failures was created
  • James Mead
    James Mead created the ticket at 12:04 PM

    It looks like there might be a problem with more recent versions of test-unit.

63 Improve documentation for Mocha::ParameterMatchers::Base#& and #| was created
Sunday, February 21 2010
61 backtrace filter not working properly for files in e.g. integration directory was created
Saturday, February 20 2010
60 Test failure with test-unit v2.0.6 was created
  • James Mead
    James Mead created the ticket at 10:29 AM

    /usr/local/ruby-1.8.6-p287/lib/ruby/gems/1.8/gems/test-unit-2.0.6/lib/test/unit/ui/console/testrunner.rb:329: uninitialized constant Test::Unit::UI::Console::D...

Monday, December 14 2009
13 [#22564] Allow default return value to be specified for stub_everything was updated
Wednesday, December 02 2009
59 Improve documentation for Expectation#mutliple_yields was created
Tuesday, November 24 2009
58 Add debug logging to help diagnose load order problems was created
  • James Mead
    James Mead created the ticket at 10:24 AM

    Since the changes in version 0.9.6, a number of people have been reporting load order problems.

    It might be helpful to add some debug logging to help diagnose t...