Add test for foreign invoices in registrar #2819

This commit is contained in:
Martin Lensment 2015-08-14 13:51:42 +03:00
parent a551d1b4e0
commit d5563a4d2b

View file

@ -50,5 +50,18 @@ feature 'Invoices', type: :feature do
response_headers['Content-Type'].should == 'application/pdf' response_headers['Content-Type'].should == 'application/pdf'
response_headers['Content-Disposition'].should == "attachment; filename=\"#{@invoice.pdf_name}\"" response_headers['Content-Disposition'].should == "attachment; filename=\"#{@invoice.pdf_name}\""
end end
it 'should not see foreign invoices' do
user2 = Fabricate(:api_user, identity_code: @user.identity_code)
visit '/registrar/invoices'
click_link @invoice.to_s
page.should have_text(@invoice.to_s)
page.should have_text('Buyer')
click_link "#{user2} (#{user2.roles.first}) - #{user2.registrar}"
page.should have_text('You are not authorized to access this page.')
visit "/registrar/invoices/#{@invoice.id}/forward"
page.should have_text('You are not authorized to access this page.')
end
end end
end end