Sha256: bfa6ec6fe88a590455a86d475999d8238a55efdbdd053e38c833ee40506b1a3a
Contents?: true
Size: 897 Bytes
Versions: 6
Compression:
Stored size: 897 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, :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.must_equal "bar foo" end it "should work if content is not set by the template" do body('/a').strip.must_equal "bar" end end end
Version data entries
6 entries across 6 versions & 1 rubygems