Displaying 14 results from an estimated 14 matches for "mocksarentstub".
Did you mean:
mocksarentstubs
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 on Rails based apps?
b) Why would one use Mocha...
2008 May 18
2
Using Hash to mock classes that respond to :
Hi
I''ve been doing this a while now. If I have a class that responds to :
[], and all I''m interested in stubbing is that method, then instead of
using a mock I just create a hash. (Similarly, you could create an
array when you are testing an Enumerable object.)
Example from code I just worked on, where uses MigrationGraph#[] looks
up graph vertices by name:
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 Jan 11
4
counter-intuitive behaveour when passing a proc to Mocha::Expectation#returns
Let''s say that I have a procedure that:
* gets the number of bytes to write into some file
* and returns the number of successfully written bytes
def save( text, len )
This procedure is being used all over the place especially inside the method
"process" which I want to test. Thus in order not to polute my filesystem I stub
the "save" procedure. But of course in
2007 Aug 29
5
Undefined method stub
When I try to execute the following example, I get an error message:
/usr/local/lib/ruby/gems/1.8/gems/mocha-0.5.4/lib/mocha/object.rb:40:
in `expects'': undefined method `stub'' for nil:NilClass (NoMethodError)
from test8.rb:5
What could be the reason? I tried with the latest Mocha Ruby gem, and I
also tried it with the Rails plugin.
The example:
require
2007 Feb 06
3
Using any_instance with Rails to make sure the right thing is saved?
I''d like to test that an object with the correct attributes is saved,
something like:
def test_create_without_existing_suite
this = self
w = Annotation.any_instance.expects(:save).with do |x|
this.assert_equal ''fnord'',
some_way_get_the_name_of_the_receiver_of_save
true
end
w.returns true
end
But the object is created inside the method
2007 Mar 27
3
Stubbing out method for all instances
I am using the acts_as_state_machine plugin to control state of an
object in my app, however when testing this I need to be able to stub
out the guard conditions so that state will change when I fire off an
event without depending on other models.
Guard conditions simply return true or false so I have an instance
method:
def encoded?
<check state of other objects>
return true
2017 Jan 04
5
RFC: Reconsidering adding gmock to LLVM's unittest utilities
...to try and lay out the
issues in a way folks could understand, and the examples, while hopefully
useful, are quite large and complex.
Please don't hesitate to ask questions if stuff isn't clear.
-Chandler
[1]: https://en.wikipedia.org/wiki/Test_double
[2]: http://martinfowler.com/articles/mocksArentStubs.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170104/b1da1d7c/attachment.html>
2007 May 24
9
Mocking, changing method interfaces and integration tests
Suppose we have a method ''foo'' which internally uses another method
''bar''.
Being good BDDers we mock out the ''bar'' method. After all, we only
want to spec the ''foo'' method - actually running the ''bar'' method
means slower, less maintainable and brittler specs. That''s why we <3
mocking,
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"
2008 May 20
4
New to "Agile Development" - should I use RSpec or Test::Unit?
Hi everyone, I''m just now really starting to look into Agile
Development, and so I''m trying to gauge what the Rails community''s
preference is in regards to using RSpec versus the built-in Test::Unit.
I haven''t really delved much into testing in the past, I''m sad to say,
but I understand why it''s beneficial to writing maintainable code and
2007 Oct 19
27
Assumption tests
Hi all,
I''ve been thinking about the whole validator/relationship speccing
issue, and I came up with a suggestion, which I''d love to get some
feedback on.
The full article is available at http://www.inter-sections.net/
2007/10/19/what-to-test-and-specify-and-where-to-do-it/ , with the
relevant bit being about halfway down, but here''s the gist of it:
1.
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
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