crummy 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. data/.gitignore +1 -1
  2. data/.rvmrc +48 -0
  3. data/.travis.yml +13 -0
  4. data/CHANGELOG +3 -0
  5. data/README.md +78 -55
  6. data/example/.gitignore +5 -0
  7. data/example/.rspec +1 -0
  8. data/example/.rvmrc +48 -0
  9. data/example/Gemfile +30 -0
  10. data/example/README.md +40 -0
  11. data/example/Rakefile +7 -0
  12. data/example/app/assets/images/rails.png +0 -0
  13. data/example/app/assets/javascripts/application.js +9 -0
  14. data/example/app/assets/javascripts/pages.js.coffee +3 -0
  15. data/example/app/assets/javascripts/post.js.coffee +3 -0
  16. data/example/app/assets/stylesheets/application.css +7 -0
  17. data/example/app/assets/stylesheets/layout.css.sass +26 -0
  18. data/example/app/assets/stylesheets/post.css.scss +3 -0
  19. data/example/app/controllers/application_controller.rb +6 -0
  20. data/example/app/controllers/pages_controller.rb +5 -0
  21. data/example/app/controllers/posts_controller.rb +19 -0
  22. data/example/app/helpers/application_helper.rb +9 -0
  23. data/example/app/helpers/pages_helper.rb +2 -0
  24. data/example/app/helpers/post_helper.rb +2 -0
  25. data/example/app/mailers/.gitkeep +0 -0
  26. data/example/app/models/.gitkeep +0 -0
  27. data/example/app/models/category.rb +6 -0
  28. data/example/app/models/post.rb +19 -0
  29. data/example/app/views/layouts/application.html.haml +16 -0
  30. data/example/app/views/pages/index.html.haml +4 -0
  31. data/example/app/views/posts/index.html.haml +5 -0
  32. data/example/app/views/posts/new.html.haml +1 -0
  33. data/example/app/views/posts/show.html.haml +3 -0
  34. data/example/config.ru +4 -0
  35. data/example/config/application.rb +48 -0
  36. data/example/config/boot.rb +6 -0
  37. data/example/config/database.yml +25 -0
  38. data/example/config/environment.rb +5 -0
  39. data/example/config/environments/development.rb +30 -0
  40. data/example/config/environments/production.rb +60 -0
  41. data/example/config/environments/test.rb +39 -0
  42. data/example/config/initializers/backtrace_silencers.rb +7 -0
  43. data/example/config/initializers/inflections.rb +10 -0
  44. data/example/config/initializers/mime_types.rb +5 -0
  45. data/example/config/initializers/secret_token.rb +7 -0
  46. data/example/config/initializers/session_store.rb +8 -0
  47. data/example/config/initializers/wrap_parameters.rb +14 -0
  48. data/example/config/locales/en.yml +5 -0
  49. data/example/config/routes.rb +5 -0
  50. data/example/db/migrate/20111104103150_create_posts.rb +10 -0
  51. data/example/db/migrate/20111104103738_create_categories.rb +12 -0
  52. data/example/db/migrate/20111104104040_add_category_id_to_posts.rb +5 -0
  53. data/example/db/schema.rb +32 -0
  54. data/example/db/seeds.rb +15 -0
  55. data/example/doc/README_FOR_APP +2 -0
  56. data/example/lib/assets/.gitkeep +0 -0
  57. data/example/lib/tasks/.gitkeep +0 -0
  58. data/example/log/.gitkeep +0 -0
  59. data/example/public/404.html +26 -0
  60. data/example/public/422.html +26 -0
  61. data/example/public/500.html +26 -0
  62. data/example/public/favicon.ico +0 -0
  63. data/example/public/robots.txt +5 -0
  64. data/example/script/rails +6 -0
  65. data/example/spec/controllers/posts_controller_spec.rb +7 -0
  66. data/example/spec/spec_helper.rb +38 -0
  67. data/example/vendor/assets/stylesheets/.gitkeep +0 -0
  68. data/example/vendor/plugins/.gitkeep +0 -0
  69. data/gemfiles/rails3_2/Gemfile +6 -0
  70. data/gemfiles/rails4_0/Gemfile +6 -0
  71. data/lib/crummy.rb +10 -2
  72. data/lib/crummy/standard_renderer.rb +14 -13
  73. data/lib/crummy/version.rb +1 -1
  74. data/test/standard_renderer_test.rb +33 -3
  75. metadata +78 -10
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters :format => [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,5 @@
1
+ CrummyTest::Application.routes.draw do
2
+ resources :posts
3
+
4
+ root :to => "pages#index"
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title
5
+ t.string :slug
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :categories do |t|
4
+ t.string :title
5
+ t.string :slug
6
+
7
+ t.string :category_id # Can have a category as a parent
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class AddCategoryIdToPosts < ActiveRecord::Migration
2
+ def change
3
+ add_column :posts, :category_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20111104104040) do
15
+
16
+ create_table "categories", :force => true do |t|
17
+ t.string "title"
18
+ t.string "slug"
19
+ t.string "category_id"
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+
24
+ create_table "posts", :force => true do |t|
25
+ t.string "title"
26
+ t.string "slug"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ t.integer "category_id"
30
+ end
31
+
32
+ end
@@ -0,0 +1,15 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
8
+
9
+ movies = Category.create :title => "Movies", :slug => "movies"
10
+ star_wars = Category.create :title => "Star Wars", :slug => "star-wars", :category => movies
11
+ time = Category.create :title => "What time Is It?", :slug => "time"
12
+
13
+ Post.create :title => "A Long Long Time Ago", :slug => "a-long-long-time-ago", :category => star_wars
14
+ Post.create :title => "It's Hammer Time", :slug => "its-hammer-time", :category => time
15
+ Post.create :title => "Test", :slug => "test"
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
File without changes
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+
3
+ describe PostsController do
4
+ it "exists! (and RSpec works)" do
5
+ # nop
6
+ end
7
+ end
@@ -0,0 +1,38 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Requires supporting ruby files with custom matchers and macros, etc,
8
+ # in spec/support/ and its subdirectories.
9
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+ # ## Mock Framework
13
+ #
14
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
15
+ #
16
+ # config.mock_with :mocha
17
+ # config.mock_with :flexmock
18
+ # config.mock_with :rr
19
+
20
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
21
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
22
+
23
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
24
+ # examples within a transaction, remove the following line or assign false
25
+ # instead of true.
26
+ config.use_transactional_fixtures = true
27
+
28
+ # If true, the base class of anonymous controllers will be inferred
29
+ # automatically. This will be the default behavior in future versions of
30
+ # rspec-rails.
31
+ config.infer_base_class_for_anonymous_controllers = false
32
+
33
+ # Run specs in random order to surface order dependencies. If you find an
34
+ # order dependency and want to debug it, you can fix the order by providing
35
+ # the seed, which is printed after each run.
36
+ # --seed 1234
37
+ config.order = "random"
38
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'activesupport', '>= 3.0', '< 4'
4
+ gem 'actionpack', '>= 3.0', '< 4'
5
+
6
+ gemspec path: File.join('..', '..')
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'activesupport', '>= 4.0.0.beta', '< 5'
4
+ gem 'actionpack', '>= 4.0.0.beta', '< 5'
5
+
6
+ gemspec path: File.join('..', '..')
@@ -20,8 +20,8 @@ module Crummy
20
20
  attr_accessor :ul_id
