Sha256: 2ea07028e66529f3243c142954c452e5f02c963ca794dbbc2557f3e7c4233341

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

require 'test_helper'

module PushType
  class NodeTest < ActiveSupport::TestCase

    class TestPage < PushType::Node
      field :foo
      field :bar
      field :baz
    end

    let(:node) { Node.new }

    it { node.wont_be :valid? }

    it 'should be valid with required attributes' do
      node.attributes = FactoryGirl.attributes_for :node
      node.must_be :valid?
    end

    describe '#permalink' do
      before do
        %w(one two three).each { |slug| @node = FactoryGirl.create :node, slug: slug, parent: @node }
      end
      it { @node.permalink.must_equal 'one/two/three' }
    end

    describe '#orphan?' do
      let(:parent)  { FactoryGirl.create :node }
      let(:child)   { FactoryGirl.create :node, parent: parent }
      before { child && parent.trash! }
      it { parent.wont_be :orphan? }
      it { child.must_be :orphan? }
    end

    describe '#trash!' do
      let(:parent)  { FactoryGirl.create :node }
      let(:child)   { FactoryGirl.create :node, parent: parent }
      before { child && parent.trash! }
      it { parent.must_be :trashed? }
      it { parent.reload.must_be :trashed? }
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
push_type_core-0.9.5 test/models/push_type/node_test.rb
push_type_core-0.9.3 test/models/push_type/node_test.rb
push_type_core-0.9.2 test/models/push_type/node_test.rb
push_type_core-0.9.1 test/models/push_type/node_test.rb
push_type_core-0.9.0 test/models/push_type/node_test.rb
push_type_core-0.9.0.beta.4 test/models/push_type/node_test.rb
push_type_core-0.9.0.beta.3 test/models/push_type/node_test.rb
push_type_core-0.9.0.beta.2 test/models/push_type/node_test.rb
push_type_core-0.8.2 test/models/push_type/node_test.rb
push_type_core-0.8.1 test/models/push_type/node_test.rb
push_type_core-0.8.0 test/models/push_type/node_test.rb
push_type_core-0.8.0.beta.3 test/models/push_type/node_test.rb
push_type_core-0.8.0.beta.2 test/models/push_type/node_test.rb