Sha256: f33b18fb6db4af80925baaa8f34bd085be4fc12d016555161d5efc65672a94c3

Contents?: true

Size: 1000 Bytes

Versions: 10

Compression:

Stored size: 1000 Bytes

Contents

require "test_helper"

=begin

  What's being tested here?

    - Resource controller (which is not associated with a model).

=end

class Admin::StatusControllerTest < ActionController::TestCase

  context "Admin" do

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

    should "render index" do
      get :index
      assert_response :success
      assert_template 'index'
    end

  end

  context "Editor" do

    setup do
      @request.session[:typus_user_id] = Factory(:typus_user, :role => "editor").id
    end

    should "not render index" do
      get :index
      assert_response :unprocessable_entity
    end

  end

  context "Not logged user" do

    setup do
      @request.session[:typus_user_id] = nil
    end

    should "not render index and redirect to new_admin_session_path with back_to" do
      get :index
      assert_response :redirect
      assert_redirected_to new_admin_session_path(:back_to => '/admin/status')
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

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