Sha256: 19c86b1af88b04a4ad1ef706fc3e63918a8ca127c54ad93faf543822b2a4169c

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require "spec_helper"

describe "Ar2gostruct::Builder::ORM::Validator" do

  describe "#get_option" do
    it "should output Validator format tags" do
      orm_converter = Ar2gostruct::Builder::ORM::Validator.new User
      # id
      result = orm_converter.get_option User.columns[0]
      expect(result).to eq("validate:\"nonzero\"")
      # email
      result = orm_converter.get_option User.columns[1]
      expect(result).to eq("validate:\"nonzero,min=1,max=120\"")
      # sign_in_count
      result = orm_converter.get_option User.columns[2]
      expect(result).to eq("validate:\"nonzero\"")
      # current_sign_in_at
      result = orm_converter.get_option User.columns[3]
      expect(result).to eq(nil)
      # last_sign_in_at
      result = orm_converter.get_option User.columns[4]
      expect(result).to eq(nil)
      # current_sign_in_ip
      result = orm_converter.get_option User.columns[5]
      expect(result).to eq(nil)
      # last_sign_in_ip
      result = orm_converter.get_option User.columns[6]
      expect(result).to eq(nil)
      # created_at
      result = orm_converter.get_option User.columns[7]
      expect(result).to eq(nil)
      # updated_at
      result = orm_converter.get_option User.columns[8]
      expect(result).to eq(nil)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar2gostruct-0.2.2 spec/ar2gostruct/builder/orm/validator_spec.rb
ar2gostruct-0.2.1 spec/ar2gostruct/builder/orm/validator_spec.rb