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

Commit

Permalink
Fix cucumber tests after integer -> bigint conversion
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mike Burns committed Jul 27, 2018
1 parent 34ec355 commit ee144c6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions features/step_definitions/attachment_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ 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
end

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)
Expand Down

0 comments on commit ee144c6

Please sign in to comment.