Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Created August 23, 2016 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staycreativedesign/ca58f37fe3448adb90e7a7bd62935dba to your computer and use it in GitHub Desktop.
Save staycreativedesign/ca58f37fe3448adb90e7a7bd62935dba to your computer and use it in GitHub Desktop.
mindblown@ ~/expect3/Projects/lawyer_template (master) $ zeus test spec/controllers/sessions_controller_spec.rb
.*.**
Pending: (Failures listed here are expected and do not affect your suite's status)
1) SessionsController GET new redirects to admin panel if user is authenticated
# Temporarily skipped with xit
# ./spec/controllers/sessions_controller_spec.rb:10
2) SessionsController GET new POST create with valid credentials it redirects to admin panel
# Temporarily skipped with xit
# ./spec/controllers/sessions_controller_spec.rb:22
3) SessionsController GET new POST create with valid credentials it sets the flash message
# Temporarily skipped with xit
# ./spec/controllers/sessions_controller_spec.rb:23
Finished in 0.15954 seconds (files took 158 minutes 37 seconds to load)
5 examples, 0 failures, 3 pending
class SessionsController < ApplicationController
def new
end
def create
end
end
require 'rails_helper'
describe SessionsController do
describe "GET new" do
it "renders the new template for unauthenticated users" do
get :new
expect(response).to render_template(:new)
end
xit "redirects to admin panel if user is authenticated"
describe "POST create" do
context "with valid credentials" do
it "creates a valid session" do
ben = build(:user, access_level: "admin")
post :create, params: {user: ben}
expect(session[:user_id]).to eq(ben.id)
end
xit "it redirects to admin panel"
xit "it sets the flash message"
end
context "with invalid credentials"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment