Sha256: 1c7aef55f9ccbc2722205460b192f23c720eada125177dcb78cae0b8dedc337a

Contents?: true

Size: 2 KB

Versions: 24

Compression:

Stored size: 2 KB

Contents

require 'simple_rc'

class RenderingContextSystemSpecController < ApplicationController
  def uses_specified_context_in_view
    @the_rendering_context_class = SimpleRc
    @the_rendering_context_options = { :the_value => 12345 }
  end

  def uses_specified_context_in_partials
    @the_rendering_context_class = SimpleRc
    @the_rendering_context_options = { :the_value => 23456 }
  end

  def uses_specified_context_through_nesting
    @the_rendering_context_class = SimpleRc
    @the_rendering_context_options = { :the_value => 34567 }
  end

  def uses_specified_context_in_render_widget
    @the_rendering_context_class = SimpleRc
    @the_rendering_context_options = { :the_value => 45678 }

    render :widget => Views::RenderingContextSystemSpec::RenderWidget.new
  end

  def uses_specified_context_in_render_inline
    @the_rendering_context_class = SimpleRc
    @the_rendering_context_options = { :the_value => 56789 }

    render :type => :fortitude, :inline => (lambda do
      p "context is: #{rendering_context.class.name}, value #{rendering_context.the_value}"
    end)
  end

  def uses_direct_context_in_view
    $invoke_count = 0
    class << self
      def create_fortitude_rendering_context(options)
        out = SimpleRc.new(options.merge(:the_value => 67890 + $invoke_count))
        $invoke_count += 1
        out
      end
    end
  end

  def uses_direct_context_for_all_widgets
    $invoke_count = 0
    class << self
      def create_fortitude_rendering_context(options)
        out = SimpleRc.new(options.merge(:the_value => 67890 + $invoke_count))
        $invoke_count += 1
        out
      end
    end
  end

  def create_fortitude_rendering_context(options)
    if @the_rendering_context_class
      @the_rendering_context_class.new((@the_rendering_context_options || { }).merge(options))
    else
      super(options)
    end
  end

  def start_end_widget_basic
    @the_rendering_context_class = SimpleRc
  end

  def start_end_widget_through_partials
    @the_rendering_context_class = SimpleRc
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fortitude-0.9.6-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.6 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.5-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.5 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.4-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.4 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.3-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.3 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.2-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.2 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.1-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.1 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.0-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.9.0 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.0.10-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.0.10 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.0.9-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.0.9 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.0.7-java spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb
fortitude-0.0.7 spec/rails/templates/rendering_context_system_spec/app/controllers/rendering_context_system_spec_controller.rb