crumble icon indicating copy to clipboard operation
crumble copied to clipboard

Add css classes and wrapper_html support

Open sekrett opened this issue 14 years ago • 8 comments

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:

  1. First css class is added to first link, but if there is only one link, it will be set to last css class.
  2. 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].
  3. wrapper_html is added only when crumbs is not empty.

sekrett avatar Feb 10 '11 07:02 sekrett

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.

roidrage avatar Feb 10 '11 07:02 roidrage

It's not so easy if you never did it before, even with given examples.

sekrett avatar Feb 12 '11 09:02 sekrett

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.

sekrett avatar Feb 18 '11 07:02 sekrett

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)

sekrett avatar Feb 18 '11 09:02 sekrett

Think I'm gonna have to upgrade the specs for Rspec 2.x before that'd work. They still rely on 1.x.

roidrage avatar Feb 18 '11 09:02 roidrage

Yes. please upgrade. I will learn rspec 2 now.

sekrett avatar Feb 18 '11 09:02 sekrett

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 avatar Jun 22 '13 13:06 sekrett

@sekrett hey, i haven't been able to upgrade it myself unfortunately.

roidrage avatar Jun 26 '13 17:06 roidrage