mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Add test for filtering by distributor
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<% labels.each do |nm,val| %>
|
||||
<li class="nowrap">
|
||||
<% active = params[:search][filter[:scope]] && params[:search][filter[:scope]].include?(val.to_s) %>
|
||||
<%= link_to nm, "?search[#{filter[:scope].to_s}][]=#{val}" %>
|
||||
<%= link_to nm, "?search[#{filter[:scope].to_s}][]=#{CGI.escape(val)}" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -23,6 +23,21 @@ feature %q{
|
||||
end
|
||||
end
|
||||
|
||||
scenario "browsing products by distributor"
|
||||
scenario "browsing products by distributor" do
|
||||
# Given a product at each of two distributors
|
||||
d1 = create(:distributor)
|
||||
d2 = create(:distributor)
|
||||
p1 = create(:product, :distributors => [d1])
|
||||
p2 = create(:product, :distributors => [d2])
|
||||
|
||||
# When I go to the home page, I should see both products
|
||||
visit spree.root_path
|
||||
page.should have_content p1.name
|
||||
page.should have_content p2.name
|
||||
|
||||
# When I filter by one distributor, I should see only the product from that distributor
|
||||
click_link d1.name
|
||||
page.should have_content p1.name
|
||||
page.should_not have_content p2.name
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user