add more articles to test sorting with
This commit is contained in:
parent
de326e5505
commit
78936c307c
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(:article_category_a) { create :article_category, name: 'AAAA' }
|
||||
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_b) { create :article, name: 'BBBB', note: 'BBBB', unit: '500 g', article_category: article_category_b, availability: true }
|
||||
let(:article_c) { create :article, name: 'CCCC', note: 'CCCC', unit: '500 g', article_category: article_category_b, availability: true }
|
||||
let(:article_category_c) { create :article_category, name: 'CCCC' }
|
||||
let(:article_a) { create :article, name: 'AAAA', note: 'CCC', unit: '750 g', article_category: article_category_b, availability: false }
|
||||
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(:order2) { create :order }
|
||||
|
||||
|
@ -29,16 +30,16 @@ describe ArticlesController, type: :controller do
|
|||
describe 'GET index' do
|
||||
it 'assigns sorting on articles' do
|
||||
sortings = [
|
||||
['name', [article_a, article_b]],
|
||||
['name_reverse', [article_b, article_a]],
|
||||
['unit', [article_a, article_b]],
|
||||
['unit_reverse', [article_b, article_a]],
|
||||
['article_category', [article_a, article_b]],
|
||||
['article_category_reverse', [article_b, article_a]],
|
||||
['note', [article_a, article_b]],
|
||||
['note_reverse', [article_b, article_a]],
|
||||
['availability', [article_a, article_b]],
|
||||
['availability_reverse', [article_b, article_a]]
|
||||
['name', [article_a, article_b, article_c]],
|
||||
['name_reverse', [article_c, article_b, article_a]],
|
||||
['note', [article_b, article_c, article_a]],
|
||||
['note_reverse', [article_a, article_c, article_b]],
|
||||
['unit', [article_c, article_b, article_a]],
|
||||
['unit_reverse', [article_a, article_b, article_c]],
|
||||
['article_category', [article_b, article_a, article_c]],
|
||||
['article_category_reverse', [article_c, article_a, article_b]],
|
||||
['availability', [article_a, article_b, article_c]],
|
||||
['availability_reverse', [article_b, article_c, article_a]]
|
||||
]
|
||||
sortings.each do |sorting|
|
||||
get_with_supplier :index, params: { sort: sorting[0] }
|
||||
|
|
Loading…
Reference in a new issue