Sha256: 94759cf330be96c6aec7d96329acd3d75ba18ade3d51403ebe7841bbf8de0a37
Contents?: true
Size: 764 Bytes
Versions: 15
Compression:
Stored size: 764 Bytes
Contents
require 'test_helper' module PushType class AssetFieldTest < ActiveSupport::TestCase class TestPage < PushType::Node field :foo_id, :asset end let(:node) { TestPage.create FactoryGirl.attributes_for(:node, foo_id: asset.id) } let(:asset) { FactoryGirl.create :asset } let(:field) { node.fields[:foo_id] } it { field.template.must_equal 'asset' } it { field.relation_class.must_equal PushType::Asset } it { field.json_value.must_equal asset.id } it { field.value.must_equal asset.id } it { node.foo_id.must_equal asset.id } it { node.foo.must_equal asset } describe 'with missing relations' do before do asset.destroy end it { node.foo.must_equal nil } end end end
Version data entries
15 entries across 15 versions & 1 rubygems