Sha256: ca7696ce282ffec19efea6f2466612de6d9aaf611efe98c46cb048bc535ef430

Contents?: true

Size: 1.51 KB

Versions: 8

Compression:

Stored size: 1.51 KB

Contents

require 'test_helper'

class MetroAreasControllerTest < ActionController::TestCase
  fixtures :metro_areas, :users, :countries, :roles

  def test_should_get_index
    login_as :admin
    get :index
    assert_response :success
    assert assigns(:metro_areas)
  end

  def test_should_get_new
    login_as :admin
    get :new
    assert_response :success
  end
  
  def test_should_create_metro_area
    login_as :admin
    assert_difference MetroArea, :count, 1 do
      post :create, :metro_area => {:country_id => countries(:germany), :name => "Dusseldorf" } 
    end
    
    assert_redirected_to metro_area_path(assigns(:metro_area))
  end

  def test_should_not_create_metro_area_without_country
    login_as :admin
    assert_no_difference MetroArea, :count do
      post :create, :metro_area => {:name => "Dusseldorf" } 
      assert assigns(:metro_area).errors[:country_id]
      assert_response :success
    end
  end

  def test_should_show_metro_area
    login_as :admin
    get :show, :id => 1
    assert_response :success
  end

  def test_should_get_edit
    login_as :admin
    get :edit, :id => 1
    assert_response :success
  end
  
  def test_should_update_metro_area
    login_as :admin
    put :update, :id => 1, :metro_area => { }
    assert_redirected_to metro_area_path(assigns(:metro_area))
  end
  
  def test_should_destroy_metro_area
    login_as :admin
    old_count = MetroArea.count
    delete :destroy, :id => 1
    assert_equal old_count-1, MetroArea.count
    
    assert_redirected_to metro_areas_path
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
community_engine-2.3.2 test/functional/metro_areas_controller_test.rb
community_engine-2.3.1 test/functional/metro_areas_controller_test.rb
community_engine-2.3.0 test/functional/metro_areas_controller_test.rb
community_engine-2.1.0 test/functional/metro_areas_controller_test.rb
community_engine-2.0.0 test/functional/metro_areas_controller_test.rb
community_engine-2.0.0.beta3 test/functional/metro_areas_controller_test.rb
community_engine-2.0.0.beta2 test/functional/metro_areas_controller_test.rb
community_engine-2.0.0.beta1 test/functional/metro_areas_controller_test.rb