diff --git a/app/serializers/api/master_variant_serializer.rb b/app/serializers/api/master_variant_serializer.rb deleted file mode 100644 index 8012e8f055..0000000000 --- a/app/serializers/api/master_variant_serializer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Api::MasterVariantSerializer < ActiveModel::Serializer - attributes :id, :is_master, :count_on_hand, :name_to_display, :unit_to_display, :count_on_hand, :on_demand - has_many :images, serializer: Api::TaxonImageSerializer -end diff --git a/app/serializers/api/product_serializer.rb b/app/serializers/api/product_serializer.rb index ccd5999979..547fa1ad25 100644 --- a/app/serializers/api/product_serializer.rb +++ b/app/serializers/api/product_serializer.rb @@ -37,7 +37,7 @@ class Api::CachedProductSerializer < ActiveModel::Serializer has_one :supplier, serializer: Api::IdSerializer has_one :primary_taxon, serializer: Api::TaxonSerializer - has_one :master, serializer: Api::MasterVariantSerializer + has_one :master, serializer: Api::VariantSerializer def variants object.variants_for(options[:current_order_cycle], options[:current_distributor]).in_stock diff --git a/app/serializers/api/variant_serializer.rb b/app/serializers/api/variant_serializer.rb index df186a05c4..eee592c0c5 100644 --- a/app/serializers/api/variant_serializer.rb +++ b/app/serializers/api/variant_serializer.rb @@ -1,8 +1,6 @@ class Api::VariantSerializer < ActiveModel::Serializer - attributes :id, :is_master, :count_on_hand, :name_to_display, :on_demand, - :price - attributes :id, :is_master, :count_on_hand, :name_to_display, :unit_to_display, :on_demand - attributes :price + attributes :id, :is_master, :count_on_hand, :name_to_display, :unit_to_display, + :on_demand, :price has_many :images, serializer: Api::ImageSerializer def price diff --git a/app/views/shop/products/_master.html.haml b/app/views/shop/products/_master.html.haml index 7d5e02bff4..73fc32ea14 100644 --- a/app/views/shop/products/_master.html.haml +++ b/app/views/shop/products/_master.html.haml @@ -46,7 +46,7 @@ .small-4.medium-2.large-2.columns.variant-price .table-cell %i.ofn-i_009-close - {{ product.price | currency }} + {{ product.master.price | currency }} %button.graph-button{"price-breakdown" => "_", "variant" => "product.master", "price-breakdown-animation" => "true"} diff --git a/app/views/shop/products/_variants.html.haml b/app/views/shop/products/_variants.html.haml index 233714106d..056977221f 100644 --- a/app/views/shop/products/_variants.html.haml +++ b/app/views/shop/products/_variants.html.haml @@ -47,7 +47,7 @@ %em {{ variant.unit_to_display }} .small-4.medium-2.large-2.columns.variant-price - .table-cell + .table-cell.price %i.ofn-i_009-close {{ variant.price | currency }} diff --git a/spec/features/consumer/shopping/shopping_spec.rb b/spec/features/consumer/shopping/shopping_spec.rb index 377f56c102..1b6ecd883b 100644 --- a/spec/features/consumer/shopping/shopping_spec.rb +++ b/spec/features/consumer/shopping/shopping_spec.rb @@ -36,7 +36,6 @@ feature "As a consumer I want to shop with a distributor", js: true do exchange.variants << product.master visit shop_path - save_screenshot "/users/willmarshall/Desktop/wtsvg.png" find("#tab_producers a").click page.should have_content supplier.name end @@ -77,7 +76,7 @@ feature "As a consumer I want to shop with a distributor", js: true do page.should have_content "Next order closing in 2 days" Spree::Order.last.order_cycle.should == oc1 page.should have_content product.name - page.should have_content product.master.display_name + page.should have_content product.master.display_name.capitalize page.should have_content product.master.display_as open_product_modal product @@ -112,8 +111,8 @@ feature "As a consumer I want to shop with a distributor", js: true do visit shop_path # Page should not have product.price (with or without fee) - page.should_not have_price "from $10.00" - page.should_not have_price "from $33.00" + page.should_not have_price "$10.00" + page.should_not have_price "$33.00" # Page should have variant prices (with fee) page.should have_price "$43.00" @@ -121,7 +120,7 @@ feature "As a consumer I want to shop with a distributor", js: true do # Product price should be listed as the lesser of these #page.should have_selector 'tr.product > td', text: "from $43.00" - page.should have_price "from $43.00" + page.should have_price "$43.00" end end @@ -140,8 +139,7 @@ feature "As a consumer I want to shop with a distributor", js: true do it "should save group buy data to ze cart" do fill_in "variants[#{product.master.id}]", with: 5 fill_in "variant_attributes[#{product.master.id}][max_quantity]", with: 9 - add_to_cart - page.should have_content product.name + sleep 5 li = Spree::Order.order(:created_at).last.line_items.order(:created_at).last li.max_quantity.should == 9 li.quantity.should == 5