Sha256: 68150965df263b7aa2b59194aec7b2787ed26e7741871684ab83ef3a3767ebe0

Contents?: true

Size: 1.76 KB

Versions: 8

Compression:

Stored size: 1.76 KB

Contents

require 'test_helper'

class HomepageFeaturesControllerTest < ActionController::TestCase
  fixtures :all

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

  def test_should_get_new
    login_as :admin
    get :new
    assert_response :success
  end
  
  def test_should_create_homepage_feature
    login_as :admin
    assert_difference HomepageFeature, :count, 1 do
      post :create, :homepage_feature => {:title => 'feature', :url => 'example.com', :image => fixture_file_upload('/files/library.jpg', 'image/jpg') } 
    end
    assert_redirected_to homepage_feature_path(assigns(:homepage_feature))
  end

  def test_should_fail_to_create_homepage_feature
    login_as :admin
    assert_no_difference HomepageFeature, :count do
      post :create, :homepage_feature => { } 
    end
    assert_response :success
  end


  def test_should_show_homepage_feature
    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_homepage_feature
    login_as :admin
    put :update, :id => 1, :homepage_feature => {:url => 'changed_url.com' }
    assert_redirected_to homepage_feature_path(assigns(:homepage_feature))
  end

  def test_should_fail_to_update_homepage_feature
    login_as :admin
    put :update, :id => 1, :homepage_feature => { :url => nil }
    assert assigns(:homepage_feature).errors[:url]
    assert_response :success
  end

  
  def test_should_destroy_homepage_feature
    login_as :admin
    assert_difference HomepageFeature, :count, -1 do
      delete :destroy, :id => 1
    end
    assert_redirected_to homepage_features_path
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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