Sha256: f166bfaa15c027c8dff7e26ffa7e5b6f19e7c34f91cb740704cace5465e47851

Contents?: true

Size: 868 Bytes

Versions: 5

Compression:

Stored size: 868 Bytes

Contents

require "test_helper"

class ActiveSupport::TestCase
  setup do
    @routes = MenuBuilder::Routes
  end
end

class BooksController < ApplicationController
  menu_item :books
  def index ; end
end

class SettingsController < ApplicationController
  menu_items :settings, :home

  def index ; end

  def notifications
    menu_item :notification
  end
end

class BooksControllerTest < ActionController::TestCase
  test "assigns the current tab" do
    get :index
    assert_equal([:books], assigns(:menu_items))
  end
end

class SettingsControllerTest < ActionController::TestCase
  test "ability to assign more than one current tab" do
    get :index
    assert_equal([:settings, :home], assigns(:menu_items))
  end

  test "that instance level menu_items override class level" do
    get :notifications
    assert_equal([:notification], assigns(:menu_items))
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
menu_builder-0.4.4 test/controller_test.rb
menu_builder-0.4.3 test/controller_test.rb
menu_builder-0.4.2 test/controller_test.rb
menu_builder-0.4.1 test/controller_test.rb
menu_builder-0.4.0 test/controller_test.rb