Sha256: 54b3353d2f6d37810a7c0481d7d51d5e4903254f7a3120c4fa1888d15f1981a0

Contents?: true

Size: 1.49 KB

Versions: 29

Compression:

Stored size: 1.49 KB

Contents

# coding utf-8

require 'rails_helper'

describe Adherent::ReglementsController, :type => :controller do
  
  before(:each) do
   @routes = Adherent::Engine.routes
   @member = double(Adherent::Member)
   @pay = double(Adherent::Payment, :member=>@member, :non_impute=>52)
  end
  
  describe 'GET new' do
    
    it 'rend la vue new' do
      expect(Adherent::Payment).to receive(:find).with(@pay.to_param).and_return @pay
      
      allow(@pay).to receive(:reglements).and_return(@ar = double(Arel))
      allow(@ar).to receive(:new).and_return(@reglt = double(Adherent::Reglement))
      get :new, payment_id:@pay.to_param
      expect(assigns[:reglement]).to eq(@reglt)
      expect(response).to render_template('new')
    end
    
    it 'preremplit @reglement avec non impute' do
      allow(Adherent::Payment).to receive(:find).with(@pay.to_param).and_return @pay
      expect(@pay).to receive(:reglements).and_return(@ar =double(Arel))
      expect(@ar).to receive(:new).with(:amount=>52).and_return(@reglt = double(Adherent::Reglement))
      get :new, payment_id:@pay.to_param
    end
    
  end
  
  describe 'POST create' do
    
    it 'renvoie vers la liste des payments' do
      allow(Adherent::Payment).to receive(:find).with(@pay.to_param).and_return @pay
      expect(@pay).to receive(:imputation_on_adh).with('9')
      post :create, {payment_id:@pay.to_param, :reglement=>{:adhesion_id=>'9'}}
      expect(response).to redirect_to member_payments_url(@pay.member)
    end
    
    
  end
  
  
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
adherent-0.3.13 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.12 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.11 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.10 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.9 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.7 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.6 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.5 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.4 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.3 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.2 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.1 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.3.0 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.9 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.8 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.7 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.6 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.5 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.4 spec/controllers/adherent/reglements_controller_spec.rb
adherent-0.2.3 spec/controllers/adherent/reglements_controller_spec.rb