From ee144c6e9e3426fed3d592afa16fbcdd6dfe4d67 Mon Sep 17 00:00:00 2001 From: Mike Burns Date: Fri, 27 Jul 2018 15:28:45 -0400 Subject: [PATCH] Fix cucumber tests after integer -> bigint conversion As before: use `#sql_type` instead of `#type` in the tests. The `#type` is the category -- string, integer, datetime -- but the `#sql_type` is the storage specifics -- `TEXT`, `VARCHAR`, `BIGINT`, `DATE. Switch to the `#sql_type` so we can be sure it's being stored correctly. --- features/step_definitions/attachment_steps.rb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/features/step_definitions/attachment_steps.rb b/features/step_definitions/attachment_steps.rb index efc94ff35..5876230b8 100644 --- a/features/step_definitions/attachment_steps.rb +++ b/features/step_definitions/attachment_steps.rb @@ -84,12 +84,12 @@ def attachment_path(filename) Then /^I should have attachment columns for "([^"]*)"$/ do |attachment_name| cd(".") do - columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.type] }.inspect"`.strip) + columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.sql_type] }.inspect"`.strip) expect_columns = [ - ["#{attachment_name}_file_name", :string], - ["#{attachment_name}_content_type", :string], - ["#{attachment_name}_file_size", :bigint], - ["#{attachment_name}_updated_at", :datetime] + ["#{attachment_name}_file_name", "varchar"], + ["#{attachment_name}_content_type", "varchar"], + ["#{attachment_name}_file_size", "bigint"], + ["#{attachment_name}_updated_at", "datetime"] ] expect(columns).to include(*expect_columns) end @@ -97,12 +97,12 @@ def attachment_path(filename) Then /^I should not have attachment columns for "([^"]*)"$/ do |attachment_name| cd(".") do - columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.type] }.inspect"`.strip) + columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.sql_type] }.inspect"`.strip) expect_columns = [ - ["#{attachment_name}_file_name", :string], - ["#{attachment_name}_content_type", :string], - ["#{attachment_name}_file_size", :bigint], - ["#{attachment_name}_updated_at", :datetime] + ["#{attachment_name}_file_name", "varchar"], + ["#{attachment_name}_content_type", "varchar"], + ["#{attachment_name}_file_size", "bigint"], + ["#{attachment_name}_updated_at", "datetime"] ] expect(columns).not_to include(*expect_columns)