Sha256: 9e8f825606f8ed27ffe9cc9b6068e0f1eecdc87fee69660b844a13ea8d27d99d

Contents?: true

Size: 991 Bytes

Versions: 4

Compression:

Stored size: 991 Bytes

Contents

require "test_helper"

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

    should "not render show" do
      get :show
      assert_response :unprocessable_entity
    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

4 entries across 4 versions & 1 rubygems

Version Path
typus-1.0.0.pre4 test/functional/admin/resources_controller_tableless_resource_test.rb
typus-1.0.0.pre3 test/functional/admin/resources_controller_tableless_resource_test.rb
typus-1.0.0.pre2 test/functional/admin/resources_controller_tableless_resource_test.rb
typus-1.0.0.pre test/functional/admin/resources_controller_tableless_resource_test.rb