diff --git a/app/models/flowchart_node.rb b/app/models/flowchart_node.rb index 05a64e1..feeb230 100644 --- a/app/models/flowchart_node.rb +++ b/app/models/flowchart_node.rb @@ -12,7 +12,7 @@ # is_leaf :boolean default(FALSE), not null # is_root :boolean not null # next_question :string -# text :string not null +# text :text not null # created_at :datetime not null # updated_at :datetime not null # child_id :bigint @@ -41,7 +41,6 @@ class FlowchartNode < ApplicationRecord has_many :flowchart_icon_helpers accepts_nested_attributes_for :flowchart_icon_helpers, allow_destroy: true has_many :flowchart_icons, through: :flowchart_icon_helpers - validates :text, presence: true validates :header, presence: true validates :button_text, exclusion: { in: [''] } validates :next_question, exclusion: { in: [''] } diff --git a/db/migrate/20200406215014_change_node_text_size.rb b/db/migrate/20200406215014_change_node_text_size.rb new file mode 100644 index 0000000..a66fd8f --- /dev/null +++ b/db/migrate/20200406215014_change_node_text_size.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class ChangeNodeTextSize < ActiveRecord::Migration[6.0] + def change + change_column :flowchart_nodes, :text, :text + change_column_null :flowchart_nodes, :text, true + end +end diff --git a/db/schema.rb b/db/schema.rb index 02cb309..b69c170 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_03_27_010944) do +ActiveRecord::Schema.define(version: 2020_04_06_215014) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -57,7 +57,7 @@ end create_table "flowchart_nodes", force: :cascade do |t| - t.string "text", null: false + t.text "text", null: false t.string "header", null: false t.string "button_text" t.string "next_question" diff --git a/spec/controllers/flowchart_node_controller_spec.rb b/spec/controllers/flowchart_node_controller_spec.rb index 53be41d..17ba6c7 100644 --- a/spec/controllers/flowchart_node_controller_spec.rb +++ b/spec/controllers/flowchart_node_controller_spec.rb @@ -179,18 +179,18 @@ end end - context 'when given an invalid body' do - before(:each) do - @params[:prev_id] = 3 - @params[:node][:text] = nil - end - - it 'throws a record invalid error' do - expect do - post :create, params: @params - end.to raise_error(ActiveRecord::RecordInvalid) - end - end + # context 'when given an invalid body' do + # before(:each) do + # @params[:prev_id] = 3 + # @params[:node][:text] = nil + # end + # + # it 'throws a record invalid error' do + # expect do + # post :create, params: @params + # end.to raise_error(ActiveRecord::RecordInvalid) + # end + # end end describe '.show' do @@ -271,18 +271,18 @@ end end - context 'when given an invalid body' do - before(:each) do - @params[:id] = 1 - @params[:node][:text] = nil - end - - it 'throws a record invalid error' do - expect do - put :update, params: @params - end.to raise_error(ActiveRecord::RecordInvalid) - end - end + # context 'when given an invalid body' do + # before(:each) do + # @params[:id] = 1 + # @params[:node][:text] = nil + # end + # + # it 'throws a record invalid error' do + # expect do + # put :update, params: @params + # end.to raise_error(ActiveRecord::RecordInvalid) + # end + # end end describe '.swap' do