Sha256: d4afc00fb22ef34c53b69d5402ada373092d066e163866498bdbb70d1a8aaef6

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

class AdsControllerTest < ActionController::TestCase
  fixtures :ads, :users, :categories, :roles

  def setup
    login_as :admin
  end

  def test_should_get_index
    get :index
    assert_response :success
    assert assigns(:ads)
  end

  def test_should_get_new
    get :new
    assert_response :success
  end
  
  def test_should_create_ad
    old_count = Ad.count
    post :create, :ad => { :html => 'Our company is great!', :frequency => 1, :audience => 'all'}
    assert_equal old_count+1, Ad.count
    
    assert_redirected_to ad_path(assigns(:ad))
  end

  def test_should_show_ad
    get :show, :id => 1
    assert_response :success
  end

  def test_should_get_edit
    get :edit, :id => 1
    assert_response :success
  end
  
  def test_should_update_ad
    put :update, :id => 1, :ad => { }
    assert_redirected_to ad_path(assigns(:ad))
  end
  
  def test_should_destroy_ad
    old_count = Ad.count
    delete :destroy, :id => 1
    assert_equal old_count-1, Ad.count
    
    assert_redirected_to ads_path
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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