Skip to content

Instantly share code, notes, and snippets.

@bilus
Created April 13, 2014 13:03
Show Gist options
  • Save bilus/10583319 to your computer and use it in GitHub Desktop.
Save bilus/10583319 to your computer and use it in GitHub Desktop.
# Activate the gem you are reporting the issue against.
gem 'activerecord', '4.1.0'
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
ActiveRecord::Base.connection.execute("create table if not exists Templatemids (name varchar(30),TemplateID serial primary key, PluginFile text);")
end
class MidTemplate < ActiveRecord::Base
self.table_name = "templatemids"
self.primary_key = :templateid
validates_presence_of :name
end
class BugTest < Minitest::Test
def test_stack_overflow_error
mid_template_params = {name: ""}
mid_template = MidTemplate.new(mid_template_params)
mid_template.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment