# encoding: utf-8 require 'spec_helper' describe CatarseMoip::MoipController do subject{ response } let(:get_token_response){{:status=>:fail, :code=>"171", :message=>"TelefoneFixo do endereço deverá ser enviado obrigatorio", :id=>"201210192052439150000024698931"}} let(:contribution){ double('contribution', { id: 1, key: 'contribution key', payment_id: 'payment id', project: project, pending?: false, value: 10, user: user, payer_name: 'foo', payer_email: 'foo@bar.com', address_street: 'test', address_number: '123', address_complement: '123', address_neighbourhood: '123', address_city: '123', address_state: '123', address_zip_code: '123', address_phone_number: '123', confirmed?: true, confirm!: true, canceled?: true, cancel!: true, refunded?: true, refund!: true, payment_method: 'MoIP', invalid!: true, invlid_payment?: true }) } let(:user){ double('user', id: 1) } let(:project){ double('project', id: 1, name: 'test project') } let(:extra_data){ {"id_transacao"=>contribution.key, "valor"=>"2190", "cod_moip"=>"12345123", "forma_pagamento"=>"1", "tipo_pagamento"=>"CartaoDeCredito", "email_consumidor"=>"some@email.com", "controller"=>"catarse_moip/payment/notifications", "action"=>"create"} } let(:payment_notification) {} before do controller.stub(:current_user).and_return(user) ::MoipTransparente::Checkout.any_instance.stub(:get_token).and_return(get_token_response) ::MoipTransparente::Checkout.any_instance.stub(:moip_widget_tag).and_return('