diff --git a/app/controllers/spree/suppliers_controller.rb b/app/controllers/spree/suppliers_controller.rb index 5591b30156..3b3f29cead 100644 --- a/app/controllers/spree/suppliers_controller.rb +++ b/app/controllers/spree/suppliers_controller.rb @@ -1,5 +1,7 @@ module Spree class SuppliersController < BaseController + helper 'spree/products' + def show options = {:supplier_id => params[:id]} options.merge(params.reject { |k,v| k == :id }) diff --git a/spec/requests/consumer/suppliers_spec.rb b/spec/requests/consumer/suppliers_spec.rb new file mode 100644 index 0000000000..a1eb1d40e8 --- /dev/null +++ b/spec/requests/consumer/suppliers_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +feature %q{ + As a consumer + I want to see a list of products from a supplier + So that I can connect with them (and maybe buy stuff too) +} do + include AuthenticationWorkflow + include WebHelper + + scenario "viewing a list of suppliers" do + # Given some suppliers + s1 = create(:supplier) + s2 = create(:supplier) + s3 = create(:supplier) + + # When I go to the home page + visit spree.root_path + + # Then I should see a list containing all the suppliers + [s1, s2, s3].each { |s| page.should have_selector 'a', :text => s.name } + end + + scenario "viewing products provided by a supplier" do + # Given a supplier with a product + s = create(:supplier, :name => 'Murrnong') + p = create(:product, :supplier => s) + + # When I select the supplier + visit spree.root_path + click_link s.name + + # Then I should see the product + page.should have_content p.name + end +end