From 50f5064d8e75c5b470fc989125bd2d78174dde69 Mon Sep 17 00:00:00 2001 From: wvengen Date: Thu, 25 Jul 2013 13:08:38 +0200 Subject: [PATCH] fix product distribution integration test --- spec/factories/group_order.rb | 3 ++- spec/integration/product_distribution_example_spec.rb | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/factories/group_order.rb b/spec/factories/group_order.rb index ed6b6017..0b9983e6 100644 --- a/spec/factories/group_order.rb +++ b/spec/factories/group_order.rb @@ -2,8 +2,9 @@ require 'factory_girl' FactoryGirl.define do - # requires order and ordergroup + # requires order factory :group_order do + ordergroup { FactoryGirl.create(:user, groups: [FactoryGirl.create(:ordergroup)]).ordergroup } end end diff --git a/spec/integration/product_distribution_example_spec.rb b/spec/integration/product_distribution_example_spec.rb index 4190bd87..12fd84f5 100644 --- a/spec/integration/product_distribution_example_spec.rb +++ b/spec/integration/product_distribution_example_spec.rb @@ -10,6 +10,14 @@ describe 'product distribution', :type => :feature do let(:oa) { order.order_articles.first } describe :type => :feature do + # make sure users have enough money to order + before do + [user_a, user_b].each do |user| + ordergroup = Ordergroup.find(user.ordergroup.id) + ordergroup.add_financial_transaction! 5000, 'for ordering', admin + end + end + it 'agrees to documented example', :js => true do # gruppe a bestellt 2(3), weil sie auf jeden fall was von x bekommen will login user_a