Vanilla JS (the confirm method):
sinon.stub(window, 'confirm')
jQuery (the fadeOut method):
sinon.stub(jQuery.prototype, 'fadeOut')
A blog about the problems I've encountered while being a Ruby on Rails developer, and how I've solved them.
sinon.stub(window, 'confirm')
jQuery (the fadeOut method):
sinon.stub(jQuery.prototype, 'fadeOut')
def self.included(receiver)
if defined?(receiver.metadata) && receiver.metadata[:type] == :controller
receiver.send :include, Devise::TestHelpers
end
end
expect(content).to have_css("input[type='checkbox'][checked='checked']#rawr")
TypeError: nil is not a symbol nor a string
Oh no!!!! class BearHabitat < ActiveRecord::Base
self.primary_key = 'bear_id'
end
Now you should be able to update your model within your code with no problem. Why does this happen in the first place? My guess is that somewhere within ActiveModel, it assumes that the primary_key field is set. Since your migration set id to false, this value gets defaulted to nil. If you don't manually set it, ActiveModel gets sad. Now you can make ActiveModel happy again.