This commit is contained in:
parent
a9ea9c636f
commit
ff41025584
1 changed files with 11 additions and 4 deletions
|
@ -6,17 +6,24 @@ describe ArticlesController, type: :controller do
|
||||||
let(:user) { create :user, :role_article_meta }
|
let(:user) { create :user, :role_article_meta }
|
||||||
let(:article_categoryA) { create :article_category, name: "AAAA" }
|
let(:article_categoryA) { create :article_category, name: "AAAA" }
|
||||||
let(:article_categoryB) { create :article_category, name: "BBBB" }
|
let(:article_categoryB) { create :article_category, name: "BBBB" }
|
||||||
let(:articleA) { create :article, name: 'AAAA', note: "AAAA", unit: '250 g', article_category: article_categoryA, availability: false }
|
let(:supplier) { create :supplier}
|
||||||
let(:articleB) { create :article, name: 'BBBB', note: "BBBB", unit: '500 g', article_category: article_categoryB, availability: true }
|
let(:articleA) { create :article, name: 'AAAA', note: "AAAA", unit: '250 g', article_category: article_categoryA, availability: false, supplier_id: supplier.id }
|
||||||
|
|
||||||
|
let(:articleB) { create :article, name: 'BBBB', note: "BBBB", unit: '500 g', article_category: article_categoryB, availability: true, supplier_id: supplier.id }
|
||||||
let(:articleC) { create :article, name: 'CCCC', note: "CCCC", unit: '500 g', article_category: article_categoryB, availability: true }
|
let(:articleC) { create :article, name: 'CCCC', note: "CCCC", unit: '500 g', article_category: article_categoryB, availability: true }
|
||||||
|
|
||||||
let(:supplier) { create :supplier, articles: [articleA, articleB] }
|
|
||||||
let(:order) { create :order }
|
let(:order) { create :order }
|
||||||
|
|
||||||
|
|
||||||
before { login user }
|
before { login user }
|
||||||
|
|
||||||
describe 'GET index' do
|
describe 'GET index' do
|
||||||
|
before do
|
||||||
|
supplier
|
||||||
|
articleA
|
||||||
|
articleB
|
||||||
|
supplier.reload
|
||||||
|
end
|
||||||
it 'assigns sorting on articles' do
|
it 'assigns sorting on articles' do
|
||||||
sortings = [
|
sortings = [
|
||||||
['name', [articleA, articleB]],
|
['name', [articleA, articleB]],
|
||||||
|
@ -290,7 +297,7 @@ describe ArticlesController, type: :controller do
|
||||||
let(:shared_article) { create :shared_article, name: "shared" }
|
let(:shared_article) { create :shared_article, name: "shared" }
|
||||||
let(:articleS) { create :article, name: 'SSSS', note: "AAAA", unit: '250 g', article_category: article_categoryA, availability: false }
|
let(:articleS) { create :article, name: 'SSSS', note: "AAAA", unit: '250 g', article_category: article_categoryA, availability: false }
|
||||||
|
|
||||||
let(:supplier_with_shared) { create :supplier, articles: [articleS], shared_supplier: shared_supplier }
|
let(:supplier_with_shared) { create :supplier, shared_supplier: shared_supplier }
|
||||||
|
|
||||||
it 'renders view with articles' do
|
it 'renders view with articles' do
|
||||||
get :shared, params: { foodcoop: FoodsoftConfig[:default_scope], supplier_id: supplier_with_shared.id, name_cont_all_joined: "shared" }, xhr: true
|
get :shared, params: { foodcoop: FoodsoftConfig[:default_scope], supplier_id: supplier_with_shared.id, name_cont_all_joined: "shared" }, xhr: true
|
||||||
|
|
Loading…
Reference in a new issue