Sha256: 30d096b03a932abfb322a2d87f35fd934b2809eab6e650153df76ad0a1be64d7

Contents?: true

Size: 520 Bytes

Versions: 8

Compression:

Stored size: 520 Bytes

Contents

require 'spec_helper'

class ApisController < ActionController::Base
  include Clearance::Controller

  before_filter :authorize

  respond_to :js

  def show
    render text: 'response'
  end
end

describe ApisController do
  before do
    Rails.application.routes.draw do
      resource :api, only: [:show]
    end
  end

  after do
    Rails.application.reload_routes!
  end

  it 'responds with HTTP status code 401 when denied' do
    get :show, format: :js
    subject.should respond_with(:unauthorized)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
clearance-1.4.3 spec/controllers/apis_controller_spec.rb
clearance-1.4.2 spec/controllers/apis_controller_spec.rb
clearance-1.4.1 spec/controllers/apis_controller_spec.rb
clearance-1.4.0 spec/controllers/apis_controller_spec.rb
clearance-1.3.0 spec/controllers/apis_controller_spec.rb
clearance-1.2.1 spec/controllers/apis_controller_spec.rb
clearance-1.2.0 spec/controllers/apis_controller_spec.rb
clearance-1.1.0 spec/controllers/apis_controller_spec.rb