Sha256: 9cf7a4da4f6705fbd1e19dbd797eac7947233c10c0cc96a7ffc07d12595da9e4

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

require 'test_helper'

module PushType
  class NumberFieldTest < ActiveSupport::TestCase

    class TestPage < PushType::Node
      field :foo, :number
      field :bar, :number
    end

    let(:node)  { TestPage.create FactoryBot.attributes_for(:node, foo: 1, bar: 1.234) }
    let(:foo)   { node.fields[:foo] }
    let(:bar)   { node.fields[:bar] }

    
    it { foo.json_primitive.must_equal :number }
    it { foo.form_helper.must_equal :number_field }
    it { foo.json_value.must_equal 1 }
    it { foo.value.must_equal 1 }
    it { bar.json_value.must_equal 1.234 }
    it { bar.value.must_equal 1.234 }

    it { node.foo.must_equal 1 }
    it { node.bar.must_equal 1.234 }

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
push_type_core-0.12.1 test/fields/push_type/number_field_test.rb
push_type_core-0.12.0 test/fields/push_type/number_field_test.rb
push_type_core-0.12.0.beta.1 test/fields/push_type/number_field_test.rb