On Wednesday, January 15, 2014 5:54:53 AM UTC-8, siva wrote:
>
>
>   Hi all
>
>    I am doing some stunts using around each. I found some different odd 
> with around(:each). When I run below example it gives output as:
>
>    describe "AroundSpec" do
>        before(:each) do
>           p "On before each block"
>         end 
>
>         around(:each) do
>             p "On around each block"
>         end 
>
>          it "1+1 = 2" do
>             expect(1+1).to eq(2)
>          end 
>    end
>   
>    output:
>       "On around each block"
>      .
>
>       Finished in 0.00038 seconds
>       1 example, 0 failures
>
>
>      If you notice it doesn't executing before each block. Is this way 
> suppose to be it work or is it a bug? Could you help out. Thanks in advance
>
>
That's working as expected.  In `around(:each)` you have to call `run` on 
the yielded arg, as documented:

http://rubydoc.info/gems/rspec-core/RSpec/Core/Hooks#around-instance_method

If you do not do this, the example will not run.  Given that it is an 
around hook, you are responsible for telling rspec when to run the example, 
so you can wrap it however you like.

Myron 

-- 
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/b9f75681-3158-4fd1-b052-8b9f8b7f6d40%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to