> 1/ What is the best way to make a gem containing shared contexts/examples

You’re probably going to want to create a bunch of modules that define the 
shared examples when included, the benefit of this is that it will allow you to 
control which scopes they are defined in without risking stomping over any 
existing examples at the top level.

For 2) I’d just test the shared examples in the gems own test suite, given 
whatever context they should pass, you could use the `pending` flag for 
contexts that are expected to fail. If you wanted to go fully comprehensive 
you’ll need to go down the smoke test / sand boxed route with running the 
suites within rspec itself, you can see how we’ve done this in the main test 
suites but its a lot more complex.

Cheers
Jon Rowe
---------------------------
[email protected]
jonrowe.co.uk


On Monday, 22 May 2017 at 12:42, Samuel Williams wrote:

> I'd like to make a gem, which includes several `RSpec.shared_context` 
> definitions. These are useful for other gems which share the same testing 
> environment but do different things, to use the same shared examples/contexts.
>  
> However, I'd also like to test that my shared contexts are doing the right 
> thing. In some cases, they simply ensure that some stuff has been set up 
> correctly. In other cases, they check pre- and post- invariants.
>  
> 1/ What is the best way to make a gem containing shared contexts/examples
>  
> 2/ In the gem that's making these available, what's the best way to test 
> them? I'm assuming... I'm going to write a test case and, then, another test 
> case which invokes the first test case. In the case of setup, I'd like to 
> ensure that the given `let` variables exist, and in the case of the invariant 
> check, to detect success/failure, and confirm that the invariant is firing 
> correctly.
>  
> Thanks for any help/input.  
>  
> --  
> You received this message because you are subscribed to the Google Groups 
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> (mailto:[email protected]).
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rspec/fa5dd6e0-4008-4bfc-a760-855bd3b0502c%40googlegroups.com
>  
> (https://groups.google.com/d/msgid/rspec/fa5dd6e0-4008-4bfc-a760-855bd3b0502c%40googlegroups.com?utm_medium=email&utm_source=footer).
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/EE822C64C0F54695B538BED434EF8F7E%40jonrowe.co.uk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to