Sha256: 7db057afd301a821489319b9d209c06c33b2642a0e849855ea7a3c20a715ae65

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

module PushType
  class NodeTest < ActiveSupport::TestCase
    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

10 entries across 10 versions & 1 rubygems

Version Path
push_type_core-0.8.0.beta.1 test/models/push_type/node_test.rb
push_type_core-0.7.0 test/models/push_type/node_test.rb
push_type_core-0.7.0.beta.1 test/models/push_type/node_test.rb
push_type_core-0.6.0 test/models/push_type/node_test.rb
push_type_core-0.6.0.beta.4 test/models/push_type/node_test.rb
push_type_core-0.6.0.beta.3 test/models/push_type/node_test.rb
push_type_core-0.6.0.beta.2 test/models/push_type/node_test.rb
push_type_core-0.6.0.beta.1 test/models/push_type/node_test.rb
push_type_core-0.5.3 test/models/push_type/node_test.rb
push_type_core-0.5.2 test/models/push_type/node_test.rb