Sha256: 511128c952528020076adac70374a83bc588a4635a63f0cb7b0fb0350d407006
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
require 'test/helper' # Test polimorphic relationships using the relate & unrelate actions. class Admin::AssetsControllerTest < ActionController::TestCase def setup typus_user = typus_users(:admin) @request.session[:typus_user_id] = typus_user.id end def test_should_test_polymorphic_relationship_message post_ = posts(:published) get :new, { :back_to => "/admin/posts/#{post_.id}/edit", :resource => post_.class.name, :resource_id => post_.id } assert_match "You're adding a new Asset to Post.", @response.body end def test_should_create_a_polymorphic_relationship post_ = posts(:published) assert_difference('post_.assets.count') do post :create, { :back_to => "/admin/posts/edit/#{post_.id}", :resource => post_.class.name, :resource_id => post_.id } end assert_response :redirect assert_redirected_to '/admin/posts/edit/1#assets' assert flash[:success] assert_equal "Asset successfully assigned to Post.", flash[:success] end def test_should_test_polymorphic_relationship_edit_message post_ = posts(:published) asset_ = assets(:first) get :edit, { :id => asset_.id, :back_to => "/admin/posts/#{post_.id}/edit", :resource => post_.class.name, :resource_id => post_.id } assert_match "You're updating a Asset for Post.", @response.body end def test_should_return_to_back_to_url options = Typus::Configuration.options.merge(:index_after_save => true) Typus::Configuration.stubs(:options).returns(options) post_ = posts(:published) asset_ = assets(:first) post :update, { :back_to => "/admin/posts/#{post_.id}/edit", :resource => post_.class.name, :resource_id => post_.id, :id => asset_.id } assert_response :redirect assert_redirected_to '/admin/posts/1/edit#assets' assert flash[:success] assert_equal "Asset successfully updated.", flash[:success] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
typus-0.9.29 | test/functional/admin/assets_controller_test.rb |
typus-0.9.28 | test/functional/admin/assets_controller_test.rb |