Sha256: 29aab0396dc2af0cefdf290f911365a71a41954cb1550ae4103e3035d195aa9a
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' class FooController < ActionController::Base include Rafters::ComponentContext end class FooComponent include Rafters::Component setting :test end describe Rafters::ComponentContext do let(:controller) { FooController.new } let(:renderer) { double("ComponentRenderer", render: "<p>Output</p>") } before do Rafters::ComponentRenderer.stub(:new).and_return(renderer) end describe "#render_component" do it "renders the provided component" do renderer.should_receive(:render).with(instance_of(FooComponent), nil) controller.render_component(:foo) end context "with settings" do it "renders the provided component with the given settings" do FooComponent.should_receive(:new).with({ test: true }) controller.render_component(:foo, test: true) end end context "with a specified template name" do it "renders the provided component using the given template name" do renderer.should_receive(:render).with(instance_of(FooComponent), "template_name") controller.render_component(:foo, {}, "template_name") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rafters-0.0.4 | spec/rafters/component_context_spec.rb |
rafters-0.0.3 | spec/rafters/component_context_spec.rb |