Skip to content

Commit

Permalink
Adding Call#remove_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Phillips committed Aug 29, 2008
1 parent e4c09a7 commit b65a720
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/adhearsion/voip/call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def initialize(call)
end
end


class FailedExtensionCallException < MetaAgiCallException; end

class HungupExtensionCallException < MetaAgiCallException; end
Expand Down Expand Up @@ -167,6 +166,12 @@ def tag(symbol)
end
end

def remove_tag(symbol)
@tag_mutex.synchronize do
@tags.reject! { |tag| tag == symbol }
end
end

def tagged_with?(symbol)
@tag_mutex.synchronize do
@tags.include? symbol
Expand Down
9 changes: 9 additions & 0 deletions spec/voip/test_dialplan_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ def mock_dial_plan_lookup_for_context_name
call.tagged_with?(:authorized).should.equal false
end

test "Call#remove_tag" do
call = new_call_for_context "roflcopter"
call.tag :moderator
call.tag :female
call.remove_tag :female
call.tag :male
call.tags.should == [:moderator, :male]
end

test 'Call#tagged_with? with many tags' do
call = new_call_for_context "roflcopter"
call.tag :customer
Expand Down

0 comments on commit b65a720

Please sign in to comment.