Sha256: 30864ef8ef4c0cea67901d5b1f8bef3cd326eb76ea8afbd6962bb7126636428e

Contents?: true

Size: 610 Bytes

Versions: 33

Compression:

Stored size: 610 Bytes

Contents

require 'spec_helper'

describe "For Loops" do
  let(:products) { Dugway.store.products }
  let(:products_drop) { Dugway::Drops::ProductsDrop.new(products) }

  it "should render each product name" do
    template = rendered_template("{% for product in products.all %} {{product.name}} {% endfor %}", 'products' => products_drop)
    products.each do |product|
      template.should =~ /#{Regexp.escape(product['name'])}/
    end
  end

  private

  def rendered_template(template, assigns={})
    Liquid::Template.parse(template).render(assigns, :registers => { :currency => Dugway.store.currency })
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
dugway-1.0.14 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.13 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.12 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.10 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.9 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.8 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.7 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.6 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.5 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.4 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.3 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.2 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.1 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-1.0.0 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-0.12.3 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-0.12.2 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-0.12.1 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-0.12.0 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-0.11.4 spec/units/dugway/liquid/misc/for_loop_spec.rb
dugway-0.11.3 spec/units/dugway/liquid/misc/for_loop_spec.rb