Project

General

Profile

Fixtures in unit and integration tests

Added by Kirill Bezrukov (RedmineUP) almost 13 years ago

I have a problem with redmine plugins unit testing, because fixtures loaded only with functional tests. Anyone else encountered with such problem? I don't use rspec and want to test with redmine and rails included tools.


Replies (5)

RE: Fixtures in unit and integration tests - Added by Evgeny Tsirkin almost 13 years ago

Yep.
Did you found a solution?

RE: Fixtures in unit and integration tests - Added by Evgeny Tsirkin almost 13 years ago

Well actually I couldn't get the fixtures to load at all.
Have you?

RE: Fixtures in unit and integration tests - Added by Kirill Bezrukov (RedmineUP) almost 13 years ago

I didn't found any solution. And for me functional tests works well and loads fixtures but unit and integrational no

RE: Fixtures in unit and integration tests - Added by Thomas Kohler over 12 years ago

Hi, do you have any progress to solve the problem? I'm starting with some unit tests and the fixture loading also not working for me.

I'm afraid of the hints on Plugin_Tutorial site don't work.

First I have created a "test_helper.rb" file. Than I have initialized the database:

$ rake db:drop db:create db:migrate db:migrate_plugins redmine:load_default_data RAILS_ENV=test

But on execution of my test the following error occurs:

StandardError: No fixture with name 'issue_1' found for table 'issues'

My issues.yml file content:

---
issue_1:
id: 1
tracker_id: 1
project_id: 1
subject: "MyTestIssue"
description: "MyDescription"
status_id: 1
priority_id: 4
author_id: 1
issue_2:
id: 2
tracker_id: 2
project_id: 2
subject: "MyTestIssue2"
description: "MyDescription2"
status_id: 1
priority_id: 4
author_id: 1

Please can anyone help me to make some progress in unit testing of redmine plugins.

RE: Fixtures in unit and integration tests - Added by Thomas Kohler over 12 years ago

adding

self.fixture_path = File.dirname(FILE) + "/../fixtures/"

to each test file make things better. But is that the right solution?

    (1-5/5)