search for: oopsla2004

Displaying 9 results from an estimated 9 matches for "oopsla2004".

2007 Feb 05
10
how does Mocha compare in terms of classical vs mock-based testing, and stubbing???
Hi guys, I''ve just been 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
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
2008 Jan 11
2
guide to good mocking?
Hi all - does anyone know of a good blog post or wiki or something with a good guide to mocking? I''ve got some degree of responsibility for people who are creating mocks. I''m supposed to actually be telling them the best way to do it. In some cases we have code with like a bazillion mock(:x) statements and it''s kind of out of control. I have an idea how the specs should
2007 Feb 22
7
We can''t 100% remove our unit tests from the database, can we?
I hope this isn''t too rambly. This is sort of a brain dump of a subject I''ve been thinking about for months as I''ve used RSpec. Let''s say we''ve got a simple query method, that will find all the users in the DB older than 18. Our model could look like class User < ActiveRecord::Base def self.find_older_than(age) find :all, :conditions =>
2006 Nov 21
5
stubbing in development environment
Hi guys. Quite happy with mocha for testing. It''s been a bit of an eye opener for me, and I expect to begin using it heavily. One other thing I''d like to do is stub out particular class methods in development. Is there a way I can do this with mocha? Jason
2008 May 10
4
Newbie: lambda do...end.should change(Model, :count).by(1). Doesn''t work
Hi to everyone, I''m an RSpec, and BDD in general, newbie so in order to learn I have chosen to use my personal website as a tesbed. I''m having difficulties juggling with mocks, and in particula with the following code. Here''s the controller action: def create @album = Album.new(params[:album]) if @album.save flash[:notice] = "album saved"
2007 Feb 28
12
Specifying that code is called in a block
Not sure if this is possible currently. I have a section of code like this: ActiveRecord::Base.transaction do cow.save! duck.save! dog.save! end (Names changed to protect the innocent.) I''d like to specify that the saves run in a transaction. I can do ActiveRecord::Base.should_receive(:transaction).and_yield But is there any way to specify that the code is
2007 Dec 06
43
Mocks? Really?
OK, so i''ve played a bit with mocks and mock_models in controller and view tests and i have a question. Is this statement really correct: "We highly recommend that you exploit the mock framework here rather than providing real model objects in order to keep the view specs isolated from changes to your models." (http://rspec.rubyforge.org/documentation/rails/writing/views.html
2008 Mar 18
11
"Why not MockEverthing" or why use fixtures for all tests?
Hello fellow RSpec users. Before you all start warming up your flame throwers please let me explain my Subject line. I''ve been working over 4 months on a large Rails project with a few other developers. Test coverage was spotty at best, though they *were* RSpec tests. One of the other developers and I had started adding more tests, mostly controller tests using the methodology