maccman / supermodel

Ruby in-memory models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow_nil and allow_blank not being applied

mdespuits opened this issue · comments

I don't know where the issue with this would be, but my tests are red no matter what I do. Here is the code:

    describe "nil and blank values" do
        class People < SuperModel::Base
          validates_formatting_of :last_name, :using => :alpha, :allow_blank => false
        end
        it "are allowed" do
          p = People.new(:last_name => "something")
          p.should be_valid
          p.save!
          p.last_name = ""
          p.should_not be_valid
        end
      end

validates_formatting_of is a gem I am currently working on. It simply uses validates_format_of. The Person should not be valid after last_name is set to blank, but the tests say it is.

I know it is not a problem with my gem because I have tested it in an external Rails application with perfect results. Any ideas? Thanks!

👍 I also ran into this issue. Would love to see a fix for it. Let me know how I can help.