Skip to content

Commit

Permalink
fixing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamfall committed Nov 6, 2023
1 parent de1f475 commit 83540de
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/models/form_answer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FormAnswer < ApplicationRecord
begin :associations
belongs_to :user
belongs_to :account, optional: true
belongs_to :award_year
belongs_to :award_year, optional: true
belongs_to :company_details_editable, polymorphic: true, optional: true
belongs_to :ceremonial_county, optional: true

Expand Down
2 changes: 1 addition & 1 deletion app/pdf_generators/form_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FormPdf < Prawn::Document
innovation_was_launched_in_the_market
)
JUST_NOTES = [
"QAEFormBuilder::HeaderQuestion"
"QaeFormBuilder::HeaderQuestion"
]
DEFAULT_ANSWER_COLOR = "5B5656"

Expand Down
44 changes: 22 additions & 22 deletions app/pdf_generators/qae_pdf_forms/general/question_pointer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ class QaePdfForms::General::QuestionPointer
ANSWER_FONT_END = "</color>".freeze

BLOCK_QUESTIONS = [
QAEFormBuilder::UploadQuestion,
QAEFormBuilder::ByYearsLabelQuestion,
QAEFormBuilder::ByYearsQuestion,
QAEFormBuilder::OneOptionByYearsLabelQuestion,
QAEFormBuilder::OneOptionByYearsQuestion,
QAEFormBuilder::SupportersQuestion,
QAEFormBuilder::TextareaQuestion,
QAEFormBuilder::TextQuestion
QaeFormBuilder::UploadQuestion,
QaeFormBuilder::ByYearsLabelQuestion,
QaeFormBuilder::ByYearsQuestion,
QaeFormBuilder::OneOptionByYearsLabelQuestion,
QaeFormBuilder::OneOptionByYearsQuestion,
QaeFormBuilder::SupportersQuestion,
QaeFormBuilder::TextareaQuestion,
QaeFormBuilder::TextQuestion
]

def initialize(ops = {})
Expand Down Expand Up @@ -73,7 +73,7 @@ def set_questions_with_references

def set_non_header_questions
@non_header_questions = form_pdf.all_questions.select do |q|
!q.delegate_obj.is_a?(QAEFormBuilder::HeaderQuestion)
!q.delegate_obj.is_a?(QaeFormBuilder::HeaderQuestion)
end
end

Expand All @@ -92,7 +92,7 @@ def render!
end

def render_bottom_space
if question.delegate_obj.class.to_s != "QAEFormBuilder::HeaderQuestion" ||
if question.delegate_obj.class.to_s != "QaeFormBuilder::HeaderQuestion" ||
question.classes != "regular-question" ||
question.classes == "application-notice help-notice"

Expand Down Expand Up @@ -143,7 +143,7 @@ def render_pdf_hint
end

def render_header_hint
if question.delegate_obj.is_a?(QAEFormBuilder::HeaderQuestion) &&
if question.delegate_obj.is_a?(QaeFormBuilder::HeaderQuestion) &&
(question.ref.present? || question.sub_ref.present?) &&
SKIP_HEADER_HINT_KEYS.exclude?(question.key.to_s)

Expand Down Expand Up @@ -337,18 +337,18 @@ def question_block_type(question)
def question_answer(question)
unless FormPdf::JUST_NOTES.include?(question.delegate_obj.class.to_s)
case question.delegate_obj
when QAEFormBuilder::UploadQuestion
when QaeFormBuilder::UploadQuestion
form_pdf.indent 7.mm do
render_attachments
end
when QAEFormBuilder::SicCodeDropdownQuestion
when QaeFormBuilder::SicCodeDropdownQuestion
if q_visible? && humanized_answer.present?
form_pdf.render_standart_answer_block(question_option_title)
else
form_pdf.default_bottom_margin
form_pdf.text "Select #{question.title}"
end
when QAEFormBuilder::OptionsQuestion
when QaeFormBuilder::OptionsQuestion
if q_visible? && humanized_answer.present?
chosen_option = question.options.detect{ |option| option.value.to_s == humanized_answer.to_s }
form_pdf.render_standart_answer_block(question_option_title)
Expand All @@ -363,29 +363,29 @@ def question_answer(question)
end
end
end
when QAEFormBuilder::ConfirmQuestion
when QaeFormBuilder::ConfirmQuestion
if q_visible? && humanized_answer.present?
form_pdf.render_standart_answer_block(question_checked_value_title)
else
question_option_box(question.pdf_text || question.text)
end
when QAEFormBuilder::ByYearsLabelQuestion, QAEFormBuilder::OneOptionByYearsLabelQuestion
when QaeFormBuilder::ByYearsLabelQuestion, QaeFormBuilder::OneOptionByYearsLabelQuestion
form_pdf.indent 7.mm do
render_years_labels_table
end
when QAEFormBuilder::ByYearsQuestion, QAEFormBuilder::OneOptionByYearsQuestion
when QaeFormBuilder::ByYearsQuestion, QaeFormBuilder::OneOptionByYearsQuestion
render_years_table
when QAEFormBuilder::SupportersQuestion
when QaeFormBuilder::SupportersQuestion
form_pdf.indent 7.mm do
render_supporters
end
when QAEFormBuilder::TextareaQuestion
when QaeFormBuilder::TextareaQuestion
title = q_visible? && humanized_answer.present? ? humanized_answer : ""

form_pdf.default_bottom_margin
render_word_limit
render_wysywyg_content
when QAEFormBuilder::CheckboxSeriaQuestion
when QaeFormBuilder::CheckboxSeriaQuestion
render_checkbox_selected_values
else
title = q_visible? && humanized_answer.present? ? humanized_answer : ""
Expand Down Expand Up @@ -431,11 +431,11 @@ def attachment_by_type(_k, v)

def complex_question
render_question_title_with_ref_or_not
if question.delegate_obj.class.to_s == "QAEFormBuilder::HeadOfBusinessQuestion"
if question.delegate_obj.class.to_s == "QaeFormBuilder::HeadOfBusinessQuestion"
form_pdf.move_up 5.mm
end

if question.delegate_obj.class.to_s == "QAEFormBuilder::AddressQuestion"
if question.delegate_obj.class.to_s == "QaeFormBuilder::AddressQuestion"
render_context_and_answer_blocks
end

Expand Down
2 changes: 1 addition & 1 deletion app/pdf_generators/shared_pdf_helpers/data_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def sub_category

def sub_category_question
all_questions.detect do |q|
q.delegate_obj.is_a?(QAEFormBuilder::OptionsQuestion) &&
q.delegate_obj.is_a?(QaeFormBuilder::OptionsQuestion) &&
q.sub_category_question.present?
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/qae_form_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
it 'should build QaeFormBuilder::Form instances' do
empty = QaeFormBuilder.build 'test'
expect(empty.title).to eq('test')
expect(empty).to be_instance_of(QaeFormBuilder::QAEForm)
expect(empty).to be_instance_of(QaeFormBuilder::QaeForm)
end

it 'should build 0 steps for empty block' do
Expand Down

0 comments on commit 83540de

Please sign in to comment.