mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 16:53:37 +02:00
parent
3afd542b1a
commit
ae64c7cbed
3 changed files with 16 additions and 2 deletions
|
@ -2,10 +2,10 @@ require 'csv'
|
|||
|
||||
class AccountActivity < ActiveRecord::Base
|
||||
include Versions
|
||||
belongs_to :account
|
||||
belongs_to :account, required: true
|
||||
belongs_to :bank_transaction
|
||||
belongs_to :invoice
|
||||
|
||||
belongs_to :price, class_name: 'Billing::Price'
|
||||
|
||||
CREATE = 'create'
|
||||
RENEW = 'renew'
|
||||
|
|
|
@ -6,6 +6,7 @@ module Billing
|
|||
self.auto_html5_validation = false
|
||||
|
||||
belongs_to :zone, class_name: 'DNS::Zone', required: true
|
||||
has_many :account_activities
|
||||
|
||||
validates :price, :valid_from, :operation_category, :duration, presence: true
|
||||
validates :operation_category, inclusion: { in: Proc.new { |price| price.class.operation_categories } }
|
||||
|
|
13
spec/models/account_activity_spec.rb
Normal file
13
spec/models/account_activity_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountActivity do
|
||||
describe 'account validation', db: false do
|
||||
subject(:account_activity) { described_class.new }
|
||||
|
||||
it 'rejects absent' do
|
||||
account_activity.account = nil
|
||||
account_activity.validate
|
||||
expect(account_activity.errors).to have_key(:account)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue