Skip to content

Instantly share code, notes, and snippets.

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