From 4ca148ee93045fdee2ce78cf077b16394b271ef0 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Wed, 30 Apr 2014 12:05:53 +1000 Subject: [PATCH] Starting on the producers controller --- app/controllers/producers_controller.rb | 4 ++++ app/views/producers/index.haml | 0 config/routes.rb | 2 ++ spec/controllers/producers_controller_spec.rb | 8 ++++++++ spec/features/consumer/producers_spec.rb | 15 +++++++++++++++ 5 files changed, 29 insertions(+) create mode 100644 app/controllers/producers_controller.rb create mode 100644 app/views/producers/index.haml create mode 100644 spec/controllers/producers_controller_spec.rb create mode 100644 spec/features/consumer/producers_spec.rb diff --git a/app/controllers/producers_controller.rb b/app/controllers/producers_controller.rb new file mode 100644 index 0000000000..615f74871c --- /dev/null +++ b/app/controllers/producers_controller.rb @@ -0,0 +1,4 @@ +class ProducersController < BaseController + def index + end +end diff --git a/app/views/producers/index.haml b/app/views/producers/index.haml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/config/routes.rb b/config/routes.rb index 5f34d480b0..d514641701 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,8 @@ Openfoodnetwork::Application.routes.draw do get :order_cycle end + resources :producers, only: :index + namespace :shop do get '/checkout', :to => 'checkout#edit' , :as => :checkout put '/checkout', :to => 'checkout#update' , :as => :update_checkout diff --git a/spec/controllers/producers_controller_spec.rb b/spec/controllers/producers_controller_spec.rb new file mode 100644 index 0000000000..1d53bb90b9 --- /dev/null +++ b/spec/controllers/producers_controller_spec.rb @@ -0,0 +1,8 @@ +require 'spec_helper' + +describe ProducersController do + it "gets all active producers" do + Enterprise.stub_chain(:active) + get :index + end +end diff --git a/spec/features/consumer/producers_spec.rb b/spec/features/consumer/producers_spec.rb new file mode 100644 index 0000000000..b828b2abc1 --- /dev/null +++ b/spec/features/consumer/producers_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +feature %q{ + As a consumer + I want to see a list of producers + So that I can shop at hubs distributing their products +} do + include UIComponentHelper + let!(:producer) { create(:supplier_enterprise) } + + it "shows all producers" do + visit producers_path + page.should have_content producer.name + end +end