Sha256: 3c5657fa384d62ee6f172b8ef05eb0b8fe9c1fe225669a37f2c2cdb5bcf47ad6

Contents?: true

Size: 506 Bytes

Versions: 2

Compression:

Stored size: 506 Bytes

Contents

require 'spec_helper'

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

  before_filter :authorize

  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.6.1 spec/controllers/apis_controller_spec.rb
clearance-1.6.0 spec/controllers/apis_controller_spec.rb