Skip to content

Instantly share code, notes, and snippets.

@domagude
Last active November 8, 2017 18:23
Show Gist options
  • Save domagude/3a94fa6ab807dd6801ccb2738900e499 to your computer and use it in GitHub Desktop.
Save domagude/3a94fa6ab807dd6801ccb2738900e499 to your computer and use it in GitHub Desktop.
require 'rails_helper'
include Warden::Test::Helpers
RSpec.describe "show", :type => :request do
shared_examples 'render_show_template' do
let(:post) { create(:post) }
it 'renders a show template' do
get post_path(post)
expect(response).to render_template(:show)
end
end
context 'non-signed in user' do
it_behaves_like 'render_show_template'
end
context 'signed in user' do
let(:user) { create(:user) }
before(:each) { login_as user }
it_behaves_like 'render_show_template'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment