spec/markaby/tilt_spec.rb in markaby-0.6.10 vs spec/markaby/tilt_spec.rb in markaby-0.7.0
- old
+ new
@@ -1,8 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
-require 'markaby/tilt'
-require 'erb'
module Markaby
describe Tilt, "templates" do
before do
@block = lambda do |t|
@@ -34,19 +32,10 @@
it "should render from a string (given as data)" do
tilt = ::Tilt::MarkabyTemplate.new { "html do; end" }
tilt.render.should == "<html></html>"
end
- it "should evaluate a block in the scope given" do
- pending do
- scope = mock 'scope object', :foo => "bar"
-
- tilt = ::Tilt::MarkabyTemplate.new { li foo }
- tilt.render(scope).should == "<li>bar</li>"
- end
- end
-
it "should evaluate a template file in the scope given" do
scope = mock 'scope object', :foo => "bar"
tilt = ::Tilt::MarkabyTemplate.new("tilt/scope.mab", &@block)
tilt.render(scope).should == "<li>bar</li>"
@@ -56,17 +45,17 @@
tilt = ::Tilt::MarkabyTemplate.new("tilt/locals.mab", &@block)
tilt.render(Object.new, { :foo => "bar" }).should == "<li>bar</li>"
end
it "should yield to the block given" do
- pending do
- tilt = ::Tilt::MarkabyTemplate.new("tilt/yielding.mab", &@block)
- output = tilt.render(Object.new, {}) do
- text("Joe")
- end
+ tilt = ::Tilt::MarkabyTemplate.new("tilt/yielding.mab", &@block)
+ eval_scope = Markaby::Builder.new
- output.should == "Hey Joe"
+ output = tilt.render(Object.new, {}) do
+ text("Joe")
end
+
+ output.should == "Hey Joe"
end
it "should be able to render two templates in a row" do
tilt = ::Tilt::MarkabyTemplate.new("tilt/render_twice.mab", &@block)