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

Version Path
axtro-acts-as-taggable-on-2.0.6 spec/acts_as_taggable_on/tagging_spec.rb
axtro-acts-as-taggable-on-2.0.5 spec/acts_as_taggable_on/tagging_spec.rb
axtro-acts-as-taggable-on-2.0.4 spec/acts_as_taggable_on/tagging_spec.rb
litmus-acts-as-taggable-on-2.0.4 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.4 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.3 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.2 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.1 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.0 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.0.rc2 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.0.rc1 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.0.pre5 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-0.0.0 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.0.pre4 spec/acts_as_taggable_on/tagging_spec.rb
acts-as-taggable-on-2.0.0.pre3 spec/acts_as_taggable_on/tagging_spec.rb