I would like to have some valid mock models readily available in the
helper module, but when I try to access the helper I get the error
saying that the method is not found.
describe MembersHelper do # Helper methods can be called directly in the
examples (it blocks)
member = mock_model(Member)
require File.dirname(FILE) + ‘/…/spec_helper’
describe Member do
@member = valid_member_mock
it “should be valid” do
NameError in ‘Spec::Rails::Example::ModelExampleGroup Member should be
undefined local variable or method `valid_member_mock’ for
I would assume that rails is including the helper module behind the
scenes, although I have explicitly made the require with no luck.
What am I missing? Are these helpers only for controller tests?