Skip to content

Commit

Permalink
removed ruby 2.0 ** syntax
Browse files Browse the repository at this point in the history
fixed side-efect of removing :no_container option from args
added spec
  • Loading branch information
Incanus3 committed Jan 22, 2015
1 parent b476ab4 commit 5c1d6b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/bh/helpers/link_to_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ module Helpers
# end
# end
def link_to(*args, &block)
options = args.extract_options!
options = args.extract_options!.dup
no_container = options.delete(:no_container)
args << options unless options.empty?

link_to = Bh::LinkTo.new self, *args, **options, &block
link_to = Bh::LinkTo.new self, *args, &block

link_to.append_class! :'alert-link' if Bh::Stack.find(Bh::AlertBox)
link_to.append_class! :'navbar-brand' if Bh::Stack.find(Bh::Vertical)
Expand Down
8 changes: 7 additions & 1 deletion spec/shared/link_to_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@
bh.nav { expect(:link_to).to generate html }
end
end

specify 'does not surround the link in <li> if no_container: true given' do
options = { no_container: true }
html = '<a href="/">content</a>'
bh.nav { expect(link_to: options).to generate html }
end
end

shared_examples_for 'the link wrapped in vertical' do
specify 'surrounds the link in a <li> item' do
html = '<li><a href="/">content</a></li>'
bh.vertical { expect(:link_to).to generate html }
end
end
end

0 comments on commit 5c1d6b5

Please sign in to comment.