Sha256: 8e8799905fa375be7499bf4c75245f711687dc80e5506da2e814f024f220932b

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

require "test_helper"

module PushType
  describe Node do
    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

11 entries across 11 versions & 1 rubygems

Version Path
push_type_core-0.5.1 test/models/push_type/node_test.rb
push_type_core-0.5.0 test/models/push_type/node_test.rb
push_type_core-0.5.0.alpha.5 test/models/push_type/node_test.rb
push_type_core-0.5.0.alpha.4 test/models/push_type/node_test.rb
push_type_core-0.5.0.alpha.3 test/models/push_type/node_test.rb
push_type_core-0.5.0.alpha.2 test/models/push_type/node_test.rb
push_type_core-0.5.0.alpha.1 test/models/push_type/node_test.rb
push_type_core-0.4.0 test/models/push_type/node_test.rb
push_type_core-0.4.0.beta.3 test/models/push_type/node_test.rb
push_type_core-0.3.3 test/models/push_type/node_test.rb
push_type_core-0.3.1 test/models/push_type/node_test.rb