Skip to content

Instantly share code, notes, and snippets.

@domagude
Created November 8, 2017 18:01
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 domagude/f555b51db786b8666d496ca08437eaa2 to your computer and use it in GitHub Desktop.
Save domagude/f555b51db786b8666d496ca08437eaa2 to your computer and use it in GitHub Desktop.
require 'rails_helper'
include Warden::Test::Helpers
RSpec.describe "new", :type => :request do
context 'non-signed in user' do
it 'redirects to a root path' do
get '/posts/new'
expect(response).to redirect_to(root_path)
end
end
context 'signed in user' do
let(:user) { create(:user) }
before(:each) { login_as user }
it 'renders a new template' do
get '/posts/new'
expect(response).to render_template(:new)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment