gretel 3.0.6 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31c77ef551e13b999644f0b27d782987629ae7ab
4
- data.tar.gz: 8bdf306a5ba44daaf9bcfb6b7b5f4830cbc8dd5d
3
+ metadata.gz: c41db63d201de11de1dbc6d9b9c2a172418ffa20
4
+ data.tar.gz: 48db9abfdc31f7900b0f32afdc9536fd2839efdf
5
5
  SHA512:
6
- metadata.gz: dfd56e69ce95e4fde666b9320fa5531275261804f2d74e623c3d98ca41996805aecc47907d27b64856243d79c7f123e2564c7542321a505fa6f8d47c1f49a804
7
- data.tar.gz: ba35e16f9908e7259c01bdd9f174dfaf2e4aac45e99e2f61fbbe8b034f5e66dd52de75408733593775633ad4e257455465bc2e90c247f3c104d614fe4804225c
6
+ metadata.gz: aa877e11f8c2037c68f9f01c9722101161163747e017e7be78606b56e7504d2a6bcbc253bb97144ab77c0d5ccd70a81a4323fe82ee2f0d4bc2b5d32ba79e21bb
7
+ data.tar.gz: 4e6d5c1f40b484fe1ac448fda62654756b17efbc1bb7a262a69229571de91a86512104e9aeec70a0f655259e2ba61e2971fcd0fb8f17f0672c10a04bfae08182
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  .config
5
5
  .yardoc
6
6
  Gemfile.lock
