Sha256: 15ddb50071084297e2acdff6af782b391c6856db4e2309c650393af4b5773a96
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
require File.expand_path('../../spec_helper', __FILE__) describe ActsAsTaggableOnPadrino::Tagging do before(:each) do @tagging = ActsAsTaggableOnPadrino::Tagging.new end it "should not be valid with a invalid tag" do @tagging.taggable = TaggableModel.create(:name => "Bob Jones") @tagging.tag = ActsAsTaggableOnPadrino::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 = ActsAsTaggableOnPadrino::Tag.create(:name => "awesome") lambda { 2.times { ActsAsTaggableOnPadrino::Tagging.create(:taggable => @taggable, :tag => @tag, :context => 'tags') } }.should change(ActsAsTaggableOnPadrino::Tagging, :count).by(1) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts-as-taggable-on-padrino-0.1.2 | spec/acts_as_taggable_on_padrino/tagging_spec.rb |