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