Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
josacar committed Dec 28, 2023
1 parent 5c7aaed commit 352b265
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions spec/triki_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ describe Triki do
},
"another_table" => :truncate,
"some_table_to_keep" => :keep,
}).tap do |o|
o.database_type = :postgres
}).tap do |my_obfuscator|
my_obfuscator.database_type = :postgres
end

output = IO::Memory.new
Expand Down Expand Up @@ -179,8 +179,8 @@ describe Triki do
},
"another_table" => :truncate,
"some_table_to_keep" => :keep,
}).tap do |o|
o.database_type = :postgres
}).tap do |my_obfuscator|
my_obfuscator.database_type = :postgres
end

output = IO::Memory.new
Expand Down Expand Up @@ -389,13 +389,13 @@ describe Triki do
('hello2','moose!!');
SQL
output_string.should contain("INSERT INTO `some_table` (`email`, `name`, `something`, `age`) VALUES (")
output_string.should contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES (")
output_string.should contain("'some\\'thin,ge())lse1'")
output_string.should contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES ('hello','monkey',NULL,'wadus'),('hello1','monkey',NULL,'tradus'),('hello2','monkey',NULL,NULL);")
output_string.should_not contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES ('hello','kjhjd^&dkjh',NULL, 'wadus'),('hello1','kjhj!',NULL, 'tradus'),('hello2','moose!!',NULL, NULL);")
output_string.should_not contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES ('hello','kjhjd^&dkjh',NULL,'wadus'),('hello1','kjhj!',NULL,'tradus'),('hello2','moose!!',NULL,NULL);")
output_string.should_not contain("INSERT INTO `some_table` (`email`, `name`, `something`, `age`) VALUES ('bob@honk.com','bob', 'some\\'thin,ge())lse1', 25),('joe@joe.com','joe', 'somethingelse2', 54);")
output_string.should contain("INSERT INTO `some_table` (`email`, `name`, `something`, `age`) VALUES (")
output_string.should contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES (")
output_string.should contain("'some\\'thin,ge())lse1'")
output_string.should contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES ('hello','monkey',NULL,'wadus'),('hello1','monkey',NULL,'tradus'),('hello2','monkey',NULL,NULL);")
output_string.should_not contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES ('hello','kjhjd^&dkjh',NULL, 'wadus'),('hello1','kjhj!',NULL, 'tradus'),('hello2','moose!!',NULL, NULL);")
output_string.should_not contain("INSERT INTO `one_more_table` (`a`, `password`, `c`, `d,d`) VALUES ('hello','kjhjd^&dkjh',NULL,'wadus'),('hello1','kjhj!',NULL,'tradus'),('hello2','moose!!',NULL,NULL);")
output_string.should_not contain("INSERT INTO `some_table` (`email`, `name`, `something`, `age`) VALUES ('bob@honk.com','bob', 'some\\'thin,ge())lse1', 25),('joe@joe.com','joe', 'somethingelse2', 54);")
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/triki/config_applicator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class Triki
end

def self.row_as_hash(row : Array, columns : Array) : RowAsHash
columns.zip(row).each_with_object(RowAsHash.new) do |(name, value), m|
m[name] = value
columns.zip(row).each_with_object(RowAsHash.new) do |(name, value), row_as_hash|
row_as_hash[name] = value
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/triki/mysql.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Triki

def make_insert_statement(table_name, column_names, rows, ignore = nil)
String.build do |buffer|
buffer << %{INSERT #{ignore ? "IGNORE " : "" }INTO `#{table_name}` (`#{column_names.join("`, `")}`) VALUES }
buffer << %{INSERT #{ignore ? "IGNORE " : ""}INTO `#{table_name}` (`#{column_names.join("`, `")}`) VALUES }
write_rows(buffer, rows)
buffer << ";"
end
Expand Down

0 comments on commit 352b265

Please sign in to comment.