Sha256: c5482d9056e3711ee3da5e4aba19cf14e407fcee22a6ef279732d33c894dbea6

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

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

describe "nested builders", :type => :controller do
  setup = lambda {
    class ShipsController < ActionController::Base
      expose_many(:ships, :nested => [:pirates])
    end
    
    ActionController::Routing::Routes.draw do |map| 
      map.resources :pirates do |pirate|
        pirate.resources :ships
      end
    end
  }
  
  setup.call
  controller_name :ships
  Object.remove_class(ShipsController)

  before(:each) do
    setup.call
    @controller = ShipsController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    
    @pirate = Factory.create(:pirate_with_ships)
    Pirate.stub(:find => @pirate)
    
    get(:new, {:pirate_id => 1, :ship => nil})
  end
  
  after(:each) do
    Object.remove_class(ShipsController)
  end
  
  it { should assign_to(:ship) }
  it { should assign_to(:resource) }
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exposure-0.1.0 spec/builders/nested_builder_spec.rb