21
21
  attr_accessor :ul_class
22
22
  attr_accessor :li_class
23
- attr_accessor :active_li_class
24
23
  attr_accessor :microdata
24
+ attr_accessor :last_crumb_linked
25
25
 
26
26
  def initialize
27
27
  @format = :html
@@ -35,8 +35,16 @@ module Crummy
35
35
  @ul_id = ''
36
36
  @ul_class = ''
37
37
  @li_class = ''
38
- @active_li_class = ''
39
38
  @microdata = false
39
+ @last_crumb_linked = true
40
+ end
41
+
42
+ def active_li_class=(class_name)
43
+ puts "CRUMMY: The 'active_li_class' option is DEPRECATED and will be removed from a future version"
44
+ end
45
+
46
+ def active_li_class
47
+ puts "CRUMMY: The 'active_li_class' option is DEPRECATED and will be removed from a future version"
40
48
  end
41
49
  end
42
50
 
@@ -22,7 +22,7 @@ module Crummy
22
22
  # render_crumbs :format => :xml #=> <crumb href="/">Home</crumb><crumb href="/businesses">Businesses</crumb>
23
23
  # render_crumbs :format => :html_list #=> <ul class="" id=""><li class=""><a href="/">Home</a></li><li class=""><a href="/">Businesses</a></li></ul>
24
24
  #
25
- # With :format => :html_list you can specify additional params: active_li_class, li_class, ul_class, ul_id
25
+ # With :format => :html_list you can specify additional params: li_class, ul_class, ul_id
26
26
  # The only argument is for the separator text. It does not assume you want spaces on either side so you must specify. Defaults to +&raquo;+
