require 'spec_helper' require 'mercado_pago_rails/mercado_pago_checkout' require_relative 'mercado_pago_test_model' describe MercadoPagoCheckout do let(:model) { MercadoPagoTestModel.new } subject(:mercado_pago_checkout) { MercadoPagoCheckout.new(model) } describe "#generate" do context "when the preference wants to be created" do it "it returns a hash with the correct data" do mercado_pago_checkout.generate("root_url", "root_url", "root_url").should eq get_preference end end end def get_preference {:external_reference=>1, :items=>[{:id=>"", :title=>"translation missing: en.mercadopago.preference.title", :quantity=>3, :unit_price=>12, :currency_id=>"ARS", :picture_url=>"/test/url"}], :payer=>{:name=>"John", :surname=>"Smith", :email=>"johnsmith@example.com"}, :back_urls=>{:pending=>"root_url", :success=>"root_url", :failure=>"root_url"}} end end