Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit ee144c6

Browse files
author
Mike Burns
committed
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.
1 parent 34ec355 commit ee144c6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

features/step_definitions/attachment_steps.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,25 @@ def attachment_path(filename)
8484

8585
Then /^I should have attachment columns for "([^"]*)"$/ do |attachment_name|
8686
cd(".") do
87-
columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.type] }.inspect"`.strip)
87+
columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.sql_type] }.inspect"`.strip)
8888
expect_columns = [
89-
["#{attachment_name}_file_name", :string],
90-
["#{attachment_name}_content_type", :string],
91-
["#{attachment_name}_file_size", :bigint],
92-
["#{attachment_name}_updated_at", :datetime]
89+
["#{attachment_name}_file_name", "varchar"],
90+
["#{attachment_name}_content_type", "varchar"],
91+
["#{attachment_name}_file_size", "bigint"],
92+
["#{attachment_name}_updated_at", "datetime"]
9393
]
9494
expect(columns).to include(*expect_columns)
9595
end
9696
end
9797

9898
Then /^I should not have attachment columns for "([^"]*)"$/ do |attachment_name|
9999
cd(".") do
100-
columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.type] }.inspect"`.strip)
100+
columns = eval(`bundle exec rails runner "puts User.columns.map{ |column| [column.name, column.sql_type] }.inspect"`.strip)
101101
expect_columns = [
102-
["#{attachment_name}_file_name", :string],
103-
["#{attachment_name}_content_type", :string],
104-
["#{attachment_name}_file_size", :bigint],
105-
["#{attachment_name}_updated_at", :datetime]
102+
["#{attachment_name}_file_name", "varchar"],
103+
["#{attachment_name}_content_type", "varchar"],
104+
["#{attachment_name}_file_size", "bigint"],
105+
["#{attachment_name}_updated_at", "datetime"]
106106
]
107107

108108
expect(columns).not_to include(*expect_columns)

0 commit comments

Comments
 (0)