Sha256: dac47d20d90e23b4803a237f7a22e4d785ad7ffcc3ff2d41fca1cc8a9caf56bd

Contents?: true

Size: 934 Bytes

Versions: 14

Compression:

Stored size: 934 Bytes

Contents

require 'spec_helper'

describe "TagManager Integration" do
  before(:each) do
    @contact = Contact.create!(:name => "Bob Bobster")
    @user = User.create!(:name => "My User")
    @contact_tag_manager = Tagalong::TagManager.new(@contact, @user)
  end

  describe "#add_tag" do
    it "add new tag to contact" do
      @contact_tag_manager.add_tag("fool")
      @contact.tagalong_tags.map { |r| r.name }.should include("fool")
    end

    it "add an existing tag to contact" do
      @contact_tag_manager.add_tag("bar")
      @contact_tag_manager.add_tag("bar")
    end
  end

  describe "#remove_tag" do
    it "remove tag from contact" do
      cm_contact_tag = @user.tagalong_tags.create!(:name => "crazy")
      @contact.tagalong_taggings.create!(:tagalong_tag_id => cm_contact_tag.id)
      @contact_tag_manager.remove_tag("crazy")
      @contact.tagalong_tags.map { |r| r.name }.should_not include("crazy")
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tagalong-0.1.4 spec/integration/tag_manager_integration_spec.rb
tagalong-0.1.3 spec/integration/tag_manager_integration_spec.rb
tagalong-0.1.2 spec/integration/tag_manager_integration_spec.rb
tagalong-0.1.1 spec/integration/tag_manager_integration_spec.rb
tagalong-0.1.0 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.9 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.8 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.7 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.6 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.5 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.4 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.3 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.2 spec/integration/tag_manager_integration_spec.rb
tagalong-0.0.1 spec/integration/tag_manager_integration_spec.rb