Feature test Rails engine using current_user -
i'm breaking big rails app pieces using mountable engines.
my engine accesses current user in controller so:
require_dependency "lesson_notes/application_controller" module lessonnotes class notescontroller < applicationcontroller def index @notes = current_user.notes end end end
in feature spec create user using factorygirl , log user in - this:
feature "notes page" let(:user) { create(:user) } before login_as user visit "/lesson_notes" end end
however, in engine feature spec, how create user using factorygirl? model in parent app in engine mounted, how accessible engine specs?
from point of view, engine separate box main application , mounted in application, hence it's test cases should independent of those.
may should mock user model test engine's feature instead of creating factory.
Comments
Post a Comment