Sha256: 537508fe81324741bebc826d94d122ceb54d79ff6f89d1366ee15abcea824732

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

require 'spec_helper'

describe Gutentag::Tagging do
  describe '#valid?' do
    let(:tag)      { Gutentag::Tag.create! :name => 'pancakes' }
    let(:taggable) { Article.create! }

    it "ensures tags are unique for any given taggable" do
      tagging = Gutentag::Tagging.new
      tagging.tag      = tag
      tagging.taggable = taggable
      tagging.save!

      tagging = Gutentag::Tagging.new
      tagging.tag      = tag
      tagging.taggable = taggable

      tagging.valid?
      expect(tagging.errors[:tag_id].length).to eq(1)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gutentag-0.5.1 spec/models/gutentag/tagging_spec.rb