rewriting some factories

This commit is contained in:
2019-01-13 10:01:22 +01:00
parent fea219ba92
commit 71d14c83ae
7 changed files with 46 additions and 6 deletions

View File

@@ -4,5 +4,6 @@ FactoryGirl.define do
factory :calendar do
name "MyString"
public false
association :rubrik, factory: :rubrik
end
end

View File

@@ -2,9 +2,12 @@
FactoryGirl.define do
factory :calentry do
start "2013-08-05 21:17:10"
start 1.hours.ago
ende "2013-08-05 21:17:10"
summary "MyString"
typ 1
association :calendar, factory: :calendar
end
end

View File

@@ -5,6 +5,16 @@ FactoryGirl.define do
parent nil
intern false
meetingtyp nil
# association :calentry, factory: :calentry
after(:build) do |c|
c.calentry=FactoryGirl.build(:calentry, typ: 2)
end
# trait :without_calentry do
# calentry nil
# end
end
end

View File

@@ -4,6 +4,7 @@ FactoryGirl.define do
desc "MyText"
agendaintern false
protocolintern false
association :rubrik, factory: :rubrik
end
end

View File

@@ -1,7 +1,24 @@
FactoryGirl.define do
sequence (:title) {|n| "Wichtige Neuigkeit #{n}"}
sequence (:text) {|n| "Wichtiger text #{n}"}
factory :neuigkeit do
title "WIChtige Neuigkeit"
text "<p> Das ist eine wichtige Information </p>"
title
text
datum 1.days.ago
association :author, factory: :user
trait :with_rubrik do
association :rubrik, factory: :rubrik, public: true
end
trait :with_intern_rubrik do
association :rubrik, factory: :rubrik, public: false, name: "InterneRubrik"
end
trait :with_meeting do
association :meeting, factory: :meeting
end
trait :unpublished do
datum nil
end
end
end

View File

@@ -2,5 +2,6 @@ FactoryGirl.define do
factory :rubrik do
name "Allgemeine"
desc "Allgemeine Test News"
public true
end
end

View File

@@ -1,11 +1,18 @@
FactoryGirl.define do
sequence (:email) {|n| "testuser#{n}@fet.at"}
factory :user do
email "testuser@test.at"
email
password "password"
password_confirmation "password"
factory :other_user do
email "othertest@test.at"
end
trait :fetuser do
after(:create) do |user|
user.after_create {|u| u.add_role("fetuser")}
end
end
end
end