Sha256: aa6aa9f1faa313146f835c287b13d853edf010dbe1447687d4f87921bb9440e0

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

# coding utf-8

require 'rails_helper'

describe Adherent::PaymentsHelper do
  
  def duo
    "#{I18n::l(Date.today)} au #{I18n::l(Date.today.years_since(1)-1)}"
  end
  
  fixtures :all
  
  context 'le paiement est fait par un membre pour son adhésion' do
    
    before(:each) do
      @pay = adherent_payments(:pay_1)
      @mem = @pay.member
    end
    
    it 'indique l adhésion' do
      expect(recu_cotisation(@pay, @mem)).
        to eq("votre adhésion pour la période du #{duo}") 
    end
    
    it 'même si le membre n existe plus' do
      @mem.destroy
      expect(recu_cotisation(@pay, @mem)).
        to eq("l'adhésion de Effacé pour la période du ??? au ???")
    end
    
  end
  
  context 'avec un payment qui couvre plusieurs reglements' do
    
    before(:each) do
      @pay = adherent_payments(:pay_2)
      @mem = adherent_members(:Dupont)
    end
    
    it 'sait faire la liste des adhesions concernées' do
      adh1 = @pay.reglements.first.adhesion
      adh2 = @pay.reglements.last.adhesion
      expect(recu_cotisation(@pay, @mem)).
        to eq("les adhésions de : - #{coords(adh2)} pour la période du #{duo} - #{coords(adh1)} pour la période du #{duo}")
    end
    
    it 'sans erreur même si le membre n existe plus' do
      @mem.destroy
      expect {recu_cotisation(@pay, @mem)}.
        not_to raise_error
    end
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adherent-0.3.13 spec/helpers/adherent/payments_helper_spec.rb
adherent-0.3.12 spec/helpers/adherent/payments_helper_spec.rb