Add Model changes to work with votation_types
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user