spec/reserved_words_spec.rb in upsert-2.1.2 vs spec/reserved_words_spec.rb in upsert-2.2.0
- old
+ new
@@ -5,32 +5,32 @@
reserved_words = ['mysql_reserved.txt', 'pg_reserved.txt'].map do |basename|
File.expand_path("../misc/#{basename}", __FILE__)
end.map do |path|
IO.readlines(path)
end.flatten.map(&:chomp).select(&:present?).uniq
-
+
# make lots of AR models, each of which has 10 columns named after these words
nasties = []
reserved_words.each_slice(10) do |words|
eval %{
class Nasty#{nasties.length} < ActiveRecord::Base
end
}
nasty = Object.const_get("Nasty#{nasties.length}")
nasty.class_eval do
self.primary_key = 'fake_primary_key'
- col :fake_primary_key
+ col :fake_primary_key, limit: 191
words.each do |word|
- col word
+ col word, limit: 191
end
end
nasties << [ nasty, words ]
end
nasties.each do |nasty, _|
nasty.auto_upgrade!
end
-
+
describe "reserved words" do
nasties.each do |nasty, words|
it "doesn't die on reserved words #{words.join(',')}" do
upsert = Upsert.new $conn, nasty.table_name
random = rand(1e3).to_s
@@ -41,6 +41,6 @@
end
end
end
end
end
-end
\ No newline at end of file
+end