vendredi 30 mars 2018

Rails Testing ArgumentError: When assigning attributes, you must pass a hash as an argument.

There is something wrong with my Rails testing setup. Right now, when I have data in my fixture, Rails does not recognize it as a hash.

require 'test_helper'

class TravelerTest < ActiveSupport::TestCase

  def setup
    @traveler = Traveler.new(:one)
  end

This is where I am getting the following error: "ArgumentError: When assigning attributes, you must pass a hash as an argument. test/models/traveler_test.rb:6:in `setup'"

My traveler.yml looks like this:

one:
  firstname: John
  lastname: Smith
  email: example@email.com
  encrypted_password: '123456'
  confirmed_at: 2016-01-02 08:31:23
  confirmation_sent_at: 2016-01-02 08:30:59

two: {}
# column: value

Aucun commentaire:

Enregistrer un commentaire