Auto correct rubocop style issues

This commit is contained in:
Patrick Gansterer 2022-02-20 16:15:22 +01:00
parent f260e607bf
commit 7e8c1d041d
39 changed files with 115 additions and 199 deletions

View file

@ -2,8 +2,9 @@ require_relative '../spec_helper'
feature ArticlesController do
let(:user) { create :user, groups: [create(:workgroup, role_article_meta: true)] }
let (:supplier) { create :supplier }
let(:supplier) { create :supplier }
let!(:article_category) { create :article_category }
before { login user }
describe ':index', js: true do
@ -17,7 +18,7 @@ feature ArticlesController do
it 'can create a new article' do
click_on I18n.t('articles.index.new')
expect(page).to have_selector('form#new_article')
article = FactoryBot.build :article, supplier: supplier, article_category: article_category
article = build :article, supplier: supplier, article_category: article_category
within('#new_article') do
fill_in 'article_name', :with => article.name
fill_in 'article_unit', :with => article.unit
@ -37,6 +38,7 @@ feature ArticlesController do
describe ':upload' do
let(:filename) { 'foodsoft_file_02.csv' }
let(:file) { Rails.root.join("spec/fixtures/#{filename}") }
before do
visit upload_supplier_articles_path(supplier_id: supplier.id)
attach_file 'articles_file', file
@ -45,6 +47,7 @@ feature ArticlesController do
Dir.glob('spec/fixtures/foodsoft_file_01.*') do |test_file|
describe "can import articles from #{test_file}" do
let(:file) { Rails.root.join(test_file) }
it do
find('input[type="submit"]').click
expect(find("tr:nth-child(1) #new_articles__note").value).to eq "bio ◎"
@ -63,6 +66,7 @@ feature ArticlesController do
describe "can update existing article" do
let!(:article) { create :article, supplier: supplier, name: 'Foobar', order_number: 1, unit: '250 g' }
it do
find('input[type="submit"]').click
expect(find("#articles_#{article.id}_name").value).to eq 'Tomatoes'
@ -88,6 +92,7 @@ feature ArticlesController do
describe "can remove an existing article" do
let!(:article) { create :article, supplier: supplier, name: 'Foobar', order_number: 99999 }
it do
check('articles_outlist_absent')
find('input[type="submit"]').click
@ -101,6 +106,7 @@ feature ArticlesController do
describe "can convert units when updating" do
let!(:article) { create :article, supplier: supplier, order_number: 1, unit: '250 g' }
it do
check('articles_convert_units')
find('input[type="submit"]').click

View file

@ -12,6 +12,7 @@ feature 'settling an order', js: true do
let(:oa) { order.order_articles.find_by_article_id(article.id) }
let(:goa1) { create :group_order_article, group_order: go1, order_article: oa }
let(:goa2) { create :group_order_article, group_order: go2, order_article: oa }
before do
goa1.update_quantities(3, 0)
goa2.update_quantities(1, 0)
@ -29,6 +30,7 @@ feature 'settling an order', js: true do
end
before { login admin }
before { visit new_finance_order_path(order_id: order.id) }
it 'has product ordered visible' do

View file

@ -5,6 +5,7 @@ feature LoginController do
describe 'forgot password' do
before { visit forgot_password_path }
it 'is accessible' do
expect(page).to have_selector 'input[id=user_email]'
end
@ -21,7 +22,9 @@ feature LoginController do
describe 'and reset it' do
let(:token) { user.reset_password_token }
let(:newpass) { user.new_random_password }
before { user.request_password_reset! }
before { visit new_password_path(id: user.id, token: token) }
it 'is accessible' do
@ -30,6 +33,7 @@ feature LoginController do
describe 'with wrong token' do
let(:token) { 'foobar' }
it 'is not accessible' do
expect(page).to have_selector '.alert-error'
expect(page).to_not have_selector 'input[type=password]'

View file

@ -8,14 +8,17 @@ feature 'the session' do
visit login_path
expect(page).to have_selector('input[type=password]')
end
it 'logs me in' do
login user
expect(page).to_not have_selector('.alert-error')
end
it 'does not log me in with wrong password' do
login user.nick, 'XX' + user.password
expect(page).to have_selector('.alert-error')
end
it 'can log me in using an email address' do
visit login_path
fill_in 'nick', :with => user.email

View file

@ -5,6 +5,7 @@ feature 'supplier' do
describe 'create new' do
let(:user) { create :user, groups: [create(:workgroup, role_suppliers: true)] }
before { login user }
it 'can be created' do