forked from bofh/fetsite
rewriting some factories
This commit is contained in:
@@ -4,5 +4,6 @@ FactoryGirl.define do
|
|||||||
factory :calendar do
|
factory :calendar do
|
||||||
name "MyString"
|
name "MyString"
|
||||||
public false
|
public false
|
||||||
|
association :rubrik, factory: :rubrik
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :calentry do
|
factory :calentry do
|
||||||
start "2013-08-05 21:17:10"
|
start 1.hours.ago
|
||||||
ende "2013-08-05 21:17:10"
|
ende "2013-08-05 21:17:10"
|
||||||
summary "MyString"
|
summary "MyString"
|
||||||
typ 1
|
typ 1
|
||||||
|
|
||||||
|
association :calendar, factory: :calendar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,16 @@ FactoryGirl.define do
|
|||||||
parent nil
|
parent nil
|
||||||
intern false
|
intern false
|
||||||
meetingtyp nil
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ FactoryGirl.define do
|
|||||||
desc "MyText"
|
desc "MyText"
|
||||||
agendaintern false
|
agendaintern false
|
||||||
protocolintern false
|
protocolintern false
|
||||||
|
association :rubrik, factory: :rubrik
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,24 @@
|
|||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
sequence (:title) {|n| "Wichtige Neuigkeit #{n}"}
|
||||||
|
sequence (:text) {|n| "Wichtiger text #{n}"}
|
||||||
factory :neuigkeit do
|
factory :neuigkeit do
|
||||||
title "WIChtige Neuigkeit"
|
title
|
||||||
text "<p> Das ist eine wichtige Information </p>"
|
text
|
||||||
datum 1.days.ago
|
datum 1.days.ago
|
||||||
|
association :author, factory: :user
|
||||||
|
|
||||||
|
trait :with_rubrik do
|
||||||
|
association :rubrik, factory: :rubrik, public: true
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ FactoryGirl.define do
|
|||||||
factory :rubrik do
|
factory :rubrik do
|
||||||
name "Allgemeine"
|
name "Allgemeine"
|
||||||
desc "Allgemeine Test News"
|
desc "Allgemeine Test News"
|
||||||
end
|
public true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
sequence (:email) {|n| "testuser#{n}@fet.at"}
|
||||||
factory :user do
|
factory :user do
|
||||||
email "testuser@test.at"
|
email
|
||||||
password "password"
|
password "password"
|
||||||
password_confirmation "password"
|
password_confirmation "password"
|
||||||
factory :other_user do
|
factory :other_user do
|
||||||
email "othertest@test.at"
|
email "othertest@test.at"
|
||||||
end
|
end
|
||||||
|
trait :fetuser do
|
||||||
|
after(:create) do |user|
|
||||||
|
user.after_create {|u| u.add_role("fetuser")}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user