2013-09-18 12:44:41 +02:00
|
|
|
require_relative '../spec_helper'
|
2013-07-24 21:25:57 +02:00
|
|
|
|
2015-04-24 15:19:57 +02:00
|
|
|
feature 'supplier' do
|
2013-09-18 12:44:41 +02:00
|
|
|
let(:supplier) { create :supplier }
|
2013-07-24 21:25:57 +02:00
|
|
|
|
2015-04-24 15:19:57 +02:00
|
|
|
describe 'create new' do
|
2021-03-01 15:27:26 +01:00
|
|
|
let(:user) { create :user, groups: [create(:workgroup, role_suppliers: true)] }
|
2022-02-20 16:15:22 +01:00
|
|
|
|
2013-07-24 21:25:57 +02:00
|
|
|
before { login user }
|
|
|
|
|
|
|
|
it 'can be created' do
|
2020-08-01 02:49:15 +02:00
|
|
|
create :supplier_category
|
2013-07-24 21:25:57 +02:00
|
|
|
visit suppliers_path
|
|
|
|
click_on I18n.t('suppliers.index.action_new')
|
2013-09-18 12:44:41 +02:00
|
|
|
supplier = build :supplier
|
2013-07-24 21:25:57 +02:00
|
|
|
within('#new_supplier') do
|
|
|
|
fill_in 'supplier_name', :with => supplier.name
|
|
|
|
fill_in 'supplier_address', :with => supplier.address
|
|
|
|
fill_in 'supplier_phone', :with => supplier.phone
|
|
|
|
find('input[type="submit"]').click
|
|
|
|
end
|
|
|
|
expect(page).to have_content(supplier.name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is included in supplier list' do
|
|
|
|
supplier
|
|
|
|
visit suppliers_path
|
|
|
|
expect(page).to have_content(supplier.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|