7
+ gemfiles/*.lock
7
8
  InstalledFiles
8
9
  _yardoc
9
10
  coverage
@@ -20,4 +21,4 @@ test/dummy/db/*.sqlite3
20
21
  test/dummy/log/*.log
21
22
  test/dummy/tmp/
22
23
  test/dummy/.sass-cache
23
- .DS_Store
24
+ .DS_Store
@@ -2,7 +2,11 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
+ gemfile:
6
+ - gemfiles/Gemfile-rails.3.2.x
7
+ - gemfiles/Gemfile-rails.4.0.x
8
+ - gemfiles/Gemfile-rails.4.1.x
5
9
  before_script:
6
10
  - "cd test/dummy; rake db:migrate; rake db:test:prepare; cd ../.."
7
11
  notifications:
8
- email: false
12
+ email: false
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 3.0.7
4
+ * Pretext and posttext classes are now customizable with `<%= breadcrumbs pretext_class: "some-class" %>` and `<%= breadcrumbs posttext_class: "some-other-class" %>`.
5
+
3
6
  ## Version 3.0.6
4
7
  * Pretext and posttext are now enclosed in spans with `<span class="pretext">` and `<span class="posttext">`.
5
8
  * Semantic breadcrumbs are now rendered in spans instead of divs to enable easier styling.
data/README.md CHANGED
@@ -106,8 +106,10 @@ Option | Description
106
106
  :link_current | Whether the current crumb should be linked to. | False
107
107
  :semantic | Whether it should generate [semantic breadcrumbs](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417). | False
108
108
  :id | ID for the breadcrumbs container. | None
109
- :class | CSS class for the breadcrumbs container. | `"breadcrumbs"`
110
- :current_class | CSS class for the current link or span. | `"current"`
109
+ :class | CSS class for the breadcrumbs container. Can be set to `nil` for no class. | `"breadcrumbs"`
110
+ :current_class | CSS class for the current link or span. Can be set to `nil` for no class. | `"current"`
111
+ :pretext_class | CSS class for the pretext, if given. Can be set to `nil` for no class. | `"pretext"`
112
+ :posttext_class | CSS class for the posttext, if given. Can be set to `nil` for no class. | `"posttext"`
111
113
  :container_tag | Tag type that contains the breadcrumbs. | `:div`
112
114
  :fragment_tag | Tag type to contain each breadcrumb fragment/link. | None
113
115
 
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "gretel", :path => ".."
4
+
5
+ gem "rails", "~> 3.2.0"
6
+ gem "sqlite3"
7
+
8
+ # jquery-rails is used by the dummy application
9
+ gem "jquery-rails"
10
+
11
+ # Declare any dependencies that are still in development here instead of in
12
+ # your gemspec. These might include edge Rails or gems from your path or
13
+ # Git. Remember to move these dependencies to your gemspec before releasing
14
+ # your gem to rubygems.org.
15
+
16
+ # To use debugger
17
+ # gem 'debugger'
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "gretel", :path => ".."
4
+
5
+ gem "rails", "~> 4.0.0"
6
+ gem "sqlite3"
7
+
8
+ # jquery-rails is used by the dummy application
9
+ gem "jquery-rails"
10
+
11
+ # Declare any dependencies that are still in development here instead of in
12
+ # your gemspec. These might include edge Rails or gems from your path or
13
+ # Git. Remember to move these dependencies to your gemspec before releasing
14
+ # your gem to rubygems.org.
15
+
16
+ # To use debugger
17
+ # gem 'debugger'
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "gretel", :path => ".."
4
+
5
+ gem "rails", "~> 4.1.0"
6
+ gem "sqlite3"
7
+
8
+ # jquery-rails is used by the dummy application
9
+ gem "jquery-rails"
10
+
11
+ # Declare any dependencies that are still in development here instead of in
12
+ # your gemspec. These might include edge Rails or gems from your path or
13
+ # Git. Remember to move these dependencies to your gemspec before releasing
14
+ # your gem to rubygems.org.
15
+
16
+ # To use debugger
17
+ # gem 'debugger'
@@ -16,7 +16,11 @@ module Gretel
16
16
  # breadcrumbs set in engines.
17
17
  def breadcrumb_paths
18
18
  @breadcrumb_paths ||= begin
19
- engine_roots = Rails::Application::Railties.engines.map { |e| e.config.root }
19
+ engines = Rails::Application::Railties.respond_to?(:engines) ?
20
+ Rails::Application::Railties.engines :
21
+ Rails::Engine.subclasses.map(&:instance)
22
+
23
+ engine_roots = engines.map { |e| e.config.root }
20
24
 
21
25
  [*engine_roots, Rails.root].map do |root|
22
26
  [root.join("config", "breadcrumbs.rb"),
@@ -11,6 +11,8 @@ module Gretel
11
11
  semantic: false,
12
12
  class: "breadcrumbs",
13
13
  current_class: "current",
14
+ pretext_class: "pretext",
15
+ posttext_class: "posttext",
14
16
  id: nil
15
17
  }
16
18
 
@@ -179,13 +181,13 @@ module Gretel
179
181
  html_fragments = []
180
182
 
181
183
  if options[:pretext].present?
182
- html_fragments << content_tag(:span, options[:pretext], class: "pretext")
184
+ html_fragments << content_tag(:span, options[:pretext], class: options[:pretext_class])
183
185
  end
184
186
 
185
187
  html_fragments << fragments.join(options[:separator])
186
188
 
187
189
  if options[:posttext].present?
188
- html_fragments << content_tag(:span, options[:posttext], class: "posttext")
190
+ html_fragments << content_tag(:span, options[:posttext], class: options[:posttext_class])
189
191
  end
190
192
 
191
193
  html = html_fragments.join(" ").html_safe
@@ -1,3 +1,3 @@
1
1
  module Gretel
2
- VERSION = "3.0.6"
2
+ VERSION = "3.0.7"
3
3
  end
@@ -7,53 +7,8 @@ require "gretel"
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Custom directories with classes and modules you want to be autoloadable.
15
- # config.autoload_paths += %W(#{config.root}/extras)
16
-
17
- # Only load the plugins named here, in the order given (default is alphabetical).
18
- # :all can be used as a placeholder for all plugins not explicitly named.
19
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
-
21
- # Activate observers that should always be running.
22
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
-
24
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
- # config.time_zone = 'Central Time (US & Canada)'
27
-
28
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
- # config.i18n.default_locale = :de
31
-
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
37
-
38
- # Enable escaping HTML in JSON.
39
- config.active_support.escape_html_entities_in_json = true
40
-
41
- # Use SQL instead of Active Record's schema dumper when creating the database.
42
- # This is necessary if your schema can't be completely dumped by the schema dumper,
43
- # like if you have constraints or database-specific column types
44
- # config.active_record.schema_format = :sql
45
-
46
- # Enforce whitelist mode for mass assignment.
47
- # This will create an empty whitelist of attributes available for mass-assignment for all models
48
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
- # parameters by using an attr_accessible or attr_protected declaration.
50
- config.active_record.whitelist_attributes = true
51
-
52
- # Enable the asset pipeline
53
- config.assets.enabled = true
54
-
55
- # Version of your assets, change this if you want to expire all your assets
56
- config.assets.version = '1.0'
10
+ config.secret_token = "secret token"
11
+ config.active_support.deprecation = :log
12
+ config.eager_load = false
57
13
  end
58
14
  end
59
-
@@ -1,37 +1,2 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger
20
- config.active_support.deprecation = :log
21
-
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
24
-
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
-
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
31
-
32
- # Do not compress assets
33
- config.assets.compress = false
34
-
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
37
2
  end
@@ -1,67 +1,2 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
6
-
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
13
-
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
16
-
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
19
-
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
22
-
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
25
-
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
35
-
36
- # Prepend all log lines with the following tags
37
- # config.log_tags = [ :subdomain, :uuid ]
38
-
39
- # Use a different logger for distributed setups
40
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
-
42
- # Use a different cache store in production
43
- # config.cache_store = :mem_cache_store
44
-
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
47
-
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
50
-
51
- # Disable delivery errors, bad email addresses will be ignored
52
- # config.action_mailer.raise_delivery_errors = false
53
-
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
59
- config.i18n.fallbacks = true
60
-
61
- # Send deprecation notices to registered listeners
62
- config.active_support.deprecation = :notify
63
-
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
2
  end
@@ -1,37 +1,2 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
13
-
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
16
-
17
- # Show full error reports and disable caching
18
- config.consider_all_requests_local = true
19
- config.action_controller.perform_caching = false
20
-
21
- # Raise exceptions instead of rendering exception templates
22
- config.action_dispatch.show_exceptions = false
23
-
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
26
-
27
- # Tell Action Mailer not to deliver emails to the real world.
28
- # The :test delivery method accumulates sent emails in the
29
- # ActionMailer::Base.deliveries array.
30
- config.action_mailer.delivery_method = :test
31
-
32
- # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
34
-
35
- # Print deprecation notices to the stderr
36
- config.active_support.deprecation = :stderr
37
2
  end
@@ -1,11 +1,11 @@
1
1
  Dummy::Application.routes.draw do
2
2
  root to: "dummy#dummy"
3
3
 
4
- match "about" => "dummy#dummy", as: :about
5
- match "about/contact" => "dummy#dummy", as: :contact
6
- match "about/contact/form" => "dummy#dummy", as: :contact_form
4
+ get "about" => "dummy#dummy", as: :about
5
+ get "about/contact" => "dummy#dummy", as: :contact
6
+ get "about/contact/form" => "dummy#dummy", as: :contact_form
7
7
 
8
8
  resources :projects do
9
9
  resources :issues
10
10
  end
11
- end
11
+ end
@@ -2,140 +2,160 @@ require 'test_helper'
2
2
 
3
3
  class HelperMethodsTest < ActionView::TestCase
4
4
  include Gretel::ViewHelpers
5
+
6
+ self.fixture_path = File.expand_path("../../test/fixtures", __FILE__)
5
7
  fixtures :all
8
+
6
9
  helper :application
7
10
 
8
11
  setup do
9
12
  Gretel.reset!
10
13
  end
11
14
 
15
+ def itemscope_value
16
+ ActionView::Helpers::TagHelper::BOOLEAN_ATTRIBUTES.include?("itemscope") ?
17
+ "itemscope" : ""
18
+ end
19
+
12
20
  # Breadcrumb generation
13
21
 
14
- test "shows basic breadcrumb" do
22
+ test "basic breadcrumb" do
15
23
  breadcrumb :basic
16
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
24
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
17
25
  breadcrumbs.to_s
18
26
  end
19
27
 
20
- test "shows breadcrumb with root" do
28
+ test "breadcrumb with root" do
21
29
  breadcrumb :with_root
22
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
30
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
23
31
  breadcrumbs.to_s
24
32
  end
25
33
 
26
- test "shows breadcrumb with parent" do
34
+ test "breadcrumb with parent" do
27
35
  breadcrumb :with_parent
28
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">About</a> &rsaquo; <span class="current">Contact</span></div>},
36
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">About</a> &rsaquo; <span class="current">Contact</span></div>},
29
37
  breadcrumbs.to_s
30
38
  end
31
39
 
32
- test "shows breadcrumb with autopath" do
40
+ test "breadcrumb with autopath" do
33
41
  breadcrumb :with_autopath, projects(:one)
34
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test Project</span></div>},
42
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test Project</span></div>},
35
43
  breadcrumbs.to_s
36
44
  end
37
45
 
38
- test "shows breadcrumb with parent object" do
46
+ test "breadcrumb with parent object" do
39
47
  breadcrumb :with_parent_object, issues(:one)
40
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/projects/1">Test Project</a> &rsaquo; <span class="current">Test Issue</span></div>},
48
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/projects/1">Test Project</a> &rsaquo; <span class="current">Test Issue</span></div>},
41
49
  breadcrumbs.to_s
42
50
  end
43
51
 
44
- test "shows multiple links" do
52
+ test "multiple links" do
45
53
  breadcrumb :multiple_links
46
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about/contact">Contact</a> &rsaquo; <span class="current">Contact form</span></div>},
54
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about/contact">Contact</a> &rsaquo; <span class="current">Contact form</span></div>},
47
55
  breadcrumbs.to_s
48
56
  end
49
57
 
50
- test "shows multiple links with parent" do
58
+ test "multiple links with parent" do
51
59
  breadcrumb :multiple_links_with_parent
52
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">About</a> &rsaquo; <a href="/about/contact">Contact</a> &rsaquo; <span class="current">Contact form</span></div>},
60
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">About</a> &rsaquo; <a href="/about/contact">Contact</a> &rsaquo; <span class="current">Contact form</span></div>},
53
61
  breadcrumbs.to_s
54
62
  end
55
63
 
56
- test "shows semantic breadcrumb" do
64
+ test "semantic breadcrumb" do
57
65
  breadcrumb :with_root
58
- assert_equal %{<div class="breadcrumbs"><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Home</span></a></span> &rsaquo; <span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><span class="current" itemprop="title">About</span></span></div>},
66
+ assert_dom_equal %Q{<div class="breadcrumbs"><span itemscope="#{itemscope_value}" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Home</span></a></span> &rsaquo; <span itemscope="#{itemscope_value}" itemtype="http://data-vocabulary.org/Breadcrumb"><span class="current" itemprop="title">About</span></span></div>},
59
67
  breadcrumbs(semantic: true).to_s
60
68
  end
61
69
 
62
70
  test "doesn't show root alone" do
63
71
  breadcrumb :root
64
- assert_equal "", breadcrumbs.to_s
72
+ assert_dom_equal "", breadcrumbs.to_s
65
73
  end
66
74
 
67
75
  test "displays single fragment" do
68
76
  breadcrumb :root
69
- assert_equal %{<div class="breadcrumbs"><span class="current">Home</span></div>},
77
+ assert_dom_equal %{<div class="breadcrumbs"><span class="current">Home</span></div>},
70
78
  breadcrumbs(display_single_fragment: true).to_s
71
79
  end
72
80
 
73
81
  test "displays single non-root fragment" do
74
82
  breadcrumb :basic
75
- assert_equal %{<div class="breadcrumbs"><span class="current">About</span></div>},
83
+ assert_dom_equal %{<div class="breadcrumbs"><span class="current">About</span></div>},
76
84
  breadcrumbs(autoroot: false, display_single_fragment: true).to_s
77
85
  end
78
86
 
79
- test "shows no breadcrumb" do
80
- assert_equal "", breadcrumbs.to_s
87
+ test "no breadcrumb" do
88
+ assert_dom_equal "", breadcrumbs.to_s
81
89
  end
82
90
 
83
91
  test "links current breadcrumb" do
84
92
  breadcrumb :with_root
85
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about" class="current">About</a></div>},
93
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about" class="current">About</a></div>},
86
94
  breadcrumbs(link_current: true).to_s
87
95
  end
88
96
 
89
- test "shows pretext" do
97
+ test "pretext" do
90
98
  breadcrumb :basic
91
- assert_equal %{<div class="breadcrumbs"><span class="pretext">You are here:</span> <a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
99
+ assert_dom_equal %{<div class="breadcrumbs"><span class="pretext">You are here:</span> <a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
92
100
  breadcrumbs(pretext: "You are here:").to_s
93
101
  end
94
102
 
95
- test "shows posttext" do
103
+ test "posttext" do
96
104
  breadcrumb :basic
97
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span> <span class="posttext">text after breadcrumbs</span></div>},
105
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span> <span class="posttext">text after breadcrumbs</span></div>},
98
106
  breadcrumbs(posttext: "text after breadcrumbs").to_s
99
107
  end
100
108
 
101
109
  test "autoroot disabled" do
102
110
  breadcrumb :basic
103
- assert_equal "", breadcrumbs(autoroot: false).to_s
111
+ assert_dom_equal "", breadcrumbs(autoroot: false).to_s
104
112
  end
105
113
 
106
- test "shows separator" do
114
+ test "separator" do
107
115
  breadcrumb :with_root
108
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &raquo; <span class="current">About</span></div>},
116
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &raquo; <span class="current">About</span></div>},
109
117
  breadcrumbs(separator: " &raquo; ").to_s
110
118
  end
111
119
 
112
- test "shows element id" do
120
+ test "element id" do
113
121
  breadcrumb :basic
114
- assert_equal %{<div class="breadcrumbs" id="custom_id"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
122
+ assert_dom_equal %{<div class="breadcrumbs" id="custom_id"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
115
123
  breadcrumbs(id: "custom_id").to_s
116
124
  end
117
125
 
118
- test "shows custom container class" do
126
+ test "custom container class" do
119
127
  breadcrumb :basic
120
- assert_equal %{<div class="custom_class"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
128
+ assert_dom_equal %{<div class="custom_class"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
121
129
  breadcrumbs(class: "custom_class").to_s
122
130
  end
123
131
 
124
- test "shows custom current class" do
132
+ test "custom current class" do
125
133
  breadcrumb :basic
126
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="custom_current_class">About</span></div>},
134
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="custom_current_class">About</span></div>},
127
135
  breadcrumbs(current_class: "custom_current_class").to_s
128
136
  end
129
137
 
138
+ test "custom pretext class" do
139
+ breadcrumb :basic
140
+ assert_dom_equal %{<div class="breadcrumbs"><span class="custom_pretext_class">You are here:</span> <a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
141
+ breadcrumbs(pretext: "You are here:", pretext_class: "custom_pretext_class").to_s
142
+ end
143
+
144
+ test "custom posttext class" do
145
+ breadcrumb :basic
146
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span> <span class="custom_posttext_class">after breadcrumbs</span></div>},
147
+ breadcrumbs(posttext: "after breadcrumbs", posttext_class: "custom_posttext_class").to_s
148
+ end
149
+
130
150
  test "unsafe html" do
131
151
  breadcrumb :with_unsafe_html
132
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test &lt;strong&gt;bold text&lt;/strong&gt;</span></div>},
152
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test &lt;strong&gt;bold text&lt;/strong&gt;</span></div>},
133
153
  breadcrumbs.to_s
134
154
  end
135
155
 
136
156
  test "safe html" do
137
157
  breadcrumb :with_safe_html
138
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test <strong>bold text</strong></span></div>},
158
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test <strong>bold text</strong></span></div>},
139
159
  breadcrumbs.to_s
140
160
  end
141
161
 
@@ -213,53 +233,53 @@ class HelperMethodsTest < ActionView::TestCase
213
233
  end
214
234
  end
215
235
 
216
- assert_equal %{<div class="breadcrumbs"><a href="/about">Test</a> &rsaquo; <span class="current">Other Link</span></div>},
236
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/about">Test</a> &rsaquo; <span class="current">Other Link</span></div>},
217
237
  breadcrumbs(autoroot: false).to_s
218
238
  end
219
239
 
220
240
  test "without link" do
221
241
  breadcrumb :without_link
222
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; Also without link &rsaquo; <span class="current">Without link</span></div>},
242
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; Also without link &rsaquo; <span class="current">Without link</span></div>},
223
243
  breadcrumbs.to_s
224
244
  end
225
245
 
226
246
  test "view context" do
227
247
  breadcrumb :using_view_helper
228
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">TestTest</span></div>},
248
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">TestTest</span></div>},
229
249
  breadcrumbs.to_s
230
250
  end
231
251
 
232
252
  test "multiple arguments" do
233
253
  breadcrumb :with_multiple_arguments, "One", "Two", "Three"
234
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">First OneOne then TwoTwo then ThreeThree</a> &rsaquo; <span class="current">One and Two and Three</span></div>},
254
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">First OneOne then TwoTwo then ThreeThree</a> &rsaquo; <span class="current">One and Two and Three</span></div>},
235
255
  breadcrumbs.to_s
236
256
  end
237
257
 
238
258
  test "from views folder" do
239
259
  breadcrumb :from_views
240
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Breadcrumb From View</span></div>},
260
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Breadcrumb From View</span></div>},
241
261
  breadcrumbs.to_s
242
262
  end
243
263
 
244
264
  test "with_breadcrumb" do
245
265
  breadcrumb :basic
246
266
 
247
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
267
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
248
268
  breadcrumbs.to_s
249
269
 
250
270
  with_breadcrumb(:with_parent_object, issues(:one)) do
251
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/projects/1">Test Project</a> &rsaquo; <span class="current">Test Issue</span></div>},
271
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/projects/1">Test Project</a> &rsaquo; <span class="current">Test Issue</span></div>},
252
272
  breadcrumbs.to_s
253
273
  end
254
274
 
255
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
275
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
256
276
  breadcrumbs.to_s
257
277
  end
258
278
 
259
279
  test "calling breadcrumbs helper twice" do
260
280
  breadcrumb :with_parent
261
281
  2.times do
262
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">About</a> &rsaquo; <span class="current">Contact</span></div>},
282
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <a href="/about">About</a> &rsaquo; <span class="current">Contact</span></div>},
263
283
  breadcrumbs.to_s
264
284
  end
265
285
  end
@@ -294,7 +314,7 @@ class HelperMethodsTest < ActionView::TestCase
294
314
 
295
315
  test "inferred breadcrumb" do
296
316
  breadcrumb Project.first
297
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test Project</span></div>},
317
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">Test Project</span></div>},
298
318
  breadcrumbs.to_s
299
319
  end
300
320
 
@@ -302,43 +322,43 @@ class HelperMethodsTest < ActionView::TestCase
302
322
 
303
323
  test "default style" do
304
324
  breadcrumb :basic
305
- assert_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
325
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; <span class="current">About</span></div>},
306
326
  breadcrumbs.to_s
307
327
  end
308
328
 
309
329
  test "ordered list style" do
310
330
  breadcrumb :basic
311
- assert_equal %{<ol class="breadcrumbs"><li><a href="/">Home</a></li><li class="current">About</li></ol>},
331
+ assert_dom_equal %{<ol class="breadcrumbs"><li><a href="/">Home</a></li><li class="current">About</li></ol>},
312
332
  breadcrumbs(style: :ol).to_s
313
333
  end
314
334
 
315
335
  test "unordered list style" do
316
336
  breadcrumb :basic
317
- assert_equal %{<ul class="breadcrumbs"><li><a href="/">Home</a></li><li class="current">About</li></ul>},
337
+ assert_dom_equal %{<ul class="breadcrumbs"><li><a href="/">Home</a></li><li class="current">About</li></ul>},
318
338
  breadcrumbs(style: :ul).to_s
319
339
  end
320
340
 
321
341
  test "bootstrap style" do
322
342
  breadcrumb :basic
323
- assert_equal %{<ol class="breadcrumb"><li><a href="/">Home</a></li><li class="active">About</li></ol>},
343
+ assert_dom_equal %{<ol class="breadcrumb"><li><a href="/">Home</a></li><li class="active">About</li></ol>},
324
344
  breadcrumbs(style: :bootstrap).to_s
325
345
  end
326
346
 
327
347
  test "foundation5 style" do
328
348
  breadcrumb :basic
329
- assert_equal %{<ul class="breadcrumbs"><li><a href="/">Home</a></li><li class="current">About</li></ul>},
349
+ assert_dom_equal %{<ul class="breadcrumbs"><li><a href="/">Home</a></li><li class="current">About</li></ul>},
330
350
  breadcrumbs(style: :foundation5).to_s
331
351
  end
332
352
 
333
353
  test "custom container and fragment tags" do
334
354
  breadcrumb :basic
335
- assert_equal %{<c class="breadcrumbs"><f><a href="/">Home</a></f> &rsaquo; <f class="current">About</f></c>},
355
+ assert_dom_equal %{<c class="breadcrumbs"><f><a href="/">Home</a></f> &rsaquo; <f class="current">About</f></c>},
336
356
  breadcrumbs(container_tag: :c, fragment_tag: :f).to_s
337
357
  end
338
358
 
339
359
  test "custom semantic container and fragment tags" do
340
360
  breadcrumb :basic
341
- assert_equal %{<c class="breadcrumbs"><f itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Home</span></a></f> &rsaquo; <f class="current" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">About</span></f></c>},
361
+ assert_dom_equal %Q{<c class="breadcrumbs"><f itemscope="#{itemscope_value}" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Home</span></a></f> &rsaquo; <f class="current" itemscope="#{itemscope_value}" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">About</span></f></c>},
342
362
  breadcrumbs(container_tag: :c, fragment_tag: :f, semantic: true).to_s
343
363
  end
344
364
 
@@ -354,7 +374,7 @@ class HelperMethodsTest < ActionView::TestCase
354
374
 
355
375
  breadcrumb :basic
356
376
 
357
- assert_equal %{<one class="breadcrumbs"><two><a href="/">Home</a></two><two class="current">About</two></one>},
377
+ assert_dom_equal %{<one class="breadcrumbs"><two><a href="/">Home</a></two><two class="current">About</two></one>},
358
378
  breadcrumbs(style: :test_style).to_s
359
379
  end
360
380
 
@@ -376,7 +396,7 @@ class HelperMethodsTest < ActionView::TestCase
376
396
  end
377
397
 
378
398
  breadcrumb :about
379
- assert_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
399
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
380
400
 
381
401
  sleep 1 # File change interval is 1 second
382
402
 
@@ -392,7 +412,7 @@ class HelperMethodsTest < ActionView::TestCase
392
412
  end
393
413
 
394
414
  breadcrumb :about
395
- assert_equal %{<div class="breadcrumbs"><a href="/test">Home (reloaded)</a> &rsaquo; <span class="current">About (reloaded)</span></div>}, breadcrumbs.to_s
415
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/test">Home (reloaded)</a> &rsaquo; <span class="current">About (reloaded)</span></div>}, breadcrumbs.to_s
396
416
  end
397
417
 
398
418
  test "reload configuration when file is added" do
@@ -421,7 +441,7 @@ class HelperMethodsTest < ActionView::TestCase
421
441
  end
422
442
 
423
443
  breadcrumb :about
424
- assert_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
444
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
425
445
  end
426
446
 
427
447
  test "reload configuration when file is deleted" do
@@ -449,7 +469,7 @@ class HelperMethodsTest < ActionView::TestCase
449
469
  end
450
470
 
451
471
  breadcrumb :contact
452
- assert_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <a href="/about">About (loaded)</a> &rsaquo; <span class="current">Contact (loaded)</span></div>}, breadcrumbs.to_s
472
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <a href="/about">About (loaded)</a> &rsaquo; <span class="current">Contact (loaded)</span></div>}, breadcrumbs.to_s
453
473
 
454
474
  File.delete path.join("pages.rb")
455
475
 
@@ -459,7 +479,7 @@ class HelperMethodsTest < ActionView::TestCase
459
479
  end
460
480
 
461
481
  breadcrumb :about
462
- assert_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
482
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
463
483
  end
464
484
 
465
485
  test "reloads only in development environment" do
@@ -479,7 +499,7 @@ class HelperMethodsTest < ActionView::TestCase
479
499
  end
480
500
 
481
501
  breadcrumb :about
482
- assert_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
502
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
483
503
 
484
504
  sleep 1
485
505
 
@@ -495,7 +515,7 @@ class HelperMethodsTest < ActionView::TestCase
495
515
  end
496
516
 
497
517
  breadcrumb :about
498
- assert_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
518
+ assert_dom_equal %{<div class="breadcrumbs"><a href="/">Home (loaded)</a> &rsaquo; <span class="current">About (loaded)</span></div>}, breadcrumbs.to_s
499
519
  end
500
520
 
501
521
  private
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gretel
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Bunk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Gretel is a Ruby on Rails plugin that makes it easy yet flexible to create
@@ -46,13 +46,16 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".gitignore"
50
- - ".travis.yml"
49
+ - .gitignore
50
+ - .travis.yml
51
51
  - CHANGELOG.md
52
52
  - Gemfile
53
53
  - LICENSE.txt
54
54
  - README.md
55
55
  - Rakefile
56
+ - gemfiles/Gemfile-rails.3.2.x
57
+ - gemfiles/Gemfile-rails.4.0.x
58
+ - gemfiles/Gemfile-rails.4.1.x
56
59
  - gretel.gemspec
57
60
  - lib/generators/gretel/USAGE
58
61
  - lib/generators/gretel/install_generator.rb
@@ -124,17 +127,17 @@ require_paths:
124
127
  - lib
125
128
  required_ruby_version: !ruby/object:Gem::Requirement
126
129
  requirements:
127
- - - ">="
130
+ - - '>='
128
131
  - !ruby/object:Gem::Version
129
132
  version: '0'
130
133
  required_rubygems_version: !ruby/object:Gem::Requirement
131
134
  requirements:
132
- - - ">="
135
+ - - '>='
133
136
  - !ruby/object:Gem::Version
134
137
  version: '0'
135
138
  requirements: []
136
139
  rubyforge_project:
137
- rubygems_version: 2.2.1
140
+ rubygems_version: 2.1.10
138
141
  signing_key:
139
142
  specification_version: 4
140
143
  summary: Flexible Ruby on Rails breadcrumbs plugin.