Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
add a test to deal with concurrent use issues
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Feb 20, 2009
1 parent 728e420 commit e0a8bc1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/campaign_monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def clients
end
end

def new_client
Client.new(nil)
end

def system_date
User_GetSystemDate()
end
Expand Down
10 changes: 10 additions & 0 deletions test/campaign_monitor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ def test_find_existing_client_by_name
assert clients.map {|c| c.name}.include?(CLIENT_NAME), "could not find client named: #{CLIENT_NAME}"
end

# we should not get confused here
def test_can_access_two_accounts_at_once
@cm=CampaignMonitor.new("12345")
@cm2=CampaignMonitor.new("abcdef")
@client=@cm.new_client
@client2=@cm.new_client
assert_equal "12345", @client.cm_client.api_key
assert_equal "abcdef", @client2.cm_client.api_key
end


# campaigns

Expand Down

0 comments on commit e0a8bc1

Please sign in to comment.