Sha256: bf72df58d1f895343c2aff7d443ec9d75c5856aee90d4ca8068ea734f93983b8

Contents?: true

Size: 983 Bytes

Versions: 4

Compression:

Stored size: 983 Bytes

Contents

require "spec_helper"

describe ApplicationController do
  controller do
    add_breadcrumb 'root', '/'
    add_breadcrumb 'nil', nil

    def index
      add_breadcrumb 'examples', controller: 'examples', action: 'index', only_path: true
      render text: 'test'
    end
  end

  describe '#index' do
    subject do
      get :index
    end

    context '.add_breadcrumb' do
      it 'having breadcrumbs' do
        should be_success
        assigns(:breadcrumbs)[0][:name].should eq('root')
        assigns(:breadcrumbs)[0][:url].should eq('/')
      end

      it 'url has nil value' do
        should be_success
        assigns(:breadcrumbs)[1][:name].should eq('nil')
        assigns(:breadcrumbs)[1][:url].should be_nil
      end
    end

    context '#add_breadcrumb' do
      it 'url options' do
        should be_success
        assigns(:breadcrumbs)[2][:name].should eq('examples')
        assigns(:breadcrumbs)[2][:url].should eq('/examples')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
breadcrumble-3.0.0 spec/controllers/application_controller_spec.rb
breadcrumble-3.0.0.beta spec/controllers/application_controller_spec.rb
breadcrumble-2.0.1 spec/controllers/application_controller_spec.rb
breadcrumble-2.0.0 spec/controllers/application_controller_spec.rb