8_increase_test_coverage_controllers #36
1 changed files with 15 additions and 14 deletions
|
@ -6,11 +6,12 @@ describe ArticlesController, type: :controller do
|
||||||
let(:user) { create :user, :role_article_meta }
|
let(:user) { create :user, :role_article_meta }
|
||||||
let(:article_category_a) { create :article_category, name: 'AAAA' }
|
let(:article_category_a) { create :article_category, name: 'AAAA' }
|
||||||
let(:article_category_b) { create :article_category, name: 'BBBB' }
|
let(:article_category_b) { create :article_category, name: 'BBBB' }
|
||||||
let(:article_a) { create :article, name: 'AAAA', note: 'AAAA', unit: '250 g', article_category: article_category_a, availability: false }
|
let(:article_category_c) { create :article_category, name: 'CCCC' }
|
||||||
let(:article_b) { create :article, name: 'BBBB', note: 'BBBB', unit: '500 g', article_category: article_category_b, availability: true }
|
let(:article_a) { create :article, name: 'AAAA', note: 'CCC', unit: '750 g', article_category: article_category_b, availability: false }
|
||||||
let(:article_c) { create :article, name: 'CCCC', note: 'CCCC', unit: '500 g', article_category: article_category_b, availability: true }
|
let(:article_b) { create :article, name: 'BBBB', note: 'AAA', unit: '500 g', article_category: article_category_a, availability: true }
|
||||||
|
let(:article_c) { create :article, name: 'CCCC', note: 'BBB', unit: '250 g', article_category: article_category_c, availability: true }
|
||||||
|
|
||||||
let(:supplier) { create :supplier, articles: [article_a, article_b] }
|
let(:supplier) { create :supplier, articles: [article_a, article_b, article_c] }
|
||||||
let(:order) { create :order }
|
let(:order) { create :order }
|
||||||
let(:order2) { create :order }
|
let(:order2) { create :order }
|
||||||
|
|
||||||
|
@ -29,16 +30,16 @@ describe ArticlesController, type: :controller do
|
||||||
describe 'GET index' do
|
describe 'GET index' do
|
||||||
it 'assigns sorting on articles' do
|
it 'assigns sorting on articles' do
|
||||||
sortings = [
|
sortings = [
|
||||||
['name', [article_a, article_b]],
|
['name', [article_a, article_b, article_c]],
|
||||||
['name_reverse', [article_b, article_a]],
|
['name_reverse', [article_c, article_b, article_a]],
|
||||||
['unit', [article_a, article_b]],
|
['note', [article_b, article_c, article_a]],
|
||||||
['unit_reverse', [article_b, article_a]],
|
['note_reverse', [article_a, article_c, article_b]],
|
||||||
['article_category', [article_a, article_b]],
|
['unit', [article_c, article_b, article_a]],
|
||||||
['article_category_reverse', [article_b, article_a]],
|
['unit_reverse', [article_a, article_b, article_c]],
|
||||||
['note', [article_a, article_b]],
|
['article_category', [article_b, article_a, article_c]],
|
||||||
['note_reverse', [article_b, article_a]],
|
['article_category_reverse', [article_c, article_a, article_b]],
|
||||||
['availability', [article_a, article_b]],
|
['availability', [article_a, article_b, article_c]],
|
||||||
['availability_reverse', [article_b, article_a]]
|
['availability_reverse', [article_b, article_c, article_a]]
|
||||||
]
|
]
|
||||||
sortings.each do |sorting|
|
sortings.each do |sorting|
|
||||||
get_with_supplier :index, params: { sort: sorting[0] }
|
get_with_supplier :index, params: { sort: sorting[0] }
|
||||||
|
|
Loading…
Reference in a new issue