Created
April 4, 2014 22:37
-
-
Save chatman-media/9984431 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TestController < ApplicationController | |
| before_action :authenticate_user! | |
| def custom | |
| render text: 'response' | |
| end | |
| end | |
| describe TestController do | |
| describe "authenticate_user!" do | |
| context "when user not logged in" do | |
| before do | |
| subject.send(:current_user=, nil) | |
| routes.draw { get 'custom' => 'test#custom' } | |
| get 'custom' | |
| end | |
| it { should respond_with :unauthorized } | |
| it "returns nothing" do | |
| expect(response.body).to be_blank | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment