Displaying 2 results from an estimated 2 matches for "mock_employee".
2007 Oct 16
3
Controller iterating through returned records and appending to each
...#39;
describe ManagementController, "GET /management/employee_report" do
before(:each) do
@bg1 = mock_model(Billablegoal, :effective_date => Date.today-3.months,
:goal => 50)
@bg2 = mock_model(Billablegoal, :effective_date => Date.today + 1.month,
:goal => 75)
@mock_employee = mock_model(Employee, :billablegoals => stub(Array,
:select => [@bg1], :empty? => false))
@employees = [@mock_employee]
@employees.each { |f| f.stub!(:current_goal=) }
@employees.each { |f| f.stub!(:current_goal) }
Employee.stub!(:find_active_employees).and_return(@employe...
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.