Sha256: 40651dba8aa53cc9146fc58ab651f3ea465fda3dcf454d48bdae5961b0dfc6a7
Contents?: true
Size: 857 Bytes
Versions: 13
Compression:
Stored size: 857 Bytes
Contents
require File.expand_path('../../spec_helper', __FILE__) describe ActsAsTaggableOn::Tagging do before(:each) do clean_database! @tagging = ActsAsTaggableOn::Tagging.new end it "should not be valid with a invalid tag" do @tagging.taggable = TaggableModel.create(:name => "Bob Jones") @tagging.tag = ActsAsTaggableOn::Tag.new(:name => "") @tagging.context = "tags" @tagging.should_not be_valid @tagging.errors[:tag_id].should == ["can't be blank"] end it "should not create duplicate taggings" do @taggable = TaggableModel.create(:name => "Bob Jones") @tag = ActsAsTaggableOn::Tag.create(:name => "awesome") lambda { 2.times { ActsAsTaggableOn::Tagging.create(:taggable => @taggable, :tag => @tag, :context => 'tags') } }.should change(ActsAsTaggableOn::Tagging, :count).by(1) end end
Version data entries
13 entries across 13 versions & 3 rubygems