Sha256: 88b642da0f1c8fb5678e16353f5163ae8f4b1cc8f639e1bad680159c68c35976

Contents?: true

Size: 1020 Bytes

Versions: 16

Compression:

Stored size: 1020 Bytes

Contents

require 'spec_helper'

describe Storytime::Tagging do
  it "unused tags remain after deleting a post" do
    post_1 = FactoryGirl.create(:post, tag_list: ["tag1", "tag2"])
    post_2 = FactoryGirl.create(:post, tag_list: ["tag1"])
    Storytime::Tag.all.count.should == 2
    post_1.destroy
    Storytime::Tag.all.count.should == 2
    post_2.destroy
    Storytime::Tag.all.count.should == 2
  end

  it "does not remove unused tags after updating tag list" do
    post_1 = FactoryGirl.create(:post, tag_list: ["tag1", "tag2"])
    Storytime::Tag.all.count.should == 2
    post_1.update(tag_list: ["tag1"])
    Storytime::Tag.all.count.should == 2
    post_1.tags.count.should == 1
  end

  it "does not removes tags used by other posts after updating tag list" do
    post_1 = FactoryGirl.create(:post, tag_list: ["tag1", "tag2"])
    post_2 = FactoryGirl.create(:post, tag_list: ["tag2"])
    Storytime::Tag.all.count.should == 2
    post_1.update(tag_list: ["tag1"])
    Storytime::Tag.all.count.should == 2
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
storytime-2.1.6 spec/models/tagging_spec.rb
storytime-2.1.5 spec/models/tagging_spec.rb
storytime-2.1.4 spec/models/tagging_spec.rb
storytime-2.1.3 spec/models/tagging_spec.rb
storytime-2.1.2 spec/models/tagging_spec.rb
storytime-2.1.1 spec/models/tagging_spec.rb
storytime-2.1.0 spec/models/tagging_spec.rb
storytime-2.0.0 spec/models/tagging_spec.rb
storytime-1.2.0 spec/models/tagging_spec.rb
storytime-1.1.1 spec/models/tagging_spec.rb
storytime-1.0.7 spec/models/tagging_spec.rb
storytime-1.0.6 spec/models/tagging_spec.rb
storytime-1.0.5 spec/models/tagging_spec.rb
storytime-1.0.2 spec/models/tagging_spec.rb
storytime-1.0.1 spec/models/tagging_spec.rb
storytime-1.0.0 spec/models/tagging_spec.rb