Skip to content

Instantly share code, notes, and snippets.

@janjiss
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save janjiss/3a09b4a51c8a54ed05c5 to your computer and use it in GitHub Desktop.

Select an option

Save janjiss/3a09b4a51c8a54ed05c5 to your computer and use it in GitHub Desktop.
require "virtus"
require "rspec"
class Test
include Virtus.model(:nullify_blank => true)
attribute :name, String
end
RSpec.describe Test do
it "should be nil" do
test = Test.new(name: "")
expect(test.name).to eq(nil)
end
end
#Failures:
# 1) Test should be nil
# Failure/Error: expect(test.name).to eq(nil)
#
# expected: nil
# got: ""
#
# (compared using ==)
# # ./test.rb:11:in `block (2 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment