Created
June 19, 2011 04:04
-
-
Save masterkain/1033747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
layout Proc.new { |controller| controller.request.xhr? ? 'ajax' : 'test' } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failures: | |
1) StoresController GET render_implicit_html_template_from_xhr_request with XHR should render the ajax layout | |
Failure/Error: response.should render_template("layouts/ajax") | |
Expected block to return true value. | |
# ./spec/controllers/stores_controller_spec.rb:29:in `block (3 levels) in <top (required)>' | |
Finished in 0.35621 seconds | |
3 examples, 1 failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StoresController < ApplicationController | |
# Layout inheritance is not working. | |
# Please see https://github.com/rails/rails/issues/1685 | |
# layout Proc.new { |controller| controller.request.xhr? ? 'ajax' : 'application' } | |
def render_implicit_html_template_from_xhr_request | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
describe StoresController do | |
include Devise::TestHelpers | |
render_views | |
before (:each) do | |
@user = Factory.create(:user) | |
sign_in @user | |
end | |
context "GET render_implicit_html_template_from_xhr_request with XHR" do | |
before(:each) do | |
xhr :get, :render_implicit_html_template_from_xhr_request | |
end | |
it {should respond_with :success } | |
it {should render_template(:render_implicit_html_template_from_xhr_request) } | |
it "should render the ajax layout" do | |
response.should render_template("layouts/ajax") # fails | |
# response.should render_template("layouts/test") # passes | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment