Sha256: 4b14549754fdc0bb8121646bd5dc28b2fff82063f7789de6f8c6f82c9bce25c7
Contents?: true
Size: 823 Bytes
Versions: 9
Compression:
Stored size: 823 Bytes
Contents
require 'spec_helper' 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
9 entries across 9 versions & 2 rubygems