spec/veritrans_events_spec.rb in veritrans-2.1.3 vs spec/veritrans_events_spec.rb in veritrans-2.2.0

- old
+ new

@@ -4,17 +4,17 @@ before do stub_const("CONFIG", {}) Veritrans.logger = Logger.new(STDOUT) Veritrans.file_logger = Logger.new(STDOUT) Veritrans.setup do - config.load_yml "./example/veritrans.yml#development" + config.load_yml "./example/sinatra/veritrans.yml#development" end end after do - if Veritrans.events.listeners - Veritrans.events.listeners.clear + if Veritrans::Events.listeners + Veritrans::Events.listeners.clear end end JSON_RESPONSE = '{ "status_code": "200", @@ -32,17 +32,17 @@ }' DOUBLE_ENCODED_JSON_RESPONSE = JSON.dump(JSON_RESPONSE) def stub_vt_status_response - stub_request(:any, /.*veritrans.*/).to_return(lambda {|request| + stub_request(:any, /.*(veritrans|midtrans).*/).to_return(lambda {|request| {status: 200, body: JSON_RESPONSE} }) end it "should work with single encoded json" do - Veritrans.events.subscribe('payment.success') do |payment| + Veritrans::Events.subscribe('payment.success') do |payment| @payment = payment end stub_vt_status_response @@ -53,10 +53,10 @@ @payment.order_id.should == "testing-0.2703-1415600236" end it "should work with double encoded json" do - Veritrans.events.subscribe('payment.success') do |payment| + Veritrans::Events.subscribe('payment.success') do |payment| @payment = payment end stub_vt_status_response \ No newline at end of file