Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use context instead of describe #35

Open
thedrow opened this issue Mar 10, 2016 · 1 comment
Open

Use context instead of describe #35

thedrow opened this issue Mar 10, 2016 · 1 comment

Comments

@thedrow
Copy link

thedrow commented Mar 10, 2016

It's better to use context in this case since we're already describing a class or a method.

@ryym
Copy link

ryym commented Oct 1, 2021

I just run into the same problem. Using describe internally makes impossible to use described_class inside with_them. This is inconvenience.

class Foo; end

RSpec.describe Foo do
  where do
    {
      case1: {},
    }
  end

  with_them do
    it 'overrides described value' do
      described_class.new
      #=>
      # NoMethodError:
      #   undefined method `new' for :case1:Symbol
      #   Did you mean?  next
    end
  end
end

As a workaround, we need to use string keys to prevent RSpec from replacing the described_class value.

  where do
    {
      "case1" => {},
    }
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants