diff --git a/app/models/question_models/question_content.rb b/app/models/question_models/question_content.rb index 11dce57f..5b600424 100644 --- a/app/models/question_models/question_content.rb +++ b/app/models/question_models/question_content.rb @@ -3,7 +3,7 @@ # QuestionContent contains fields shared between all question types (ChoiceQuestion, # TextQuestion, MatrixQuestion) and delegates behavior where appropriate. class QuestionContent < ActiveRecord::Base - belongs_to :questionable, :polymorphic => true, :dependent => :destroy + belongs_to :questionable, :polymorphic => true#, :dependent => :destroy has_many :criteria, :as => :source has_many :raw_responses, :foreign_key => "question_content_id" # likely currently unused. had a typo has_many :question_content_display_fields diff --git a/app/models/survey_models/survey_element.rb b/app/models/survey_models/survey_element.rb index a2bcf6d2..44047652 100644 --- a/app/models/survey_models/survey_element.rb +++ b/app/models/survey_models/survey_element.rb @@ -4,7 +4,7 @@ # which exists on a Page within a SurveyVersion. class SurveyElement < ActiveRecord::Base belongs_to :page - belongs_to :assetable, :polymorphic => true, :dependent => :destroy + belongs_to :assetable, :polymorphic => true#, :dependent => :destroy belongs_to :survey_version, :touch => true has_many :dashboard_elements, :dependent => :destroy diff --git a/spec/features/survey_builder_spec.rb b/spec/features/survey_builder_spec.rb index a168ebd7..15ff9474 100644 --- a/spec/features/survey_builder_spec.rb +++ b/spec/features/survey_builder_spec.rb @@ -17,6 +17,17 @@ add_text_question statement: "" expect(page).to_not have_css ".page_asset" end + + scenario "User deletes a text question" do + survey = create :survey + login_user + visit edit_survey_survey_version_path(survey, survey.survey_versions.first) + add_text_question statement: "Example Question" + within find('div.page_asset', text: "Example Question") do + click_link "Delete" + end + expect(page).to_not have_css ".page_asset", text: "Example Question" + end end context "choice question" do