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