Starting Rust (again)

Last time I messed with Rust, I made the classic beginner mistake of trying to learn too many things at once. I was trying to learn Rust, learn Lisp, and write a Lisp interpreter in Rust at the same time.

I started messing with Rust again. First, I want to mention a couple of videos that have really helped me understand Rust a little bit better.

Continue reading “Starting Rust (again)”

Watch for Mutants

I have a project at work that uses Minitest, but I want to use mutant to test it. Mutant is a gem that does mutation testing. Mutation testing is an important complement to regular automated testing. Regular automated testing asserts that correct code passes your test suite; mutation testing asserts that incorrect code fails your test suite. In this series, I’m going to try to find the best way to mutation test a Rails app that’s covered mostly be minitest.

Continue reading “Watch for Mutants”

Don’t YAML on, man (in Rails 4)

Last time, I made a simple model called Lightswitch so that I could play with mutable state:

class Lightswitch < ActiveRecord::Base
  attr_accessor :turned_on
  
  def turn_on
    self.turned_on = true
  end
end

When I first wrote the model, not wanting to suggest that my electrical fixtures were aroused, I named the attribute on instead of turned_on. I immediately saw some strange errors. rake test started complaining that there was no column named true. Today, I’m going to reproduce this error on purpose so that I will understand why, specifically, I can’t use on as a column name with active record. Continue reading “Don’t YAML on, man (in Rails 4)”