Sha256: a3245e4ba7b8f686f80c769077ca96933e9d402d9b258f91d53ce4bece0f4866

Contents?: true

Size: 959 Bytes

Versions: 12

Compression:

Stored size: 959 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Surveys
    module Admin
      describe SurveyQuestionForm do
        let!(:survey) { create(:survey) }
        let!(:position) { 0 }
        let!(:question_type) { SurveyQuestion::TYPES.first }
        let!(:survey_question) { build(:survey_question, survey: survey, position: position, question_type: question_type) }

        subject do
          described_class.from_model(survey_question).with_context(current_feature: survey.feature)
        end

        context "when everything is OK" do
          it { is_expected.to be_valid }
        end

        context "when the position is not present" do
          let!(:position) { nil }

          it { is_expected.not_to be_valid }
        end

        context "when the question_type is not known" do
          let!(:question_type) { "foo" }

          it { is_expected.not_to be_valid }
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-0.6.4 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.6.3 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.6.2 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.6.1 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.6.0 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.5.1 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.5.0 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.4.4 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.4.3 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.4.2 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.4.1 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb
decidim-0.4.0 decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb