[PLUG-IN Development] - Help with testing

Added by Bruno Nagano 9 months ago


Sorry if this is a stupid question, but I am new to Ruby, Rails and Redmine development. Before anyone tells me to read the manuals, I have read the Rails guides and the Redmine Plug-in development tutorial.

I am trying to create a test that executes the following instruction:

On the setup method, I execute the following code:
@request.session[:user_id] = 2
@project = projects(:projects_001)

On the test, I am trying to list all the visible trackers for a current user using the following command:
@workflow = @project.trackers.visible(User.current)

However, when I inspect workflow I receive an empty object.

Inspecting the User object returns user "jsmith". Inspecting @project.trackers also returns all expected trackers.
I added the following fixtures: projects, issue_statuses, project_trackers, trackers, users, member, roles, member_roles, workflows and issues.

What am I missing in order to be able to make the trackers.visible(User.current) work?

PS: I tried the same instruction on the controller and I am able to print all the trackers, visible by the user, on the view.