search for: mocha

Displaying 20 results from an estimated 248 matches for "mocha".

Did you mean: micha
2007 Dec 21
5
Mocha and rails 2.0.2?
Folks- With Rails 2.0.2, I''m seeing mocha failures where they did not fail with Rails 2.0.1 test_set_to_process_fail_in_transaction(FileRecordTest): NoMethodError: undefined method `ord'' for 63:Fixnum /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/class_method.rb:45:in `hidden_method'' /home/wolpert/svn/...
2007 Jun 11
12
Mocking system/`
This drives me insane on a regular basis. How does one mock system(''blah'') or `blah` ? Adding expectations on Kernel doesn''t do it. Adding expectations on Object just makes me sad: Object.any_instance.expects(:system).with(''ls'') # => #<Mock:0x12b584e>.system(''ls'') - expected calls: 0, actual calls: 1 And this really
2007 Feb 05
10
how does Mocha compare in terms of classical vs mock-based testing, and stubbing???
...een reading Martin Fowler''s article re mock versus stubbing<http://martinfowler.com/articles/mocksArentStubs.html>where he compares traditional TDD testing techniques with mock based testing. I''d be interested in comments from a ruby on rails perspective in terms of this and Mocha? For example: a) Do you see Mocha as a robust way to test Ruby on Rails based apps? b) Why would one use Mocha over traditional non-mock object based testing for Ruby on Rails? c) Is Mocha a good choice for stubbing out other components that the rails app may interact with, for the purpose of t...
2006 Oct 25
5
Mocha, Stubba and RSpec
Hi, I''ve been reading with interest the threads trying to integrate Mocha and Stubba with RSpec. So far, I''ve made the two changes in spec_helper.rb suggested, but discovered another one that neither of the archives mentions: If you use traditional mocking: object = mock or the stub shortcut : object = stub(:method => :result), you run into namespace co...
2007 Mar 12
10
using mocha with rspec
Hi folks. I''ve just started using rspec and I have to say it''s very nice. The thing is, I prefer mocha''s mocking dialect. So I thought a simple require ''mocha'' would set me up. Unfortunately, rspec does all its goodness using do/end blocks in anonymous classes, so it wasn''t quite that obvious. Anyway, here is the incantation I ended up using in my equivalent o...
2006 Sep 08
1
A quick guide to Mocha
Hello :) Having just gone through the (admittedly simple) API of Mocha to learn how it works, I wrote a quick guide (190 lines) to help others get up to speed. I''ve attached it as RDOC and as HTML. It is a first draft - please help me improve by giving feedback ! Contents : Overview - Quick overview of Mocha Unit testing, mock object and stubs - Very quic...
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
I happened to mix ryan bates'' authentication scaffold with rspec_scaffold on a demo project. and ran into the problem of mixing mock frameworks...ryan uses mocha. So, as a learning experience, I choose to redo ryan''s tests without mocha but ran into a strange problem with tests of the User model. With debugging you can see.... If you run just the user_spec.rb file, everything is fine....rspec goes through the User model. However, if you run all t...
2006 Sep 11
4
Using rspec and mocha
I prefer to use rspec than test::unit for developing my apps. However I''ve found its mocking library to be pretty inflexible compared to Mocha. This isn''t really a surprise since rspec isn''t intended as a mocking framework, whereas Mocha is. So I''d like to play to both of their strengths and use rspec as my testing/specification framework and Mocha do to mocks. I installed the plugins for each, and whenever I...
2010 Nov 12
2
pending tests fail when I switch to mock_with :mocha
First of all, please direct me into how better to search existing threads in this mailing list. Ok to my rspec 2.0.1 mocha 0.9.8 issue: given a controller test before do subject.expects(:authenticate).once end it "should bla bla" do pending "PENDING, shouldn''t fail?" end with config.mock_with :rspec it''s ok: pending, but with config.mock_with :mocha if fails!...
2007 Jul 24
3
mocha tarballs don''t uncompress cleanly
...nto the problem. Please let me know if I can do anything to help. I have had problems previously with tar including Mac resource fork files. Could this be what is causing your problem? James. On 24 Jul 2007, at 20:42, Antonio Terceiro wrote: > Hi James, > > First of all, thanks for mocha, it''s a really great library and helps > testing a lot. :) > > I downloaded the mocha tarball for versions 0.5.0, 0.5.1 and 0.5.2 > (didn''t test older ones), and when uncompressing all of them I get the > following error: > > -------------------8<----------...
2006 Sep 11
4
Using rspec and mocha
I prefer to use rspec than test::unit for developing my apps. However I''ve found its mocking library to be pretty inflexible compared to Mocha. This isn''t really a surprise since rspec isn''t intended as a mocking framework, whereas Mocha is. So I''d like to play to both of their strengths and use rspec as my testing/specification framework and Mocha do to mocks. I installed the plugins for each, and whenever I...
2007 Jun 15
0
Fwd: [ mocha-Patches-11583 ] Mocha 0.5.0 throwing unexpected warnings, one line patch included
Begin forwarded message: > From: <noreply at rubyforge.org> > Date: 15 June 2007 10:44:07 BDT > To: noreply at rubyforge.org > Subject: [ mocha-Patches-11583 ] Mocha 0.5.0 throwing unexpected > warnings, one line patch included > > Patches item #11583, was opened at 2007-06-14 21:28 > You can respond by visiting: > http://rubyforge.org/tracker/? > func=detail&atid=7479&aid=11583&group_id=1917 > > Cate...
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded correctly to the id message. Here''s the change I put into my copy of head. Index: lib/mocha/mock_methods.rb =================================================================== --- lib/mocha/mock_methods.rb (revision 1114) +++ lib/mocha/mock_methods.rb (working copy) @@ -68,6 +68,7 @@ method_names = method_names.is_a?(Hash) ? method_names : { method_names => nil } me...
2006 Dec 15
3
how to install from svn?
When trying to run Chris samples I get error: /usr/lib/ruby/gems/1.8/gems/mocha-0.3.2/lib/smart_test_case.rb:3: uninitialized constant Test (NameError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' from /usr/lib/ruby/gems/1.8/gems/mocha-0.3.2/lib/mocha.rb:1 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require...
2001 Nov 21
3
smbpasswd -r pdd not working
Hi, I am running Samba 2.2.1 on a Redhat 7.2 machine and have the following in smb.conf: workgroup = AGS_NT security = domain password server = mocha bigblue encrypt passwords = yes everything else is default. "mocha" is the PDC and is a NT4 box". The machine has joined the domain with "smbpasswd -j AGS_NT". When using "smbpasswd -f mocha" is fails: $ smbpasswd -D 3 -r mocha Unknown parameter encoun...
2007 Jan 23
2
SslRequirements plugin and mocha
Hi. I''m loving mocha but have ran into a problem with using the mocha plugin with a project that has the SslRequirement plugin. It seems there is some conflict between the two? Any ideas? $ ruby test/functional/calendar_controller_test.rb /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/depe...
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 Jun 12
4
advice on new failures with 0.5.0
Hi all, We just updated to the latest version of Mocha and now we''re seeing a lot of odd test failures. If this isn''t the appropriate place for a question like this, please let me know. Say I have code like this in a controller: DataMonitor.toggle_notification! And I mock it like this: DataMonitor.any_instance.stubs(:toggle_no...
2007 Apr 12
15
Preview of Latest Mocha Changes
I''ve finally managed to find some time to do some serious work on Mocha. There are some code snippets on my blog (http://blog.floehopper.org/articles/2007/04/12/preview-of-latest-mocha-changes) showing the new functionality available in trunk (revision 128). I don''t don''t know how many people out there are using trunk, but it would be great to get som...
2006 Sep 22
2
foo.expects(:blah).returns(10).then(11) syntax
I recently needed the behavior of my object to change on subsequent method calls so I added the syntax above. Here''s the diff of changes I made: Index: test/mocha/expectation_test.rb =================================================================== --- test/mocha/expectation_test.rb (revision 854) +++ test/mocha/expectation_test.rb (working copy) @@ -95,6 +95,12 @@ assert_equal 99, expectation.invoke end + def test_should_return_value...