Sha256: c8854850897f27612f9572e81568291a05bc6c1ba51e05733e1dd3333d2eea8a

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

require "test_helper"

=begin

  What's being tested here?

    - HasManyThrough

=end

class Admin::ProjectsControllerTest < ActionController::TestCase

  setup do
    admin_sign_in
    @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

7 entries across 7 versions & 1 rubygems

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