repair some of our factories

pull/1186/head
Philipp Tessenow 12 years ago
parent 60acb17098
commit 1a1bd1e8e9
  1. 5
      spec/factories/issue_factory.rb
  2. 4
      spec/factories/issue_priority_factory.rb
  3. 2
      spec/factories/project_factory.rb
  4. 17
      spec/factories/tracker_factory.rb

@ -1,14 +1,15 @@
FactoryGirl.define do
factory :issue do
priority
status :factory => :issue_status
sequence(:subject) { |n| "Issue No. #{n}" }
description { |i| "Description for '#{i.subject}'" }
tracker :factory => :tracker_feature
author :factory => :user
factory :valid_issue do
after :build do |issue|
issue.project = Factory.build(:valid_project)
issue.project = FactoryGirl.build(:valid_project)
issue.tracker = issue.project.trackers.first
end
end

@ -2,11 +2,11 @@ FactoryGirl.define do
factory :priority, :class => IssuePriority do
sequence(:name) { |i| "Priority #{i}" }
active true
factory :priority_low do
name "Low"
end
factory :priority_normal do
name "Normal"
end

@ -3,7 +3,7 @@ FactoryGirl.define do
sequence(:name) { |n| "My Project No. #{n}" }
sequence(:identifier) { |n| "myproject_no_#{n}" }
enabled_module_names Redmine::AccessControl.available_project_modules
factory :public_project do
is_public true
end

@ -9,6 +9,10 @@ FactoryGirl.define do
is_in_chlog true
position 1
# reuse existing tracker with the given name
# this prevents a validation error (name has to be unique)
initialize_with { Tracker.find_or_create_by_name(name)}
factory :tracker_feature do
name "Feature"
position 2
@ -23,13 +27,14 @@ FactoryGirl.define do
name "Task"
position 4
end
end
factory :tracker_with_workflow do
sequence(:name) { |n| "Tracker #{n}" }
sequence(:position) { |n| n }
after :build do |t|
t.workflows = [FactoryGirl.build(:workflow_with_default_status)]
end
factory :tracker_with_workflow, :class => Tracker do
is_in_chlog true
sequence(:name) { |n| "Tracker #{n}" }
sequence(:position) { |n| n }
after :build do |t|
t.workflows = [FactoryGirl.build(:workflow_with_default_status)]
end
end
end

Loading…
Cancel
Save