now every issue created by FactoryGirl is valid. The valid_issue generator was removed

pull/1186/head
Philipp Tessenow 12 years ago
parent 8b661f1e2b
commit d41dcd02e6
  1. 2
      spec/factories/comment_factory.rb
  2. 10
      spec/factories/issue_factory.rb
  3. 4
      test/unit/watcher_test.rb

@ -2,6 +2,6 @@ FactoryGirl.define do
factory :comment do
author :factory => :user
sequence(:comments) { |n| "I am a comment No. #{n}" }
commented :factory => :valid_issue
commented :factory => :issue
end
end

@ -1,17 +1,15 @@
FactoryGirl.define do
factory :issue do
priority
project
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 = FactoryGirl.build(:valid_project)
issue.tracker = issue.project.trackers.first
end
after :build do |issue|
# a valid issue needs a tracker which is known to its project
issue.tracker = issue.project.trackers.first unless issue.tracker
end
end
end

@ -53,7 +53,7 @@ class WatcherTest < ActiveSupport::TestCase
@user.firstname = nil
assert !@user.valid?
issue = FactoryGirl.create(:valid_issue)
issue = FactoryGirl.create(:issue)
issue.watcher_users << @user
issue.save!
assert issue.watched_by?(@user)
@ -70,7 +70,7 @@ class WatcherTest < ActiveSupport::TestCase
end
def test_watcher_user_ids_should_make_ids_uniq
issue = FactoryGirl.create(:valid_issue)
issue = FactoryGirl.create(:issue)
issue.watcher_user_ids = ['1', '3', '1']
assert issue.valid?
assert_equal 2, issue.watchers.count

Loading…
Cancel
Save