Sha256: 0d4bfdf6d68fd3fb6a37a79caeb94757e537cf51b195c99b8e3f4e10baa15074

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

require 'spec_helper'

describe "Navigable" do
  context "when deleted" do
    context "and the navigator has a navigable item" do
      before do
        page = Factory :page, :name => "Page name"
        @menu_item = page.to_navigator!
        page.destroy
        @menu_item.reload
      end

      it "should nullify the navigator's (menu item) pointer to itself" do
        @menu_item.navigable.should be_nil
        @menu_item.navigable_id.should be_nil
        @menu_item.navigable_type.should be_nil
      end

      it "should set the label and url" do
        @menu_item.label.should == "Page name"
        @menu_item.url.should == "#"
      end
    end

    context "and the navigable has no navigator item" do
      before do
        @page = Factory :page, :name => "Page name"
      end

      it "should not blow up" do
        expect {@page.destroy}.to_not raise_error
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
navi-0.1.4 spec/navi/navigable_spec.rb