Enable soft_deletion of Poll::Question::Translations

This commit is contained in:
Senén Rodero Rodríguez
2019-01-21 13:34:25 +01:00
committed by voodoorai2000
parent e451c4657c
commit caa9e1cd49
3 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
class AddHiddenAtToPollQuestionTranslations < ActiveRecord::Migration[4.2]
def change
add_column :poll_question_translations, :hidden_at, :datetime
add_index :poll_question_translations, :hidden_at
end
end

View File

@@ -1161,6 +1161,8 @@ ActiveRecord::Schema.define(version: 20190607160900) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title"
t.datetime "hidden_at"
t.index ["hidden_at"], name: "index_poll_question_translations_on_hidden_at", using: :btree
t.index ["locale"], name: "index_poll_question_translations_on_locale", using: :btree
t.index ["poll_question_id"], name: "index_poll_question_translations_on_poll_question_id", using: :btree
end

View File

@@ -3,6 +3,10 @@ require "rails_helper"
RSpec.describe Poll::Question, type: :model do
let(:poll_question) { build(:poll_question) }
describe "Concerns" do
it_behaves_like "acts as paranoid", :poll_question
end
describe "#poll_question_id" do
it "is invalid if a poll is not selected" do
poll_question.poll_id = nil