Sha256: 56f321845866997e81116675bf6d8fd1bab49f0be605d94237170c83f796d57d
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe "Tagger" do before(:each) do [TaggableModel, Tag, Tagging, TaggableUser].each(&:delete_all) @user = TaggableUser.new @taggable = TaggableModel.new(:name => "Bob Jones") end it "should have taggings" do @user.tag(@taggable, :with=>'ruby,scheme', :on=>:tags) @user.owned_taggings.size == 2 end it "should have tags" do @user.tag(@taggable, :with=>'ruby,scheme', :on=>:tags) @user.owned_tags.size == 2 end it "should not overlap or lose tags from different users" do @user2 = TaggableUser.new lambda{ @user.tag(@taggable, :with => 'ruby, scheme', :on => :tags) @user2.tag(@taggable, :with => 'java, python, lisp, ruby', :on => :tags) }.should change(Tagging, :count).by(6) @user.owned_tags.map(&:name).sort.should == %w(ruby scheme).sort @user2.owned_tags.map(&:name).sort.should == %w(java python lisp ruby).sort @taggable.tags_from(@user).sort.should == %w(ruby scheme).sort @taggable.tags_from(@user2).sort.should == %w(java lisp python ruby).sort @taggable.all_tags_list_on(:tags).sort.should == %w(ruby scheme java python lisp).sort @taggable.all_tags_on(:tags).size.should == 6 end it "is tagger" do @user.is_tagger?.should(be_true) end end
Version data entries
4 entries across 4 versions & 1 rubygems