mirror of
https://github.com/internetee/registry.git
synced 2025-07-12 14:08:17 +02:00
Add account activities view to admin #2893
This commit is contained in:
parent
ce3397dbfb
commit
34e4342219
7 changed files with 151 additions and 0 deletions
45
spec/features/admin/account_activity_spec.rb
Normal file
45
spec/features/admin/account_activity_spec.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Account activity', type: :feature do
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user)
|
||||
r = Fabricate(:registrar)
|
||||
Fabricate.times(5, :account_activity, account: r.cash_account)
|
||||
Fabricate(:account_activity, account: r.cash_account, description: 'acc activity test', sum: -12)
|
||||
end
|
||||
|
||||
context 'as unknown user' do
|
||||
it 'should redirect to sign in page' do
|
||||
visit '/admin/account_activities'
|
||||
current_path.should == '/admin/login'
|
||||
page.should have_text('You need to sign in or sign up')
|
||||
end
|
||||
end
|
||||
|
||||
context 'as signed in user' do
|
||||
before do
|
||||
sign_in @user
|
||||
end
|
||||
|
||||
it 'should navigate to account activities page' do
|
||||
visit admin_account_activities_path
|
||||
page.should have_text('+110.0 EUR', count: 5)
|
||||
page.should have_text('-12.0 EUR')
|
||||
end
|
||||
|
||||
it 'should search activities by description' do
|
||||
visit admin_account_activities_path
|
||||
fill_in 'Description', with: 'test'
|
||||
find('.btn.btn-default.search').click
|
||||
page.should have_text('-12.0 EUR')
|
||||
page.should_not have_text('+110.0 EUR')
|
||||
end
|
||||
|
||||
it 'should download csv' do
|
||||
visit admin_account_activities_path
|
||||
click_link 'Export CSV'
|
||||
response_headers['Content-Type'].should == 'text/csv'
|
||||
response_headers['Content-Disposition'].should match(/attachment; filename="account_activities_\d+\.csv"/)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue