Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
# frozen_string_literal: true
require 'rails_helper'
describe ContractTemplate do
it_behaves_like 'an exploitable'
describe 'associations' do
it { is_expected.to belong_to(:project) }
it { is_expected.to belong_to(:parent).optional }
it { is_expected.to have_many(:duplicates) }
it { is_expected.to have_many(:talent_releases).dependent(:restrict_with_error) }
it { is_expected.to have_many(:appearance_releases).dependent(:restrict_with_error) }
it { is_expected.to have_many(:location_releases).dependent(:restrict_with_error) }
it { is_expected.to have_many(:material_releases).dependent(:restrict_with_error) }
end
describe 'validations' do
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:release_type) }
end
describe '#fee' do
it { is_expected.to monetize(:fee) }
end
describe '#fee?' do
it 'returns true when there is a fee amount' do
fee_contract = build(:contract_template, fee: 500)
no_fee_contract = build(:contract_template, fee: 0)
expect(fee_contract).to be_fee
expect(no_fee_contract).not_to be_fee
end
end
describe '#duplicated?' do
it 'returns true when there is a parent association' do
contract_template = build(:contract_template, parent: build(:contract_template))
expect(contract_template).to be_duplicated
end
end
end