Skip to content

Commit

Permalink
change node text size (#65)
Browse files Browse the repository at this point in the history
* change node text size

* remove old tests

* lint
  • Loading branch information
LeozMaxwellJilliams authored Apr 6, 2020
1 parent 08c430f commit 4f1b760
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
3 changes: 1 addition & 2 deletions app/models/flowchart_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: [''] }
Expand Down
8 changes: 8 additions & 0 deletions db/migrate/20200406215014_change_node_text_size.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
48 changes: 24 additions & 24 deletions spec/controllers/flowchart_node_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f1b760

Please sign in to comment.