mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Feature tests for account activities
This commit is contained in:
parent
e4dc1d466f
commit
c4b0d6aee5
7 changed files with 45 additions and 4 deletions
|
@ -5,7 +5,7 @@ class Registrar::AccountActivitiesController < RegistrarController
|
|||
|
||||
def index
|
||||
account = current_user.registrar.cash_account
|
||||
@q = account.activities.search(params[:q])
|
||||
@q = account.activities.includes(:invoice).search(params[:q])
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
@account_activities = @q.result.page(params[:page])
|
||||
end
|
||||
|
|
5
spec/fabricators/account_activity_fabricator.rb
Normal file
5
spec/fabricators/account_activity_fabricator.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
Fabricator(:account_activity) do
|
||||
invoice
|
||||
currency 'EUR'
|
||||
sum 110.0
|
||||
end
|
|
@ -2,4 +2,5 @@ Fabricator(:account) do
|
|||
account_type { Account::CASH }
|
||||
balance 0.0
|
||||
currency 'EUR'
|
||||
account_activities(count: 2)
|
||||
end
|
||||
|
|
|
@ -11,6 +11,10 @@ Fabricator(:registrar) do
|
|||
accounts(count: 1)
|
||||
end
|
||||
|
||||
Fabricator(:registrar_with_no_account_activities, from: :registrar) do
|
||||
accounts(count: 1) { Fabricate(:account, account_activities: []) }
|
||||
end
|
||||
|
||||
Fabricator(:registrar1, from: :registrar) do
|
||||
name 'registrar1'
|
||||
reg_no '111'
|
||||
|
@ -43,4 +47,5 @@ Fabricator(:eis, from: :registrar) do
|
|||
street 'Paldiski mnt 80'
|
||||
zip '10617'
|
||||
url 'www.internet.ee'
|
||||
accounts(count: 1) { Fabricate(:account, account_activities: []) }
|
||||
end
|
||||
|
|
30
spec/features/registrar/account_activity_spec.rb
Normal file
30
spec/features/registrar/account_activity_spec.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Account activity', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:api_user)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to sign in page' do
|
||||
visit '/registrar/account_activities'
|
||||
current_path.should == '/registrar/login'
|
||||
page.should have_text('You need to sign in or sign up')
|
||||
end
|
||||
end
|
||||
|
||||
context 'as signed in user' do
|
||||
before do
|
||||
registrar_sign_in
|
||||
end
|
||||
|
||||
it 'should navigate to the domains index page' do
|
||||
current_path.should == '/registrar'
|
||||
click_link 'Billing'
|
||||
click_link 'Account activity'
|
||||
|
||||
current_path.should == '/registrar/account_activities'
|
||||
page.should have_text('+110.0 EUR')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -40,7 +40,7 @@ describe BankStatement do
|
|||
end
|
||||
|
||||
it 'should bind transactions with invoices' do
|
||||
r = Fabricate(:registrar, reference_no: 'RF7086666663')
|
||||
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
|
||||
r.issue_prepayment_invoice(200, 'add some money')
|
||||
|
||||
bs = Fabricate(:bank_statement, bank_transactions: [
|
||||
|
@ -70,7 +70,7 @@ describe BankStatement do
|
|||
end
|
||||
|
||||
it 'should not bind transactions with invalid match data' do
|
||||
r = Fabricate(:registrar, reference_no: 'RF7086666663')
|
||||
r = Fabricate(:registrar_with_no_account_activities, reference_no: 'RF7086666663')
|
||||
r.issue_prepayment_invoice(200, 'add some money')
|
||||
|
||||
bs = Fabricate(:bank_statement, bank_transactions: [
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||
describe Repp::AccountV1 do
|
||||
before :all do
|
||||
@registrar1 = Fabricate(:registrar1, accounts:
|
||||
[Fabricate(:account, { balance: '324.45' })]
|
||||
[Fabricate(:account, { balance: '324.45', account_activities: [] })]
|
||||
)
|
||||
@api_user = Fabricate(:gitlab_api_user, registrar: @registrar1)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue