Tag Archives: shared_context

How to parameterize an RSpec shared context

I had a RSpec shared_context which was creating a FactoryGirl user mock and then logging in with it, and then running some shared examples for testing permissions on a generic user. I needed to modify it to accept a parameter of using a different user. It originally looked like this: RSpec.shared_context “auth” do let(:current_user) { […]