Displaying 3 results from an estimated 3 matches for "mock_company".
2007 Jan 24
2
A spec where interaction-based testing breaks down... (at least for now)
Here are the specs:
context "Finding all the stylesheets available to a company" do
setup do
@mock_company = mock("company")
@mock_company.stub!(:to_param).and_return "1"
Stylesheet.stub!(:find)
end
def do_find
Stylesheet.find_available_to @mock_company
end
specify "should convert the company into a parameter" do
@mock_company.should_receive(:to_pa...
2007 Nov 21
6
How thorough do you test?
Testing models is great and would not be able to create anything without
it, but I am finding testing the controllers and views is a pain.
Rest based controllers don''t seem to change that much when compared to
the auto-generated code that obviously works.
As for views I fail to see why testing it with a mock model does
anything. Nothing is ensuring that when changes are made to the
2007 Sep 16
4
How far to go with ActiveRecord unit tests without hitting the database?
I''m currently try to push my limits a little bit with some of my unit
testing -- trying to avoid saving ActiveRecord objects to the database and
take advantage of mock/stub objects.
How far should I expect to get in this direction? From what I can tell,
ActiveRecord seems to fight me when it comes to associations. In other
words, many associations seem to require database queries.