Sha256: f91ef97bed8bba9dd2577918b1402105433a95d0aadc2f0be2ce2e2e73779f74
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe ActsAsTaggableOn::TagsHelper do before(:each) do clean_database! @bob = TaggableModel.create(:name => "Bob Jones", :language_list => "ruby, php") @tom = TaggableModel.create(:name => "Tom Marley", :language_list => "ruby, java") @eve = TaggableModel.create(:name => "Eve Nodd", :language_list => "ruby, c++") @helper = class Helper include ActsAsTaggableOn::TagsHelper end.new end it "should yield the proper css classes" do tags = { } @helper.tag_cloud(TaggableModel.tag_counts_on(:languages), ["sucky", "awesome"]) do |tag, css_class| tags[tag.name] = css_class end tags["ruby"].should == "awesome" tags["java"].should == "sucky" tags["c++"].should == "sucky" tags["php"].should == "sucky" end it "should handle tags with zero counts (build for empty)" do bob = ActsAsTaggableOn::Tag.create(:name => "php") tom = ActsAsTaggableOn::Tag.create(:name => "java") eve = ActsAsTaggableOn::Tag.create(:name => "c++") tags = { } @helper.tag_cloud(ActsAsTaggableOn::Tag.all, ["sucky", "awesome"]) do |tag, css_class| tags[tag.name] = css_class end tags["java"].should == "sucky" tags["c++"].should == "sucky" tags["php"].should == "sucky" end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
acts_as_taggable_on-3.0.0.rc1 | spec/acts_as_taggable_on/tags_helper_spec.rb |
acts-as-taggable-on-2.4.1 | spec/acts_as_taggable_on/tags_helper_spec.rb |