Sha256: d681ce82b2b7f84ccc4c3dde2a66e4ab1ed7c4505da677e52c579e9a292dd366

Contents?: true

Size: 914 Bytes

Versions: 12

Compression:

Stored size: 914 Bytes

Contents

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

begin
  require 'tilt/erb'
rescue LoadError
  warn "tilt not installed, skipping content_for plugin test"  
else
describe "content_for plugin" do
  before do
    app(:bare) do
      plugin :render
      render_opts[:views] = "./spec/views"
      plugin :content_for

      route do |r|
        r.root do
          view(:inline=>"<% content_for :foo do %>foo<% end %>bar", :layout=>{:inline=>'<%= yield %> <%= content_for(:foo) %>'})
        end
        r.get 'a' do
          view(:inline=>"bar", :layout=>{:inline=>'<%= content_for(:foo) %> <%= yield %>'})
        end
      end
    end
  end

  it "should be able to set content in template and get that content in the layout" do
    body.strip.should == "bar foo"
  end

  it "should work if content is not set by the template" do
    body('/a').strip.should == "bar"
  end
end
end

Version data entries

12 entries across 12 versions & 2 rubygems

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