Sha256: d213b6166037c707f1d33a017ee75b7d1c2eda56fe24b84fe3937036b86302fa

Contents?: true

Size: 659 Bytes

Versions: 10

Compression:

Stored size: 659 Bytes

Contents

require 'test_helper'

class WelcomeController < ActionController::Base
  include StrongActions::Controller

  def index
    head :ok
  end
  
  def destroy
    head :ok
  end

  private

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

class ControllerTest < ActionController::TestCase
  tests WelcomeController

  def test_allowed
    get :index
    assert_response :ok
  end

  def test_forbidden
    assert_raise StrongActions::ForbiddenAction do
      delete :destroy
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

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