require 'test/unit'
require 'rubygems'
require 'shoulda'
require 'mocha'
require 'fakeweb'
require File.join(File.dirname(__FILE__), '..', 'lib', 'eroi')
FakeWeb.allow_net_connect = false
def fixture_file(filename)
return '' if filename == ''
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
File.read(file_path)
end
def stub_get(url, filename, status=nil)
options = { :body => fixture_file(filename) }
options.merge!({ :status => status }) unless status.nil?
FakeWeb.register_uri(:get, url, options)
end
def user_token
'test_user_token'
end
def api_password
'test_api_password'
end
def successful_post_response
<<-EOF
Yes
OK
MailingListName_someEditionName
1
1526
1
1
0
Complete
EOF
end
def successful_get_response
<<-EOF
523
someone@somecompany.com
Joe
Somebody
Some Company
some data here
We'll put more data here
And we'll put more notes here
20030913143010
5
3
1
2
Sent
State
City
EOF
end
def unsuccessful_get_response(code = 1)
"#{code}"
end