mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Fix invoice tests
This commit is contained in:
parent
10891d1638
commit
e987e201ad
6 changed files with 33 additions and 2 deletions
|
@ -2,7 +2,7 @@ class Admin::InvoicesController < AdminController
|
|||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@q = Invoice.search(params[:q])
|
||||
@q = Invoice.includes(:account_activity).search(params[:q])
|
||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||
@invoices = @q.result.page(params[:page])
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ Fabricator(:account) do
|
|||
account_type { Account::CASH }
|
||||
balance 0.0
|
||||
currency 'EUR'
|
||||
account_activities(count: 2)
|
||||
# account_activities(count: 2)
|
||||
end
|
||||
|
|
|
@ -9,4 +9,5 @@ Fabricator(:invoice) do
|
|||
seller_street { 'Paldiski mnt. 123' }
|
||||
invoice_items(count: 2)
|
||||
vat_prc 0.2
|
||||
buyer { Fabricate(:registrar) }
|
||||
end
|
||||
|
|
28
spec/features/admin/invoice_spec.rb
Normal file
28
spec/features/admin/invoice_spec.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Invoice', type: :feature do
|
||||
background { create_settings }
|
||||
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
|
||||
Fabricate(:invoice)
|
||||
end
|
||||
|
||||
it 'should show index of invoices' do
|
||||
sign_in @user
|
||||
visit admin_invoices_url
|
||||
i = Invoice.first
|
||||
page.should have_link("Invoice no. #{i.id}")
|
||||
end
|
||||
|
||||
it 'should show invoice' do
|
||||
sign_in @user
|
||||
visit admin_invoices_url
|
||||
i = Invoice.first
|
||||
|
||||
click_link("Invoice no. #{i.id}")
|
||||
page.should have_content("Seller")
|
||||
page.should have_content("Details")
|
||||
page.should have_content("Paldiski mnt. 123")
|
||||
end
|
||||
end
|
|
@ -3,6 +3,7 @@ require 'rails_helper'
|
|||
feature 'Account activity', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:api_user)
|
||||
Fabricate(:account_activity, account: @user.registrar.cash_account)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
|
|
|
@ -4,6 +4,7 @@ feature 'Invoices', type: :feature do
|
|||
before :all do
|
||||
create_settings
|
||||
@user = Fabricate(:api_user)
|
||||
Fabricate(:invoice)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue