Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:51:20+00:00 2026-05-24T02:51:20+00:00

This took me by surprise… Seems that you can’t use the same name for

  • 0

This took me by surprise…

Seems that you can’t use the same name for 2 rspec shared example groups anywhere within your project. If you do, then when you run rake spec (to run all the specs), then rspec complains that a shared example group was declared with a non-unique name.

This happens even when the calls to shared_examples_for are contained within a describe block (one would presume that should scope the examples).

At first I tried to work around this by changing the names of the example groups (not ideal, but I can live with it).

But this became more of a problem when I wanted to factor out the example group to a separate file so I could share it between multiple spec files.

The specs work okay when run in isolation, but when I run the suite, rspec complains.

`ensure_shared_example_group_name_not_taken': \
Shared example group 'a person' already exists (ArgumentError)

Surely this is a common problem.

Is there something I’m missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:51:21+00:00Added an answer on May 24, 2026 at 2:51 am

    As of rspec 2.6, shared examples are global. You can declare them in an example group, but they are not scoped to that group.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I took some code from this Microsoft provided Example which allows me to
I have a query that reads like this: $fields = Doctrine_Core::getTable('model_1')->findByColumnId($id); took a var_dump
I'm testing MongoDB and here is a bit of example that took me by
I want to display a This page took x seconds widget at the bottom
I’m posting this because it took me ages to fix and I could find
I took a look at this answer and it goes in part to solving
Ok i have this piece of code from which i took from W3schools :-
I know this question has been asked before, and I took a look at
A friend asked me yesterday if this was possible on the iPhone. I took
Okay, it took me a little while to narrow down this problem, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.