foodsoft/spec/integration/supplier_spec.rb
2015-04-11 02:52:57 +02:00

30 lines
909 B
Ruby

# encoding: utf-8
require_relative '../spec_helper'
describe SuppliersController, :type => :feature do
let(:supplier) { create :supplier }
describe :type => :feature, :js => true do
let(:user) { create :user, groups:[create(:workgroup, role_suppliers: true)] }
before { login user }
it 'can be created' do
visit suppliers_path
click_on I18n.t('suppliers.index.action_new')
supplier = build :supplier
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