Sha256: 33b49ed60622d464f0e3c2b94e39f704de278be255bf8e17b8deea3fe71f290e
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
# encoding: utf-8 require_relative "../../spec_helper" require "rango/mixins/render" Rango::Template.template_paths.clear.push(File.join(STUBS_ROOT, "templates")) describe Rango::RenderMixin do it "should work standalone" do Rango::RenderMixin.should respond_to(:render) end it "should work as a mixin" do controller = Class.new { include Rango::RenderMixin } controller.new.should respond_to(:render) end describe "#render" do include Rango::RenderMixin it "should take a path as the first argument" do body = render "test.html" body.should be_kind_of(String) end it "should take a scope as the second argument" do context = Object.new body = render "context_id.html", context context_id = body.chomp.to_i context_id.should eql(context.object_id) end it "should take context as the third argument" do context = Object.new body = render "index.html", context, title: "Hi!" body.should match(/Hi\!/) end it "should take the second arguments as a context if it's a hash and there is no third argument" do body = render "index.html", title: "Hi!" body.should match(/Hi\!/) end it "should raise TemplateNotFound if template wasn't found" do -> { render "idonotexist.html" }.should raise_error(Rango::Exceptions::TemplateNotFound) end end end
Version data entries
5 entries across 5 versions & 1 rubygems