Sha256: c298ca2c3e4f3e947d959a15a77ecf6f605a1a80a4352074f82e722157980f4d

Contents?: true

Size: 827 Bytes

Versions: 7

Compression:

Stored size: 827 Bytes

Contents

require "test_helper"

=begin

  What's being tested here?

    - Polymorphic associations.

=end

class Admin::BirdsControllerTest < ActionController::TestCase

  setup do
    admin_sign_in
    @bird = Factory(:bird)
    @image_holder = Factory(:image_holder)
    @request.env['HTTP_REFERER'] = "/admin/birds/edit/#{@bird.id}"
  end

  test "relate polymorphic associations" 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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
typus-3.1.0.rc7 test/app/controllers/admin/resources/birds_controller_test.rb.old
typus-3.1.0.rc6 test/app/controllers/admin/birds_controller_test.rb
typus-3.1.0.rc5 test/app/controllers/admin/birds_controller_test.rb
typus-3.1.0.rc4 test/app/controllers/admin/birds_controller_test.rb
typus-3.1.0.rc3 test/app/controllers/admin/birds_controller_test.rb
typus-3.1.0.rc2 test/app/controllers/admin/birds_controller_test.rb
typus-3.1.0.rc1 test/app/controllers/admin/birds_controller_test.rb