Sha256: 85b43b7e953c3a54ec07f8adfbbfa3ec3c83b2cb0a01459f288824cc7f9dc315

Contents?: true

Size: 1.28 KB

Versions: 11

Compression:

Stored size: 1.28 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 "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

11 entries across 9 versions & 3 rubygems

Version Path
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.8.0.pre vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.7.1 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.7.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.7.0.pre2 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
challah-0.7.0.pre vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
shoulda-matchers-1.2.0 spec/shoulda/action_controller/render_with_layout_matcher_spec.rb
shoulda-matchers-1.1.0 spec/shoulda/action_controller/render_with_layout_matcher_spec.rb