Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the micodata option when set as a direct option of render_crumbs #50

Merged
merged 1 commit into from
Aug 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/crummy/standard_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def render_crumbs(crumbs, options = {})
options[:links] ||= Crummy.configuration.links
options[:first_class] ||= Crummy.configuration.first_class
options[:last_class] ||= Crummy.configuration.last_class
options[:microdata] ||= Crummy.configuration.microdata
options[:microdata] ||= Crummy.configuration.microdata if options[:microdata].nil?
options[:truncate] ||= Crummy.configuration.truncate if options[:truncate]
options[:last_crumb_linked] = Crummy.configuration.last_crumb_linked if options[:last_crumb_linked].nil?

Expand Down
19 changes: 19 additions & 0 deletions test/standard_renderer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ def test_link_html_options_with_microdata
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
end

def test_inline_configuration
renderer = StandardRenderer.new
Crummy.configure do |config|
config.microdata = true
config.last_crumb_linked = true
end

assert_no_match(/itemscope/, renderer.render_crumbs([['name', 'url']], :microdata => false))
assert_match(/href/, renderer.render_crumbs([['name', 'url']], :last_crumb_linked => true))

Crummy.configure do |config|
config.microdata = false
config.last_crumb_linked = true
end

assert_match(/itemscope/, renderer.render_crumbs([['name', 'url']], :microdata => true))
assert_no_match(/href/, renderer.render_crumbs([['name', 'url']], :last_crumb_linked => false))
end

def test_configuration
renderer = StandardRenderer.new
# check defaults
Expand Down