Sha256: b639c413693a1f4dc5ff302efee619fe48994210d42005f1b15847557690b4dc

Contents?: true

Size: 1.56 KB

Versions: 49

Compression:

Stored size: 1.56 KB

Contents

require 'abstract_unit'

class CaptureController < ActionController::Base
  def self.controller_name; "test"; end
  def self.controller_path; "test"; end

  def content_for
    render :layout => "talk_from_action"
  end

  def content_for_with_parameter
    render :layout => "talk_from_action"
  end

  def content_for_concatenated
    render :layout => "talk_from_action"
  end

  def non_erb_block_content_for
    render :layout => "talk_from_action"
  end

  def rescue_action(e) raise end
end

class CaptureTest < ActionController::TestCase
  tests CaptureController

  def setup
    # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
    # a more accurate simulation of what happens in "real life".
    @controller.logger = Logger.new(nil)

    @request.host = "www.nextangle.com"
  end

  def test_simple_capture
    get :capturing
    assert_equal "Dreamy days", @response.body.strip
  end

  def test_content_for
    get :content_for
    assert_equal expected_content_for_output, @response.body
  end

  def test_should_concatentate_content_for
    get :content_for_concatenated
    assert_equal expected_content_for_output, @response.body
  end

  def test_should_set_content_for_with_parameter
    get :content_for_with_parameter
    assert_equal expected_content_for_output, @response.body
  end

  def test_non_erb_block_content_for
    get :non_erb_block_content_for
    assert_equal expected_content_for_output, @response.body
  end

  private
    def expected_content_for_output
      "<title>Putting stuff in the title!</title>\n\nGreat stuff!"
    end
end

Version data entries

49 entries across 48 versions & 13 rubygems

Version Path
webroar-0.4.0 src/admin_panel/vendor/rails/actionpack/test/controller/capture_test.rb
erubis_rails_helper-1.0.0 test/controller/capture_test.rb
actionpack-2.3.7 test/controller/capture_test.rb
actionpack-2.3.6 test/controller/capture_test.rb
radiant-0.8.2 vendor/rails/actionpack/test/controller/capture_test.rb
radiant-0.9.0.rc2 vendor/rails/actionpack/test/controller/capture_test.rb
webroar-0.3.1 src/admin_panel/vendor/rails/actionpack/test/controller/capture_test.rb
webroar-0.3.0 src/admin_panel/vendor/rails/actionpack/test/controller/capture_test.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/actionpack/test/controller/capture_test.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/actionpack/pkg/actionpack-2.3.3/test/controller/capture_test.rb
ghazel-erubis_rails_helper-0.9.5.1 test/controller/capture_test.rb
ginst-2009.12.8 vendor/rails/actionpack/test/controller/capture_test.rb
actionpack-2.3.5 test/controller/capture_test.rb
ginst-2009.11.24 vendor/rails/actionpack/test/controller/capture_test.rb
ginst-2009.11.23 vendor/rails/actionpack/test/controller/capture_test.rb
ginst-2.0.1 vendor/rails/actionpack/test/controller/capture_test.rb
ginst-2.0.0 vendor/rails/actionpack/test/controller/capture_test.rb
gemstreamer-1.2.0 spec/assets/testapp/vendor/rails/actionpack/test/controller/capture_test.rb
gemstreamer-1.1.1 spec/assets/testapp/vendor/rails/actionpack/test/controller/capture_test.rb
gemstreamer-1.1.0 spec/assets/testapp/vendor/rails/actionpack/test/controller/capture_test.rb