Sha256: 52d6e1f11a5dae6732fdc82f3781fa5edc0c1626948e130be1aea91979d5b031

Contents?: true

Size: 587 Bytes

Versions: 3

Compression:

Stored size: 587 Bytes

Contents

require 'test_helper'

module PushType
  class TimeFieldTest < ActiveSupport::TestCase

    class TestPage < PushType::Node
      field :foo, :time
    end

    let(:node)  { TestPage.create FactoryBot.attributes_for(:node, foo: val) }
    let(:val)   { '15:00' }
    let(:field) { node.fields[:foo] }
    
    it { field.template.must_equal 'date' }
    it { field.form_helper.must_equal :time_field }
    it { field.json_value.must_equal val }
    it { field.value.must_equal val.to_time }

    it { node.foo.must_be_instance_of Time }
    it { node.foo.hour.must_equal 15 }

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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