Sha256: e663ce977c13f3db697bcb8992c5bdab96c7f04ef8f17e3ef56fd60f8381298f

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + '/responding_behavior'
require File.dirname(__FILE__) + '/../spec_helper'

describe "responders", :type => :controller do
  setup = lambda {
    class PiratesController < ActionController::Base
      expose_many(:pirates)

      private
        def example
          redirect_to({:action => "test"})
        end 
    end
  }
  setup.call
  
  def setup_responder(action, success = nil)
    PiratesController.response_for action, :is => :example, :on => success
  end
  
  ActionController::Routing::Routes.draw do |map| 
    map.resources :pirates, :collection => {:test => :any}
  end
  
  controller_name :pirates
  Object.remove_class(PiratesController)
  
  before(:each) do
    setup.call
    @controller = PiratesController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    
    @pirate = Factory.stub(:pirate)
    Pirate.stub(:new => @pirate)
  end
  
  after(:each) do
    Object.remove_class(PiratesController)
  end
  
  it_should_behave_like "a responder"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exposure-0.2.1 spec/responders/respond_with_method_spec.rb
exposure-0.2.0 spec/responders/respond_with_method_spec.rb
exposure-0.1.3 spec/responders/respond_with_method_spec.rb
exposure-0.1.2 spec/responders/respond_with_method_spec.rb