Sha256: c0cc4f7e0ef5b44b4520ae8c316f64226761f59db417037506e559c1c83e5883

Contents?: true

Size: 1.34 KB

Versions: 32

Compression:

Stored size: 1.34 KB

Contents

require 'test_helper'

module PushType
  class FieldTypeTest < ActiveSupport::TestCase

    let(:node)  { FactoryGirl.create :node }
    let(:field) { PushType::FieldType.new :foo, node, opts }
    
    describe 'default' do
      let(:opts) { {} }
      it { field.name.must_equal :foo }
      it { field.model.must_equal node }
      it { field.kind.must_equal :field }
      it { field.primitive.must_equal PushType::Primitives::StringType }

      it { field.json_primitive.must_equal :string }
      it { field.template.must_equal 'default' }
      it { field.label.must_equal 'Foo' }
      it { field.form_helper.must_equal :text_field }
      it { field.html_options.must_equal({}) }
      it { field.field_options.must_equal({}) }
      it { field.multiple?.must_equal false  }
    end

    describe 'with options' do
      let(:opts)  { { json_primitive: :number, template: 'my_template', label: 'Bar', form_helper: :number_field, html_options: { some: 'opts' }, field_options: { more: 'opts'} } }
      it { field.json_primitive.must_equal :number }
      it { field.template.must_equal opts[:template] }
      it { field.label.must_equal opts[:label] }
      it { field.form_helper.must_equal opts[:form_helper] }
      it { field.html_options.must_equal opts[:html_options] }
      it { field.field_options.must_equal opts[:field_options] }
    end

  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
push_type_core-0.11.2 test/lib/push_type/field_type_test.rb
push_type_core-0.11.1 test/lib/push_type/field_type_test.rb
push_type_core-0.11.0.beta.2 test/lib/push_type/field_type_test.rb
push_type_core-0.11.0.beta.1 test/lib/push_type/field_type_test.rb
push_type_core-0.10.4 test/lib/push_type/field_type_test.rb
push_type_core-0.10.3 test/lib/push_type/field_type_test.rb
push_type_core-0.10.2 test/lib/push_type/field_type_test.rb
push_type_core-0.10.1 test/lib/push_type/field_type_test.rb
push_type_core-0.10.0 test/lib/push_type/field_type_test.rb
push_type_core-0.10.0.beta.5 test/lib/push_type/field_type_test.rb
push_type_core-0.10.0.beta.3 test/lib/push_type/field_type_test.rb
push_type_core-0.9.5 test/lib/push_type/field_type_test.rb
push_type_core-0.9.3 test/lib/push_type/field_type_test.rb
push_type_core-0.9.2 test/lib/push_type/field_type_test.rb
push_type_core-0.9.1 test/lib/push_type/field_type_test.rb
push_type_core-0.9.0 test/lib/push_type/field_type_test.rb
push_type_core-0.9.0.beta.4 test/lib/push_type/field_type_test.rb
push_type_core-0.9.0.beta.3 test/lib/push_type/field_type_test.rb
push_type_core-0.9.0.beta.2 test/lib/push_type/field_type_test.rb
push_type_core-0.8.2 test/lib/push_type/field_type_test.rb