mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-03 02:21:33 +00:00
Distributors, product, suppliers and taxonomy specs pass
This commit is contained in:
@@ -10,9 +10,9 @@ feature %q{
|
||||
|
||||
scenario "viewing a list of distributors" do
|
||||
# Given some distributors
|
||||
d1 = create(:distributor)
|
||||
d2 = create(:distributor)
|
||||
d3 = create(:distributor)
|
||||
d1 = create(:distributor_enterprise)
|
||||
d2 = create(:distributor_enterprise)
|
||||
d3 = create(:distributor_enterprise)
|
||||
|
||||
# And some of those distributors have a product
|
||||
create(:product, :distributors => [d1, d2])
|
||||
@@ -29,7 +29,7 @@ feature %q{
|
||||
context "when a distributor is selected" do
|
||||
it "displays the distributor's details" do
|
||||
# Given a distributor with a product
|
||||
d = create(:distributor, :name => 'Melb Uni Co-op', :description => '<p>Hello, world!</p>')
|
||||
d = create(:distributor_enterprise, :name => 'Melb Uni Co-op', :description => '<p>Hello, world!</p>')
|
||||
create(:product, :distributors => [d])
|
||||
|
||||
# When I select the distributor
|
||||
@@ -40,12 +40,12 @@ feature %q{
|
||||
page.should have_selector 'h2', :text => 'Melb Uni Co-op'
|
||||
|
||||
# And I should see the distributor's long description
|
||||
page.should have_selector 'div.distributor-description', :text => 'Hello, world!'
|
||||
page.should have_selector 'div.enterprise-description', :text => 'Hello, world!'
|
||||
end
|
||||
|
||||
it "displays the distributor's name on the home page" do
|
||||
# Given a distributor with a product
|
||||
d = create(:distributor, :name => 'Melb Uni Co-op', :description => '<p>Hello, world!</p>')
|
||||
d = create(:distributor_enterprise, :name => 'Melb Uni Co-op', :description => '<p>Hello, world!</p>')
|
||||
create(:product, :distributors => [d])
|
||||
|
||||
# When I select the distributor
|
||||
@@ -63,8 +63,8 @@ feature %q{
|
||||
taxonomy = Spree::Taxonomy.find_by_name('Products') || create(:taxonomy, :name => 'Products')
|
||||
taxonomy_root = taxonomy.root
|
||||
taxon = create(:taxon, :name => 'Taxon one', :parent_id => taxonomy_root.id)
|
||||
d1 = create(:distributor)
|
||||
d2 = create(:distributor)
|
||||
d1 = create(:distributor_enterprise)
|
||||
d2 = create(:distributor_enterprise)
|
||||
p1 = create(:product, :distributors => [d1], :taxons => [taxon])
|
||||
p2 = create(:product, :distributors => [d2], :taxons => [taxon])
|
||||
|
||||
@@ -90,7 +90,7 @@ feature %q{
|
||||
|
||||
it "allows the user to leave the distributor" do
|
||||
# Given a distributor with a product
|
||||
d = create(:distributor, :name => 'Melb Uni Co-op')
|
||||
d = create(:distributor_enterprise, :name => 'Melb Uni Co-op')
|
||||
create(:product, :distributors => [d])
|
||||
|
||||
# When I select the distributor and then leave it
|
||||
@@ -105,7 +105,7 @@ feature %q{
|
||||
context "viewing a product, it provides a choice of distributor when adding to cart" do
|
||||
it "works when no distributor is chosen" do
|
||||
# Given a distributor and a product under it
|
||||
distributor = create(:distributor)
|
||||
distributor = create(:distributor_enterprise)
|
||||
product = create(:product, :distributors => [distributor])
|
||||
|
||||
# When we view the product
|
||||
@@ -118,7 +118,7 @@ feature %q{
|
||||
|
||||
it "displays the local distributor as the default choice when available for the current product" do
|
||||
# Given a distributor and a product under it
|
||||
distributor = create(:distributor)
|
||||
distributor = create(:distributor_enterprise)
|
||||
product = create(:product, :distributors => [distributor])
|
||||
|
||||
# When we select the distributor and view the product
|
||||
@@ -132,8 +132,8 @@ feature %q{
|
||||
|
||||
it "works when viewing a product from a remote distributor" do
|
||||
# Given two distributors and our product under one
|
||||
distributor_product = create(:distributor)
|
||||
distributor_no_product = create(:distributor)
|
||||
distributor_product = create(:distributor_enterprise)
|
||||
distributor_no_product = create(:distributor_enterprise)
|
||||
product = create(:product, :distributors => [distributor_product])
|
||||
create(:product, :distributors => [distributor_no_product])
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ feature %q{
|
||||
|
||||
scenario "viewing a product shows its supplier and distributor" do
|
||||
# Given a product with a supplier and distributor
|
||||
s = create(:supplier)
|
||||
d = create(:distributor)
|
||||
s = create(:supplier_enterprise)
|
||||
d = create(:distributor_enterprise)
|
||||
p = create(:product, :supplier => s, :distributors => [d])
|
||||
|
||||
# When I view the product
|
||||
|
||||
@@ -10,9 +10,9 @@ feature %q{
|
||||
|
||||
scenario "viewing a list of suppliers in the sidebar" do
|
||||
# Given some suppliers
|
||||
s1 = create(:supplier)
|
||||
s2 = create(:supplier)
|
||||
s3 = create(:supplier)
|
||||
s1 = create(:supplier_enterprise)
|
||||
s2 = create(:supplier_enterprise)
|
||||
s3 = create(:supplier_enterprise)
|
||||
|
||||
# And some of those suppliers have a product
|
||||
create(:product, :supplier => s1)
|
||||
@@ -29,9 +29,9 @@ feature %q{
|
||||
|
||||
scenario "viewing a list of all suppliers" do
|
||||
# Given some suppliers
|
||||
s1 = create(:supplier)
|
||||
s2 = create(:supplier)
|
||||
s3 = create(:supplier)
|
||||
s1 = create(:supplier_enterprise)
|
||||
s2 = create(:supplier_enterprise)
|
||||
s3 = create(:supplier_enterprise)
|
||||
|
||||
# And some of those suppliers have a product
|
||||
create(:product, :supplier => s1)
|
||||
@@ -49,7 +49,7 @@ feature %q{
|
||||
|
||||
scenario "viewing products provided by a supplier" do
|
||||
# Given a supplier with a product
|
||||
s = create(:supplier, :name => 'Murrnong', :long_description => "<p>Hello, world!</p>")
|
||||
s = create(:supplier_enterprise, :name => 'Murrnong', :long_description => "<p>Hello, world!</p>")
|
||||
p = create(:product, :supplier => s)
|
||||
|
||||
# When I select the supplier
|
||||
@@ -58,7 +58,7 @@ feature %q{
|
||||
|
||||
# Then I should see the supplier details
|
||||
page.should have_selector 'h2', :text => s.name
|
||||
page.should have_selector 'div.supplier-description', :text => 'Hello, world!'
|
||||
page.should have_selector 'div.enterprise-description', :text => 'Hello, world!'
|
||||
|
||||
# And I should see the product
|
||||
page.should have_content p.name
|
||||
|
||||
@@ -40,8 +40,8 @@ feature %q{
|
||||
taxon_two = create(:taxon, :name => 'Taxon two', :parent_id => taxonomy_root.id)
|
||||
taxon_three = create(:taxon, :name => 'Taxon three', :parent_id => taxonomy_root.id)
|
||||
|
||||
my_distributor = create(:distributor, :name => 'My Distributor')
|
||||
other_distributor = create(:distributor, :name => 'Other Distributor')
|
||||
my_distributor = create(:distributor_enterprise, :name => 'My Distributor')
|
||||
other_distributor = create(:distributor_enterprise, :name => 'Other Distributor')
|
||||
|
||||
1.times { create(:product, :taxons => [taxon_one], :distributors => [other_distributor]) }
|
||||
2.times { create(:product, :taxons => [taxon_two], :distributors => [other_distributor]) }
|
||||
|
||||
Reference in New Issue
Block a user