Permalink
Browse files

fix robokassa test

  • Loading branch information...
nashby committed Mar 16, 2012
1 parent ec801d3 commit 07fb5494134f4ec8b3650ad3efee2f39f7c9be7d
@@ -2,34 +2,34 @@
class RobokassaHelperTest < Test::Unit::TestCase
include ActiveMerchant::Billing::Integrations
def setup
@helper = Robokassa::Helper.new(123,'test_account', :amount => 500, :currency => 'USD', :secret => 'secret')
end
def test_basic_helper_fields
assert_field 'MerchantLogin', 'test_account'
assert_field 'MrchLogin', 'test_account'
assert_field 'OutSum', '500'
assert_field 'InvId', '123'
end
def test_signature_string
assert_equal 'test_account:500:123:secret', @helper.generate_signature_string
end
def test_custom_fields
@helper.shpa = '123'
@helper.shpMySuperParam = '456'
assert_field 'shpa', '123'
assert_field 'shpMySuperParam', '456'
end
def test_signature_string_with_custom_fields
@helper.shpb = '456'
@helper.shpa = '123'
assert_equal 'test_account:500:123:secret:shpa=123:shpb=456', @helper.generate_signature_string
end
end
@@ -18,14 +18,14 @@ def test_compositions
end
# Replace with real successful acknowledgement code
def test_acknowledgement
def test_acknowledgement
assert @robokassa.acknowledge
end
def test_respond_to_acknowledge
assert @robokassa.respond_to?(:acknowledge)
end
def test_wrong_signature
@robokassa = Robokassa::Notification.new(http_raw_data_with_wrong_signature, :secret => 'secret')
assert !@robokassa.acknowledge
@@ -34,9 +34,9 @@ def test_wrong_signature
private
def http_raw_data
"InvId=123&OutSum=500&SignatureValue=277b232ef6891f07c9c0a4017113153b&shpMySuperParam=456&shpa=123"
end
end
def http_raw_data_with_wrong_signature
"InvId=123&OutSum=500&SignatureValue=wrong&shpMySuperParam=456&shpa=123"
end
end
end

0 comments on commit 07fb549

Please sign in to comment.