Sha256: beb9b2ab31f9353166535607a8fef5d1b7eab24a4b877795d87845107d1cd3a3
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
require "template-switcher" require "spec_helper" describe PostsController do render_views describe "#render_switcher" do context "given template_selector is nil" do before do mod = Module.new do def template_selector nil end end PostsController.send :include, mod end it do get :index response.should render_template("posts/index") response.body.should_not =~ /switch/ end end context "given template_selector is :select_key" do before do mod = Module.new do def template_selector :select_key end end PostsController.send :include, mod end it do get :index response.should render_template("posts/index") response.body.should =~ /switch/ end end context "given template_selector is undefined key" do before do mod = Module.new do def template_selector :undefined_key end end PostsController.send :include, mod end it do get :index response.should render_template("posts/index") response.body.should_not =~ /switch/ end end end describe TemplateSwitcher::AutoRenderSwitcher do before do PostsController.send :include, TemplateSwitcher::AutoRenderSwitcher end context "given template_selector is :select_key" do before do mod = Module.new do def template_selector :select_key end end PostsController.send :include, mod end it do get :new response.should render_template("posts/new") response.body.should =~ /switch/ end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
template-switcher-0.0.2 | spec/controllers/render_switcher_spec.rb |
template-switcher-0.0.1 | spec/controllers/render_switcher_spec.rb |