Skip to content

Commit

Permalink
Pare down unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Mar 16, 2009
1 parent 4a7b11d commit 70e3dfb
Showing 1 changed file with 6 additions and 36 deletions.
42 changes: 6 additions & 36 deletions actionpack/test/template/body_parts_test.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,57 +1,27 @@
require 'abstract_unit' require 'abstract_unit'
require 'action_view/body_parts/concurrent_block' require 'action_view/body_parts/concurrent_block'


class BodyPartTest < ActionController::TestCase class BodyPartsTest < ActionController::TestCase
module EdgeSideInclude RENDERINGS = [Object.new, Object.new, Object.new]
QUEUE_REDEMPTION_URL = 'http://render.farm/renderings/%s'
ESI_INCLUDE_TAG = '<esi:include src="%s" />'

def self.redemption_tag(receipt)
ESI_INCLUDE_TAG % QUEUE_REDEMPTION_URL % receipt
end

class BodyPart
def initialize(rendering)
@receipt = enqueue(rendering)
end

def to_s
EdgeSideInclude.redemption_tag(@receipt)
end

protected
# Pretend we sent this rendering off for processing.
def enqueue(rendering)
rendering.object_id.to_s
end
end
end


class TestController < ActionController::Base class TestController < ActionController::Base
RENDERINGS = [Object.new, Object.new, Object.new]

def index def index
RENDERINGS.each do |rendering| RENDERINGS.each do |rendering|
edge_side_include rendering response.template.punctuate_body! rendering
end end
@performed_render = true @performed_render = true
end end

def edge_side_include(rendering)
response.template.punctuate_body! EdgeSideInclude::BodyPart.new(rendering)
end
end end


tests TestController tests TestController


def test_queued_parts def test_body_parts
get :index get :index
expected = TestController::RENDERINGS.map { |rendering| EdgeSideInclude.redemption_tag(rendering.object_id) }.join assert_equal RENDERINGS, @response.body_parts
assert_equal expected, @response.body assert_equal RENDERINGS.join, @response.body
end end
end end



class ConcurrentBlockPartTest < ActionController::TestCase class ConcurrentBlockPartTest < ActionController::TestCase
class TestController < ActionController::Base class TestController < ActionController::Base
def index def index
Expand Down

0 comments on commit 70e3dfb

Please sign in to comment.