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
elkinsware-erubis_rails_helper-0.6.0 test/controller/capture_test.rb
elkinsware-erubis_rails_helper-0.6.1 test/controller/capture_test.rb
elkinsware-erubis_rails_helper-0.9.0 test/controller/capture_test.rb
elkinsware-erubis_rails_helper-0.9.1 test/controller/capture_test.rb
elkinsware-erubis_rails_helper-0.9.5 test/controller/capture_test.rb
ghazel-erubis_rails_helper-0.9.5 test/controller/capture_test.rb
actionpack_csi-2.3.5.p8 test/controller/capture_test.rb
actionpack_csi-2.3.5.p7 test/controller/capture_test.rb
actionpack_csi-2.3.5.p6 test/controller/capture_test.rb
mitio-erubis_rails_helper-1.0.1 test/controller/capture_test.rb
webroar-0.5.0 src/admin_panel/vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.2.4 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.2.2 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.2.1 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.2 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.1.9 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.1.8 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.1.7 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.1.6 vendor/rails/actionpack/test/controller/capture_test.rb
radiantcms-couchrest_model-0.1.5 vendor/rails/actionpack/test/controller/capture_test.rb