Sha256: 040edb2a61e12be34f8b407f972044ba639761e70e4ff339adac18cfe0c880c0

Contents?: true

Size: 1.51 KB

Versions: 17

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe Shoulda::Matchers::ActionController::RenderWithLayoutMatcher do
  include ActionController::TemplateAssertions

  context "a controller that renders with a layout" do
    let(:controller) { build_response { render :layout => 'wide' } }

    before do
      create_view('layouts/wide.html.erb', 'some content, <%= yield %>')
    end

    it "should accept rendering with any layout" do
      controller.should render_with_layout
    end

    it "should accept rendering with that layout" do
      controller.should render_with_layout(:wide)
    end

    it "should reject rendering with another layout" do
      controller.should_not render_with_layout(:other)
    end
  end

  context "a controller that renders without a layout" do
    let(:controller) { build_response { render :layout => false } }

    it "should reject rendering with a layout" do
      controller.should_not render_with_layout
    end
  end

  context "a controller that renders a partial" do
    let(:controller) { build_response { render :partial => 'partial' } }

    it "should reject rendering with a layout" do
      controller.should_not render_with_layout
    end
  end

  context "given a context with layouts" do
    let(:layout) { 'happy' }
    let(:controller) { build_response { render :layout => false } }

    before do
      @layouts = Hash.new(0)
      @layouts[layout] = 1
    end

    it "should accept that layout in that context" do
      controller.should render_with_layout(layout).in_context(self)
    end
  end
end

Version data entries

17 entries across 13 versions & 4 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
devise_sociable-0.1.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.9.1.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.9.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
shoulda-matchers-1.4.2 spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
shoulda-matchers-1.4.1 spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
shoulda-matchers-1.4.0 spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.8.1 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
shoulda-matchers-1.3.0 spec/shoulda/action_controller/render_with_layout_matcher_spec.rb