27
27
  #
28
28
  # render_crumbs(" . ") #=> <a href="/">Home</a> . <a href="/businesses">Businesses</a>
@@ -36,21 +36,21 @@ module Crummy
36
36
  options[:first_class] ||= Crummy.configuration.first_class
37
37
  options[:last_class] ||= Crummy.configuration.last_class
38
38
  options[:microdata] ||= Crummy.configuration.microdata
39
+ options[:last_crumb_linked] = Crummy.configuration.last_crumb_linked if options[:last_crumb_linked].nil?
39
40
 
40
41
  case options[:format]
41
42
  when :html
42
43
  crumb_string = crumbs.collect do |crumb|
43
- crumb_to_html(crumb, options[:links], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last), options[:microdata])
44
+ crumb_to_html(crumb, options[:links], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last), options[:microdata], options[:last_crumb_linked])
44
45
  end.reduce { |memo, obj| memo << options[:separator] << obj }
45
46
  crumb_string
46
47
  when :html_list
47
48
  # Let's set values for special options of html_list format
48
- options[:active_li_class] ||= Crummy.configuration.active_li_class
49
49
  options[:li_class] ||= Crummy.configuration.li_class
50
50
  options[:ul_class] ||= Crummy.configuration.ul_class
51
51
  options[:ul_id] ||= Crummy.configuration.ul_id
52
52
  crumb_string = crumbs.collect do |crumb|
53
- crumb_to_html_list(crumb, options[:links], options[:li_class], options[:active_li_class], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last), options[:microdata])
53
+ crumb_to_html_list(crumb, options[:links], options[:li_class], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last), options[:microdata], options[:last_crumb_linked])
54
54
  end.reduce { |memo, obj| memo << options[:separator] << obj }
55
55
  crumb_string = content_tag(:ul, crumb_string, :class => options[:ul_class], :id => options[:ul_id])
56
56
  crumb_string
@@ -65,37 +65,38 @@ module Crummy
65
65
 
66
66
  private
67
67
 
68
- def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last, with_microdata)
68
+ def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked)
69
69
  html_classes = []
70
70
  html_classes << first_class if is_first
71
71
  html_classes << last_class if is_last
72
72
  name, url = crumb
73
- html_content = url && links ? link_to(name, url) : content_tag(:span, name)
73
+ can_link = url && links && (!is_last || last_crumb_linked)
74
+ html_content = can_link ? link_to(name, url) : content_tag(:span, name)
74
75
  if with_microdata
75
76
  item_title = content_tag(:span, name, :itemprop => "title")
76
77
  html_options = {:itemscope => true, :itemtype => data_definition_url("Breadcrumb")}
77
- html_content = url && links ? link_to(item_title, url, :class => html_classes, :itemprop => "url") : item_title
78
+ html_content = can_link ? link_to(item_title, url, :class => html_classes, :itemprop => "url") : item_title
78
79
  content_tag(:div, html_content, html_options)
79
80
  else
80
- url && links ? link_to(name, url, :class => html_classes) : name
81
+ can_link ? link_to(name, url, :class => html_classes) : name
81
82
  end
82
83
  end
83
84
 
84
- def crumb_to_html_list(crumb, links, li_class, active_li_class, first_class, last_class, is_first, is_last, with_microdata)
85
+ def crumb_to_html_list(crumb, links, li_class, first_class, last_class, is_first, is_last, with_microdata, last_crumb_linked)
85
86
  name, url = crumb
87
+ can_link = url && links && (!is_last || last_crumb_linked)
86
88
  html_classes = []
87
89
  html_classes << first_class if is_first
88
90
  html_classes << last_class if is_last
89
- html_classes << active_li_class unless url && links
90
- html_classes << li_class if !is_first && !is_last && url && links
91
+ html_classes << li_class
91
92
  html_options = {:class => html_classes.join(' ').strip}
92
93
  if with_microdata
93
94
  html_options[:itemscope] = true
94
95
  html_options[:itemtype] = data_definition_url("Breadcrumb")
95
96
  item_title = content_tag(:span, name, :itemprop => "title")
96
- html_content = url && links ? link_to(item_title, url, :itemprop => "url") : item_title
97
+ html_content = can_link ? link_to(item_title, url, :itemprop => "url") : item_title
97
98
  else
98
- html_content = url && links ? link_to(name, url) : content_tag(:span, name)
99
+ html_content = can_link ? link_to(name, url) : content_tag(:span, name)
99
100
  end
100
101
  content_tag(:li, html_content, html_options)
101
102
  end
@@ -1,6 +1,6 @@
1
1
  module Crummy
2
2
  MAJOR = 1
3
3
  MINOR = 7
4
- PATCH = 0
4
+ PATCH = 1
5
5
  VERSION = [MAJOR, MINOR, PATCH].join('.')
6
6
  end
@@ -22,9 +22,9 @@ class StandardRendererTest < Test::Unit::TestCase
22
22
 
23
23
  assert_equal('<a href="url1" class="first">name1</a> &raquo; <a href="url2" class="last">name2</a>',
24
24
  renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html))
25
- assert_equal('<ul class="" id=""><li class="first"><a href="url1">name1</a></li><li class="li_class"><a href="url2">name2</a></li><li class="last"><a href="url3">name3</a></li></ul>',
25
+ assert_equal('<ul class="" id=""><li class="first li_class"><a href="url1">name1</a></li><li class="li_class"><a href="url2">name2</a></li><li class="last li_class"><a href="url3">name3</a></li></ul>',
26
26
  renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list))
27
- assert_equal('<ul class="" id=""><li class="first"><a href="url1">name1</a></li> / <li class="li_class"><a href="url2">name2</a></li> / <li class="last"><a href="url3">name3</a></li></ul>',
27
+ assert_equal('<ul class="" id=""><li class="first li_class"><a href="url1">name1</a></li> / <li class="li_class"><a href="url2">name2</a></li> / <li class="last li_class"><a href="url3">name3</a></li></ul>',
28
28
  renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / "))
29
29
  assert_equal('<crumb href="url1">name1</crumb><crumb href="url2">name2</crumb>',
30
30
  renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml))
@@ -33,6 +33,34 @@ class StandardRendererTest < Test::Unit::TestCase
33
33
  renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true))
34
34
  assert_equal('<ul class="" id=""><li class="first last" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="url" itemprop="url"><span itemprop="title">name</span></a></li></ul>',
35
35
  renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true))
36
+ assert_equal('<ul class="crumbclass" id="crumbid"><li class="liclass"><a href="url">name</a></li></ul>',
37
+ renderer.render_crumbs([['name', 'url']], :format => :html_list, :ul_id => "crumbid", :ul_class => "crumbclass", :li_class => "liclass"))
38
+ end
39
+
40
+ def test_classes_last_crumb_not_linked
41
+ renderer = StandardRenderer.new
42
+ assert_equal('name',
43
+ renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false))
44
+ assert_equal('<ul class="" id=""><li class="first last"><span>name</span></li></ul>',
45
+ renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
46
+ assert_equal('<crumb href="url">name</crumb>',
47
+ renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :xml, :last_crumb_linked => false))
48
+
49
+ assert_equal('<a href="url1" class="first">name1</a> &raquo; name2',
50
+ renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false))
51
+ assert_equal('<ul class="" id=""><li class="first li_class"><a href="url1">name1</a></li><li class="li_class"><a href="url2">name2</a></li><li class="last li_class"><span>name3</span></li></ul>',
52
+ renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
53
+ assert_equal('<ul class="" id=""><li class="first li_class"><a href="url1">name1</a></li> / <li class="li_class"><a href="url2">name2</a></li> / <li class="last li_class"><span>name3</span></li></ul>',
54
+ renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / ", :last_crumb_linked => false))
55
+ assert_equal('<crumb href="url1">name1</crumb><crumb href="url2">name2</crumb>',
56
+ renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml, :last_crumb_linked => false))
57
+
58
+ assert_equal('<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></div>',
59
+ renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true, :last_crumb_linked => false))
60
+ assert_equal('<ul class="" id=""><li class="first last" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></li></ul>',
61
+ renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true, :last_crumb_linked => false))
62
+ assert_equal('<ul class="crumbclass" id="crumbid"><li class="liclass"><span>name</span></li></ul>',
63
+ renderer.render_crumbs([['name', 'url']], :format => :html_list, :ul_id => "crumbid", :ul_class => "crumbclass", :li_class => "liclass", :last_crumb_linked => false))
36
64
  end
37
65
 
38
66
  def test_configuration
@@ -67,5 +95,7 @@ class StandardRendererTest < Test::Unit::TestCase
67
95
  # using configured microdata setting
68
96
  assert_equal('<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="url" class="first last" itemprop="url"><span itemprop="title">name</span></a></div>',
69
97
  renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html))
70
- end
98
+ # last crumb not linked
99
+ assert_equal('<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></div>',
100
+ renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false)) end
71
101
  end