crumble
crumble copied to clipboard
Add css classes and wrapper_html support
Some people asked for this, also I really needed these features myself. Didn't add tests, I didn't learn tests yet, sorry.
The logic is the following:
- First css class is added to first link, but if there is only one link, it will be set to last css class.
- If dont_link_last_crumb is set to true, it adds last css class to last link, but it is the penultimate trail: trail[trail.size-2].
- wrapper_html is added only when crumbs is not empty.
Thanks for the patch. Will be happy to pull this once there's test for it. Not much to learn about them. Just look at the existing ones and use them as your baseline.
It's not so easy if you never did it before, even with given examples.
Is it possible to test generated string with BreadcrumbsHelper.crumbs
? As I see you never did it, you just test if structures are being filled correctly.
How do you run these tests?
~/workspace/crumble[master]% rake -T (in /Users/sekrett/workspace/crumble) rake aborted! no such file to load -- spec/rake/spectask /Users/sekrett/workspace/crumble/Rakefile:3:in `' (See full trace by running task with --trace)
~/workspace/crumble[master]% rspec ./spec/breadcrumbs_helper_spec.rb /Users/sekrett/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.4/lib/action_view/helpers/tag_helper.rb:10:in `': uninitialized constant ActionView::Helpers::TagHelper::ERB (NameError)
I have rspec 2.0 and 2.4. For now I was able to do only this:
~/workspace/crumble[master]% rspec ./spec/breadcrumb_spec.rb .......... Finished in 0.00224 seconds 10 examples, 0 failures
*** LOCAL GEMS *** rspec (2.4.0, 2.0.1) rspec-core (2.4.0, 2.0.1) rspec-expectations (2.4.0, 2.0.1) rspec-mocks (2.4.0, 2.0.1) rspec-rails (2.0.1) rspec-rails-mocha (0.2.1)
Think I'm gonna have to upgrade the specs for Rspec 2.x before that'd work. They still rely on 1.x.
Yes. please upgrade. I will learn rspec 2 now.
Hello, Matt!
How are you? So I did not manage to upgrade to RSpec2. I get the error undefined local variable or method
_routes' `. But also specs do not run on Spec 1.3 and Rails 3.0. The gem is very old, so I don't know how to fix all dependencies. Anyway now I am sure all test pass, because some of them passed on RSpec1, others on RSpec2.
@sekrett hey, i haven't been able to upgrade it myself unfortunately.