Project

General

Profile

Actions

Defect #7613

closed

Generated test instances may share the same attribute value object

Added by Etienne Massip about 13 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
Code cleanup/refactoring
Target version:
Start date:
2011-02-12
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Actually, this test code will fail :

p1 = Project.generate!
p2 = Project.generate!

assert_not_equal p1.identifier, p2.identifier

That's because ObjectDaddy Project identifier generator actually returns the same object each time.

Thus, in source:trunk/test/exemplars/project_exemplar.rb :

  # Project#next_identifier is defined on Redmine
  def self.next_identifier_from_object_daddy
    @last_identifier ||= 'project-0000'
    @last_identifier.succ!
    @last_identifier
  end

Should be :

  # Project#next_identifier is defined on Redmine
  def self.next_identifier_from_object_daddy(last_identifier)
    last_identifier ||= 'project-0000'
    last_identifier.succ
  end

I'll post a patch soon.


Files

object_daddy_exemplars.patch (16.3 KB) object_daddy_exemplars.patch Etienne Massip, 2011-02-12 14:08
Actions

Also available in: Atom PDF