mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix error on supplier page, add test to cover
This commit is contained in:
@@ -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 })
|
||||
|
||||
36
spec/requests/consumer/suppliers_spec.rb
Normal file
36
spec/requests/consumer/suppliers_spec.rb
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user