Last active
April 25, 2018 20:10
Revisions
-
axlekb revised this gist
Apr 25, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class Payment < ActiveRecord::Base class BugTest < Minitest::Test def test_numeric_validation payment = Payment.create!(cash: 2.0) payment.reload -
axlekb revised this gist
Apr 11, 2018 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,8 +48,7 @@ class Payment < ActiveRecord::Base class BugTest < Minitest::Test def test_numeric_validation payment = Payment.create!(:cash: 2.0) payment.reload -
axlekb created this gist
Apr 11, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ # frozen_string_literal: true gem "bundler", "< 1.16" begin require "bundler/inline" rescue LoadError => e $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" raise e end gemfile(true) do source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem "pg", "<1.0" #gem "rails", "5.1.4" # success! gem "rails", "5.2.0" # fails! end require "active_record" require "minitest/autorun" require "logger" # Ensure backward compatibility with Minitest 4 Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) ActiveRecord::Base.establish_connection( adapter: "postgresql", database: "rails_test", username: "user", password: "", host: 'localhost' ) ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Schema.define do create_table :payments, force: true do |t| t.money :cash end end class Payment < ActiveRecord::Base validates :cash, numericality: true, unless: :new_record? end class BugTest < Minitest::Test def test_numeric_validation payment = Payment.create! payment.update_column(:cash, 2.0) payment.reload assert payment.cash == 2.0 assert payment.valid? end end