Questions: fixes, redesign form, fix edit error

This commit is contained in:
Stella Rouzi 2015-09-10 12:39:52 +03:00
parent 38bc2e3c3a
commit e25425bd77
20 changed files with 300 additions and 117 deletions

View file

@ -2,6 +2,22 @@
FactoryGirl.define do
factory :answer do
title 'Do you?'
title 'I do'
factory :answer1 do
title 'First Answer'
end
factory :answer2 do
title 'Second Answer'
end
factory :answer_yes do
title 'Yes'
end
factory :answer_no do
title 'No'
end
end
end

View file

@ -2,11 +2,27 @@
FactoryGirl.define do
factory :question do
title 'blah'
title 'Do you?'
question_type
after(:build) do |question|
question.answers << build(:answer)
question.conferences << build(:conference)
factory :question_with_answers do
title 'Which do you choose?'
after(:build) do |question|
question.answers << build(:answer1)
question.answers << build(:answer2)
end
end
factory :attending_with_partner do
title 'Will you attend with a partner?'
association :question_type, factory: :yes_no
global true
after(:build) do |question|
question.answers << build(:answer_yes)
question.answers << build(:answer_no)
end
end
end
end

View file

@ -2,6 +2,18 @@
FactoryGirl.define do
factory :question_type do
title 'Multiple Choice'
title 'A type for question'
factory :yes_no do
title 'Yes/No'
end
factory :single_choice do
title 'Single Choice'
end
factory :multiple_choice do
title 'Multiple Choice'
end
end
end