Refactor machine_learner_spec.rb