Sha256: 9c25b2a2c5b6470778b7fe60c76cbd08f94f45e34146eafffaf5c819087628af

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

Cell::Base.add_view_path "vendor/plugins/cells/test/cells"
Cell::Base.add_view_path "vendor/plugins/cells/test/cells/layouts"

module CellsTestMethods
  
  def assert_selekt(content, *args)
    assert_select(HTML::Document.new(content).root, *args)
  end

  def setup
    @controller = CellTestController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @controller.request = @request
    @controller.response = @response
    @controller.params = {}
  end
  
  def self.views_path
    File.dirname(__FILE__) + '/views/'
  end
end



class CellTestController < ApplicationController
  def rescue_action(e) raise e end

  def render_cell_state
    cell  = params[:cell]
    state = params[:state]

    render :text => render_cell_to_string(cell, state)
  end

  def call_render_cell_with_strings
    static = render_cell_to_string("my_test", "direct_output")
    render :text => static
  end

  def call_render_cell_with_syms
    static = render_cell_to_string(:my_test, :direct_output)
    render :text => static
  end

  def call_render_cell_with_state_view
    render :text => render_cell_to_string(:my_test, :view_with_instance_var)
    return
  end

  def render_view_with_render_cell_invocation
    render :file => "#{RAILS_ROOT}/vendor/plugins/cells/test/views/view_with_render_cell_invocation.html.erb"
    return
  end

  def render_just_one_view_cell
    static = render_cell_to_string("just_one_view", "some_state")
    render :text => static
  end
  
  
  def render_state_with_link_to
    static = render_cell_to_string("my_test", "state_with_link_to")
    render :text => static
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cells-2.3.0 test/testing_helper.rb