vendredi 28 août 2015

Why isn't rspec failing on what should be a NameError inside a Model?

I have an rspec that looks like:

it "should test nil" do
  u = Upload.new
  u.save!
  u.my_method!
end

The method looks like:

class Upload < ActiveRecord::Base
  def my_method!
    puts "Made it to my method :)"
    not_defined_var
    puts "But didn't get this far :("
  end
end

Clearly, not_defined_var should give a "NameError: undefined local variable or method".

My output prints

Made it to my method :)
.

Finished in 1.54 seconds
1 example, 0 failures

I feel like I'm missing something essential. Got any ideas?

Aucun commentaire:

Enregistrer un commentaire