Sha256: f588fec96bce103981c614378923f2ec1bc53dfff02e85bd9ae8bcb5b43997d0

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'fixtures/chain_of_responsibility_factory'

describe "Chain Of Responsibility as a class method" do
  let(:items) { 
    [
      Product.new(
        :price => 5.0,
        :description => "Hat with wide brim"
      ),
      Product.new(
        :price => 10.20,
        :description => "Office chair",
        :discount => 50
      ),
      Promotion.new(
        :description => "Add our after-sales care and receive a further 10% off your order"
      )
    ]
  }

  subject(:products) { ProductsPresenter.new(items).products }

  it "builds a ProductPresenter for a normal product" do
    products[0].description.should == "Hat with wide brim"
    products[0].price.should == "$5.00"
  end

  it "builds a SpecialsPresenter for a product on sale" do
    products[1].description.should == "On Sale! - Office chair"
    products[1].price.should == "$5.10"
  end

  it "builds a PromotionPresenter for a promotion" do
    products[2].description.should == "Add our after-sales care and receive a further 10% off your order"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pymn-0.0.2 integration/chain_of_responsibility_factory_spec.rb
pymn-0.0.1 integration/chain_of_responsibility_factory_spec.rb