Sha256: 4276aaf4bcfdb6930bfa5cec9865c5d3844f4f87bcd7451117b242ecc479049a

Contents?: true

Size: 771 Bytes

Versions: 10

Compression:

Stored size: 771 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__)))

describe "render_each plugin" do 
  it "calls render with each argument, returning joined string with all results" do
    app(:bare) do
      plugin :render_each
      def render(t, opts)
        "r#{t}#{opts[:locals][:foo] if opts[:locals]}#{opts[:bar]} "
      end 

      route do |r|
        r.root do
          render_each([1,2,3], :foo)
        end

        r.is 'a' do
          render_each([1,2,3], :bar, :local=>:foo, :bar=>4)
        end

        r.is 'b' do
          render_each([1,2,3], :bar, :local=>nil)
        end
      end
    end

    body.should == 'rfoo1 rfoo2 rfoo3 '
    body("/a").should == 'rbar14 rbar24 rbar34 '
    body("/b").should == 'rbar rbar rbar '
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
roda-cj-1.0.5 spec/plugin/render_each_spec.rb
roda-cj-1.0.4 spec/plugin/render_each_spec.rb
roda-cj-1.0.3 spec/plugin/render_each_spec.rb
roda-cj-1.0.2 spec/plugin/render_each_spec.rb
roda-cj-1.0.1 spec/plugin/render_each_spec.rb
roda-cj-1.0.0 spec/plugin/render_each_spec.rb
roda-1.0.0 spec/plugin/render_each_spec.rb
roda-cj-0.9.6 spec/plugin/render_each_spec.rb
roda-cj-0.9.5 spec/plugin/render_each_spec.rb
roda-cj-0.9.4 spec/plugin/render_each_spec.rb