Skip to content

Instantly share code, notes, and snippets.

@mingca
Created October 29, 2019 05:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mingca/93c57faa47cefcd60c12e8dd8496acaa to your computer and use it in GitHub Desktop.
#/spec/controllers/home_controller_spec.rb
require 'rails_helper'
describe HomeController do
shared_examples_for "home controller" do
it "should have a current_user" do
expect(subject.current_user).to_not eq(nil)
end
it "should get index" do
get 'index'
response.should redirect_to feed_path
end
end
describe "devise user" do
before do
login_devise_user
end
it_behaves_like "home controller"
end
describe "omniauth" do
before do
login_omniauth_user(provider)
end
describe "facebook user" do
let(:provider) { "facebook" }
it_behaves_like "home controller"
end
describe "linkedin user" do
let(:provider) { "linkedin" }
it_behaves_like "home controller"
end
describe "twitter user" do
let(:provider) { "twitter" }
it_behaves_like "home controller"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment