Sha256: 4bcbe8664bb8f4708da17f88fa10111a5743411226a40bdb8bd6becf8a23d7a2

Contents?: true

Size: 850 Bytes

Versions: 8

Compression:

Stored size: 850 Bytes

Contents

require 'test_helper'

module SysAdmin
  class SysAdmin::SysConfigController < ActionController::Base
    include StrongActions::Controller

    def show
      head :ok
    end

    def edit
      head :ok
    end

    def update
      head :ok
    end

    private

    def current_user
      unless @current_user
        @current_user = Object.new
        @current_user.instance_eval do
           def sys_admin?
             false
           end
        end
      end

      @current_user
    end

  end
end

class NamespaceTest < ActionController::TestCase
  tests SysAdmin::SysConfigController

  def test_allowed
    get :show
    assert_response :ok
  end

  def test_forbidden
    assert_raise StrongActions::ForbiddenAction do
      get :edit
    end
    assert_raise StrongActions::ForbiddenAction do
      patch :update
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
strong_actions-0.2.2 test/namespace_test.rb
strong_actions-0.2.1 test/namespace_test.rb
strong_actions-0.2.0 test/namespace_test.rb
strong_actions-0.1.1 test/namespace_test.rb
strong_actions-0.1.0 test/namespace_test.rb
strong_actions-0.0.9 test/namespace_test.rb
strong_actions-0.0.8 test/namespace_test.rb
strong_actions-0.0.7 test/namespace_test.rb