Shared Examples #13

Open
andreareginato opened this Issue Oct 3, 2012 · 4 comments

Projects

None yet

5 participants

@andreareginato
Collaborator

Write your thoughts about the "shared examples" best practice.

@dgm
dgm commented Oct 7, 2012

Doesn't this violate the one assertion per test principal? ;) FWIW, I agree with this practices, but just goes to show that the other rule is more of a guideline.

@cupakromer

I don't believe it violates the 'one assertion rule' by definition. It will depend entirely on how you define your shared example. The intent is to group behavior, so it can include multiple single assertion cases. See https://www.relishapp.com/rspec/rspec-core/v/2-11/docs/example-groups/shared-examples for examples of this.

@gavingmiller

The GOOD example is missing the actual shared examples, so this code doesn't make sense unless someone knows how shared examples work.

@iRet
iRet commented Sep 18, 2014

@gavingmiller absolutely right. Shared examples definition part is missing. It is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment