Sha256: b722430dbd20410cd43e40b2cb97aaedd3bae0417cfbb0416298e394a8b3ea51

Contents?: true

Size: 697 Bytes

Versions: 2

Compression:

Stored size: 697 Bytes

Contents

require 'spec_helper'

describe Tag do
  before do
    @tag = Tag.new
  end

  it "should have id and name properties" do
    @tag.attributes.should have_key(:id)
    @tag.attributes.should have_key(:name)
  end

  it "should have many Taggings" do
    Tag.relationships.should have_key(:taggings)
  end

  it "should validate the presence of name" do
    @tag.should_not be_valid
    @tag.name = "Meme"
    @tag.should be_valid
  end

  it "should list taggables for a tag" do
    tag = Tag.create(:name => 'tag1')

    taggable1 = TaggedModel.create(:tag_list => tag.name)
    taggable2 = TaggedModel.create(:tag_list => tag.name)

    tag.taggables.should == [ taggable1, taggable2 ]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-tags-0.10.1 spec/dm-tags/tag_spec.rb
dm-tags-0.10.0 spec/dm-tags/tag_spec.rb