diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1ee17cbf40..66eb4753d1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -89,6 +89,7 @@ RSpec.configure do |config| config.include Devise::TestHelpers, :type => :controller config.include OpenFoodNetwork::FeatureToggleHelper config.include OpenFoodNetwork::EnterpriseGroupsHelper + config.include OpenFoodNetwork::DistributionHelper config.include ActionView::Helpers::DateHelper # Factory girl diff --git a/spec/support/request/distribution_helper.rb b/spec/support/request/distribution_helper.rb new file mode 100644 index 0000000000..57512562a8 --- /dev/null +++ b/spec/support/request/distribution_helper.rb @@ -0,0 +1,14 @@ +module OpenFoodNetwork + module DistributionHelper + + def select_distribution(distributor, order_cycle) + create_enterprise_group_for distributor + visit root_path + click_link distributor.name + + if page.has_select? 'order_order_cycle_id' + select_by_value order_cycle.id, from: 'order_order_cycle_id' + end + end + end +end