I saw a really great issue in the Rails repo where someone was able to demonstrate a full rails issue without having to recreate an entire application. I thought this was fantastic because I have never setup an example like this before and think it would save a ton of time when iterating on ideas or reproducing issues.
# frozen_string_literal: true # 1. Add any gems that you may need inline require "bundler/inline" gemfile(true) do source "https://rubygems.org" git_source(:github) { |<em>repo</em>| "https://github.com/#{<em>repo</em>}.git" } # Activate the gem you are reporting the issue against. gem "rails", github: "rails/rails", branch: "master" gem "sqlite3" gem "pry" end require "active_record" require "minitest/autorun" require "logger" require "pry" # 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 create_table :posts, force: true do |<em>t</em>| t.string :name t.text :description t.datetime :routing_start_date t.datetime :routing_end_date end end class Post < ActiveRecord::Base has_many :comments end class BugTest < Minitest::Test def test_association_stuff post = Post.create!(name: []) post.routing_start_date = DateTime::Infinity assert_equal DateTime::Infinity, post.routing_start_date end end
Leave a Reply