Sha256: 4257b794ebf7416724427704c68689e0c04d47ed7e0aa62f3be647882d17211a
Contents?: true
Size: 1.06 KB
Versions: 18
Compression:
Stored size: 1.06 KB
Contents
require 'test_helper' module PushType class CustomizableTest < ActiveSupport::TestCase class TestPage < PushType::Node field :foo field :bar, :text field :baz, validates: { presence: true } field :qux, :number, validates: { presence: true } end let(:page) { TestPage.new } let(:fields) { page.fields } it { TestPage.fields.must_be_instance_of Hash } it { fields.must_be_instance_of Hash } describe '.field' do it { fields[:foo].must_be_instance_of StringField } it { fields[:bar].must_be_instance_of TextField } it { fields[:baz].must_be_instance_of StringField } it { TestPage.validators_on(:baz).map(&:class).must_include ActiveRecord::Validations::PresenceValidator } it { fields[:qux].must_be_instance_of NumberField } it { TestPage.validators_on(:qux).map(&:class).must_include ActiveRecord::Validations::PresenceValidator } end describe '#attribute_for_inspect' do it { page.attribute_for_inspect(:field_store).must_equal "[:foo, :bar, :baz, :qux]" } end end end
Version data entries
18 entries across 18 versions & 1 rubygems