Add Model changes to work with votation_types

This commit is contained in:
lalo
2019-05-29 16:51:29 +02:00
committed by Javi Martín
parent c505fd373c
commit 7c9c50f4c6
18 changed files with 745 additions and 3 deletions

View File

@@ -44,4 +44,35 @@ RSpec.describe Poll::Question, type: :model do
end
end
describe "#enum_type" do
it "returns nil if not has votation_type association" do
expect(poll_question.votation_type).to be_nil
expect(poll_question.enum_type).to be_nil
end
it "returns enum_type from votation_type association" do
question = create(:poll_question_answer_couples_open)
expect(question.votation_type).not_to be_nil
expect(question.enum_type).to eq("answer_couples_open")
end
end
describe "#max_votes" do
it "returns nil if not has votation_type association" do
expect(poll_question.votation_type).to be_nil
expect(poll_question.max_votes).to be_nil
end
it "returns max_votes from votation_type association" do
question = create(:poll_question_answer_couples_open)
expect(question.votation_type).not_to be_nil
expect(question.max_votes).to eq(5)
end
end
end