Sha256: b2c37cee04f10f451b4ccd93a7a6c799989aacddb2bfab03c437cb377245b060

Contents?: true

Size: 1.23 KB

Versions: 26

Compression:

Stored size: 1.23 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'
require 'cms/photos_controller'

# Re-raise errors caught by the controller.
class Cms::PhotosController; def rescue_action(e) raise e end; end

class Cms::PhotosControllerTest < ActionController::TestCase
  def setup
    @controller = Cms::PhotosController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @photo      = Photo.find 1
  end
  
  context "with personnel as parent" do
    context "on get to :index" do
      setup do
        get :index, :personnel_id => 1
      end

      should_respond_with :success
      should_render_template "index"
      should_assign_to :photos
      should_assign_to :personnel
      should "scope photos to personnel" do
        assert assigns(:photos).all? { |photo| photo.personnel.id == 1 }
      end
    end
    
    context "on post to :create" do
      setup do
        post :create, :personnel_id => 1, :photo => {}
      end

      should_redirect_to 'cms_personnel_photo_path(@photo.personnel, @photo)'
      should_assign_to :photo
      should_assign_to :personnel
      should "scope photo to personel" do
        assert personnel(:one), assigns(:photo).personnel
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 12 rubygems

Version Path
csmosx-resource_controller-0.6.6 test/test/functional/cms/photos_controller_test.rb
csmosx-resource_controller-0.6.7 test/test/functional/cms/photos_controller_test.rb
dkubb-resource_controller-0.6.5 test/test/functional/cms/photos_controller_test.rb
giraffesoft-resource_controller-0.5.5 test/test/functional/cms/photos_controller_test.rb
giraffesoft-resource_controller-0.5.6 test/test/functional/cms/photos_controller_test.rb
giraffesoft-resource_controller-0.6.0 test/test/functional/cms/photos_controller_test.rb
giraffesoft-resource_controller-0.6.1 test/test/functional/cms/photos_controller_test.rb
giraffesoft-resource_controller-0.6.5 test/test/functional/cms/photos_controller_test.rb
jeffrafter-resource_controller-0.5.5 test/test/functional/cms/photos_controller_test.rb
maser-resource_controller-0.6.6 test/test/functional/cms/photos_controller_test.rb
radar-resource_controller-0.6.6 test/test/functional/cms/photos_controller_test.rb
strikeroff-resource_controller-0.6.6 test/test/functional/cms/photos_controller_test.rb
viva-resource_controller-0.6.5.1 test/test/functional/cms/photos_controller_test.rb
viva-resource_controller-0.6.5.2 test/test/functional/cms/photos_controller_test.rb
viva-resource_controller-0.6.5 test/test/functional/cms/photos_controller_test.rb
matid-resource_controller-0.7.2 test/test/functional/cms/photos_controller_test.rb
matid-resource_controller-0.7.1 test/test/functional/cms/photos_controller_test.rb
matid-resource_controller-0.7.0 test/test/functional/cms/photos_controller_test.rb
resource_controller_views-0.6.6.views2 test/test/functional/cms/photos_controller_test.rb
matid-resource_controller-0.6.7 test/test/functional/cms/photos_controller_test.rb