Sha256: 6d22768d9dd5b81e4de785edf8896895b9399fd2147c74c435b63c61552e13ab
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require 'test_helper' class ExampleController < ActionController::Base include BreadcrumbsOnRails::ActionController def self.controller_name; "example"; end def self.controller_path; "example"; end layout false def action_default execute("action_default") end def action_compute_paths add_breadcrumb "String", "/" add_breadcrumb "Proc", proc { |c| "/?proc" } add_breadcrumb "Polymorfic", [:admin, :namespace] execute("action_default") end private def execute(method) if method.to_s =~ /^action_(.*)/ render :action => (params[:template] || 'default') end end def admin_namespace_path(*) "/?polymorfic" end helper_method :admin_namespace_path end class ExampleControllerTest < ActionController::TestCase tests ExampleController def test_render_default get :action_default assert_dom_equal %(), @response.body end def test_render_compute_paths get :action_compute_paths assert_dom_equal %(<a href="/">String</a> » <a href="/?proc">Proc</a> » <a href="/?polymorfic">Polymorfic</a>), @response.body end end class ExampleHelpersTest < ActionView::TestCase tests BreadcrumbsOnRails::ActionController::HelperMethods include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper attr_accessor :breadcrumbs setup do self.breadcrumbs = [] end def test_render_breadcrumbs assert_dom_equal '', render_breadcrumbs end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
breadcrumbs_on_rails-2.3.0 | test/unit/action_controller_test.rb |