Sha256: c8de69bd98e03e24768b6ff167feab8f2dd3cee59ebb882653c0b0b33996b838
Contents?: true
Size: 968 Bytes
Versions: 10
Compression:
Stored size: 968 Bytes
Contents
require "test_helper" =begin What's being tested here? - Polymorphic associations. =end class Admin::BirdsControllerTest < ActionController::TestCase setup do @typus_user = Factory(:typus_user) @request.session[:typus_user_id] = @typus_user.id end context "relate" do setup do @bird = Factory(:bird) @image_holder = Factory(:image_holder) @request.env['HTTP_REFERER'] = "/admin/birds/edit/#{@bird.id}" end should "work" do assert_difference('@bird.image_holders.count') do post :relate, { :id => @bird.id, :related => { :model => 'ImageHolder', :id => @image_holder.id, :association_name => 'image_holders' } } end assert_response :redirect assert_redirected_to @request.env['HTTP_REFERER'] assert_equal "Bird successfully updated.", flash[:notice] end end end
Version data entries
10 entries across 10 versions & 1 rubygems