Sha256: 630b5f70584d832ec46f227d9ea6880d28e5bc160b9b6862b8e1ba8144d5e553

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

require "test_helper"

=begin

  What's being tested here?

    - HasManyThrough

=end

class Admin::ProjectsControllerTest < ActionController::TestCase

  setup do
    @typus_user = Factory(:typus_user)
    @request.session[:typus_user_id] = @typus_user.id

    @project = Factory(:project)
    @user = @project.user
  end

  should_eventually "be able to destroy items" do
    get :destroy, :id => @user.id, :method => :delete

    assert_response :redirect
    assert_equal "User successfully removed.", flash[:notice]
    assert_redirected_to :action => :index
  end

  context "relate colaborators to project" do

    setup do
      @request.env['HTTP_REFERER'] = "/admin/projects/edit/#{@project.id}"
    end

    should "work" do
      user = Factory(:user)

      assert_difference('@project.collaborators.count') do
        post :relate, { :id => @project.id,
                        :related => { :model => 'User', :id => user.id, :association_name => 'collaborators' } }
      end

      assert_response :redirect
      assert_redirected_to @request.env['HTTP_REFERER']
      assert_equal "Project successfully updated.", flash[:notice]
    end

    should_eventually "not allow to add collaborator twice"

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
typus-3.0.11 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.11.rc5 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.11.rc4 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.11.rc3 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.11.rc2 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.11.rc1 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.10 test/app/controllers/admin/projects_controller_test.rb
typus-3.0.9 test/app/controllers/admin/projects_controller_test.rb