Permalink
Browse files

Fixed tests for preapproval

  • Loading branch information...
1 parent 0b1243f commit 85d36074aa54b90e095876b37ce997826220b1f5 @cakestylestaging cakestylestaging committed Apr 11, 2013
View
@@ -1,4 +0,0 @@
-class Authorize < ActiveRecord::Base
- has_many :wepay_checkout_records
-
-end
View
@@ -1,4 +0,0 @@
-class Checkout < ActiveRecord::Base
- has_many :wepay_checkout_records
-
-end
View
@@ -1,4 +0,0 @@
-class Ipn < ActiveRecord::Base
- has_many :wepay_checkout_records
-
-end
@@ -1,4 +0,0 @@
-class Preapproval < ActiveRecord::Base
- has_many :wepay_checkout_records
-
-end
@@ -86,7 +86,7 @@ def preapproval_redirect_uri(security_token)
else
"#{@wepay_config[:root_callback_uri]}/preapproval/success" #redirect to success action with text - ALT: "#{@wepay_config[:root_callback_uri]}/wepay/preapproval"
end
- #apply_security_token(uri, security_token) /// SECURITY TOKEN REMOVED FROM URL
+ apply_security_token(uri, security_token)
end
def apply_security_token(uri, security_token)
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/helper')
class TestWepayRailsCheckoutMethods < ActiveSupport::TestCase
- include WepayRails::Helpers::ControllerHelpers
+ include WepayRails::Helpers::ControllerHelpers
def setup
create_wepay_config_file(false, true)
@@ -1,6 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/helper')
-class TestWepayRailspreapprovalMethods < ActiveSupport::TestCase
+class TestWepayRailsPreapprovalMethods < ActiveSupport::TestCase
include WepayRails::Helpers::ControllerHelpers
def setup
@@ -19,11 +19,9 @@ def teardown
end
test "should create a new WePay preapproval object" do
- security_token = Digest::SHA2.hexdigest("1#{Time.now.to_i}")
- stub_request(:post, "https://stage.wepayapi.com/v2/preapproval/create").
- with(:body => "callback_uri=http%3A%2F%2Fwww.example.com%2Fwepay%2Fipn%3Fsecurity_token%3D#{security_token}&redirect_uri=http%3A%2F%2Fwww.example.com%2Fwepay%2Fpreapproval%3Fsecurity_token%3D#{security_token}&fee_payer=Payee&type=GOODS&charge_tax=0&app_fee=0&auto_capture=1&require_shipping=0&shipping_fee=0&account_id=12345&amount=300&short_description=This%20is%20a%20preapproval%20test!",
- :headers => wepay_gateway.wepay_auth_header).
- to_return(:status => 200, :body => sample_preapproval_response, :headers => {})
+ stub_request(:post, "https://stage.wepayapi.com/v2/preapproval/create").
+ with(:headers => wepay_gateway.wepay_auth_header).
+ to_return(:status => 200, :body => sample_preapproval_response, :headers => {})
@response = wepay_gateway.perform_preapproval(@checkout_params)
assert_equal "6789", @response[:preapproval_id]

0 comments on commit 85d3607

Please sign in to comment.