Hi,

I would like to have your opinion on the following.

I have found very useful to verify the context of an example. What do I 
mean? See the following example:

describe MyClass do
  describe '#process' do
    context 'when something is a Hash' do
       let(:something) { build(:something) }

       before do
          expect(something).to be_a(Hash)
       end

       it 'returns an open struct' do
         expect(subject.process(something)).to be_a(OpenStruct)
       end
    end
  end
end

Do you see that in the before block I am verifying that the context of the 
"it" is correct?

To me, this has been proven very useful. Because sometimes, the context 
setup code might not be doing what we are expecting it to do. The 
verification code does the double check.

What is your opinion about this practice? Is this a practice that you apply 
too? Or am I overprotective?

Panos

-- 
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/16d4fe65-f841-433e-af96-60a4d61e332f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to