summaryrefslogtreecommitdiff
path: root/spec/controllers/application_controller_spec.rb
blob: b8430f8fd977ae13d56b6bfc51ba892f489a5615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require "rails_helper"

describe ApplicationController, type: :controller do
  controller do
    def index
      render body: "WHAT?"
    end
  end

  context "when not logged in" do
    it "redirects you to the login page" do
      get :index
      expect(response).to redirect_to(new_session_path)
    end
  end

  context "when logged in" do
    let(:user) { create(:user) }

    it "allows the action to do it's thing" do
      http_login(user)
      get :index
      expect(response.body).to eql("WHAT?")
    end
  end
end