Sha256: 0d6b2d7a0e444fa868ee71268a036a56ef438f1a3aff539bef9ae70e3ab5ca0d

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 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
    expect(subject).to respond_with(:unauthorized)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clearance-1.5.1 spec/controllers/apis_controller_spec.rb
clearance-1.5.0 spec/controllers/apis_controller_spec.rb