Sha256: cb1c6e4bb9eb652ae2b8d744636d47d319ee68c2904ab0e582bbf28b95049a7b
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' describe 'Yema::Virtus::Rule::StrongType' do subject { described_class.new(age: value).errors } context "default strict mode" do let(:described_class) do Class.new do include Yema::Virtus::Validations attribute :age, Integer self end end it_behaves_like "valid resource", 5343 it_behaves_like "valid resource", "4" it_behaves_like "invalid resource", false it_behaves_like "invalid resource", "name" it_behaves_like "invalid resource", "" it_behaves_like "invalid resource", nil end context "allow_nil strict mode" do let(:described_class) do Class.new do include Yema::Virtus::Validations attribute :age, Integer, strict: :allow_nil self end end it_behaves_like "valid resource", nil it_behaves_like "valid resource", 123 it_behaves_like "valid resource", "2" it_behaves_like "invalid resource", "" it_behaves_like "invalid resource", true it_behaves_like "invalid resource", "string" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yema-0.0.3 | spec/integration/virtus/strong_type_spec.rb |
yema-0.0.2 | spec/integration/virtus/strong_type_spec.rb |
yema-0.0.1 | spec/integration/virtus/strong_type_spec.rb |