Sha256: 57dcb8e7a00631cf0ae5b93d21fd25e218ca19a6292dc81ecf28b3d12bf4bc58

Contents?: true

Size: 1.14 KB

Versions: 33

Compression:

Stored size: 1.14 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe TagList do
  before(:each) do
    @tag_list = TagList.new("awesome","radical")
  end
  
  it "should be an array" do
    @tag_list.is_a?(Array).should be_true
  end
  
  it "should be able to be add a new tag word" do
    @tag_list.add("cool")
    @tag_list.include?("cool").should be_true
  end
  
  it "should be able to add delimited lists of words" do
    @tag_list.add("cool, wicked", :parse => true)
    @tag_list.include?("cool").should be_true
    @tag_list.include?("wicked").should be_true
  end
  
  it "should be able to remove words" do
    @tag_list.remove("awesome")
    @tag_list.include?("awesome").should be_false
  end
  
  it "should be able to remove delimited lists of words" do
    @tag_list.remove("awesome, radical", :parse => true)
    @tag_list.should be_empty
  end
  
  it "should give a delimited list of words when converted to string" do
    @tag_list.to_s.should == "awesome, radical"
  end
  
  it "should quote escape tags with commas in them" do
    @tag_list.add("cool","rad,bodacious")
    @tag_list.to_s.should == "awesome, radical, cool, \"rad,bodacious\""
  end
end

Version data entries

33 entries across 33 versions & 12 rubygems

Version Path
johnsbrn-acts-as-taggable-on-1.0.5 spec/acts_as_taggable_on/tag_list_spec.rb
johnsbrn-acts-as-taggable-on-1.1.0 spec/acts_as_taggable_on/tag_list_spec.rb
lawrencepit-acts-as-taggable-on-1.0.1 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.1 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.2 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.3 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.4 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.5 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.6.1 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.6 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.7 spec/acts_as_taggable_on/tag_list_spec.rb
masover-acts-as-taggable-on-1.0.2.8 spec/acts_as_taggable_on/tag_list_spec.rb
mbleigh-acts-as-taggable-on-1.0.0 spec/acts_as_taggable_on/tag_list_spec.rb
mbleigh-acts-as-taggable-on-1.0.1 spec/acts_as_taggable_on/tag_list_spec.rb
mbleigh-acts-as-taggable-on-1.0.2 spec/acts_as_taggable_on/tag_list_spec.rb
mbleigh-acts-as-taggable-on-1.0.3 spec/acts_as_taggable_on/tag_list_spec.rb
mbleigh-acts-as-taggable-on-1.0.5 spec/acts_as_taggable_on/tag_list_spec.rb
ozataman-acts-as-taggable-on-1.0.3 spec/acts_as_taggable_on/tag_list_spec.rb
slillibri-acts-as-taggable-on-1.0.5 spec/acts_as_taggable_on/tag_list_spec.rb
slitz-acts-as-taggable-on-1.0.2.1 spec/acts_as_taggable_on/tag_list_spec.rb