Sha256: c691ebf2df8d067617b5d5ddf5b1ba13e7562a3ae6876c057d83c7c4a948f640

Contents?: true

Size: 1.26 KB

Versions: 91

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

class RenderWithLayoutMatcherTest < ActionController::TestCase # :nodoc:

  context "a controller that renders with a layout" do
    setup do
      create_view('layouts/wide.html.erb', 'some content, <%= yield %>')
      @controller = build_response { render :layout => 'wide' }
    end

    should "accept rendering with any layout" do
      assert_accepts render_with_layout, @controller
    end

    should "accept rendering with that layout" do
      assert_accepts render_with_layout(:wide), @controller
    end

    should "reject rendering with another layout" do
      assert_rejects render_with_layout(:other), @controller
    end
  end

  context "a controller that renders without a layout" do
    setup do
      @controller = build_response { render :layout => false }
    end

    should "reject rendering with a layout" do
      assert_rejects render_with_layout, @controller
    end
  end

  context "given a context with layouts" do
    setup do
      @layout = 'happy'
      @controller = build_response { render :layout => false }
      @layouts = Hash.new(0)
      @layouts[@layout] = 1
    end

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

end

Version data entries

91 entries across 61 versions & 10 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
challah-0.6.2 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
challah-0.6.1 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb
challah-0.6.0 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/render_with_layout_matcher_test.rb