Sha256: ffe7285cd00bfb4b693a8e069c1be7dce77606a18268af96e5b1aefcc735453b

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require 'rails_helper'

module MnoEnterprise
  RSpec.describe Organization, type: :model do
    describe '#payment_restriction' do
      let(:organization) { FactoryGirl.build(:organization) }
      subject { organization.payment_restriction }

      context 'without metadata' do
        it { is_expected.to be nil }
      end

      context 'without payment restriction' do
        before { organization.meta_data = {} }
        it { is_expected.to be nil }
      end

      context 'with payment restriction' do
        before { organization.meta_data = {payment_restriction: ['visa']} }
        it { is_expected.to eq(['visa']) }
      end
    end

    describe '#has_credit_card_details?' do
      let(:organization) { FactoryGirl.build(:organization) }
      subject { organization.has_credit_card_details? }

      context 'with a credit card' do
        before { organization.credit_card = FactoryGirl.build(:credit_card) }
        it { is_expected.to be true }
      end

      context 'without a credit card' do
        # Her return a new object if non existing
        before { organization.credit_card = MnoEnterprise::CreditCard.new }
        it { is_expected.to be false }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 spec/models/mno_enterprise/organization_spec.rb
mno-enterprise-core-3.3.3 spec/models/mno_enterprise/organization_spec.rb
mno-enterprise-core-3.3.2 spec/models/mno_enterprise/organization_spec.rb
mno-enterprise-core-3.3.1 spec/models/mno_enterprise/organization_spec.rb
mno-enterprise-core-3.3.0 spec/models/mno_enterprise/organization_spec.rb