On Mon, Jun 16, 2014 at 1:48 AM, Arup Rakshit <[email protected]> wrote:
> > > > >> As I understand it: >> >> before(:all) runs the block one time before all of the examples are run. >> before(:each) runs the block one time before each of your specs in the >> file >> >> http://stackoverflow.com/questions/16617052/rails- >> rspec-before-all-vs-before-each >> >> @robpark >> >>> >> > > But I got the below when I applied *:all* > > Arup-iMac:yelloday shreyas$ rspec spec/models/post_spec.rb > ...WARNING: let declaration `user1` accessed in a `before(:all)` hook at: > /Users/shreyas/yelloday/spec/models/post_spec.rb:881:in `block (4 > levels) in <top (required)>' > > This is deprecated behavior that will not be supported in RSpec 3. > > `let` and `subject` declarations are not intended to be called > in a `before(:all)` hook, as they exist to define state that > is reset between each example, while `before(:all)` exists to > define state that is shared across examples in an example group. > WARNING: let declaration `post1` accessed in a `before(:all)` hook at: > /Users/shreyas/yelloday/spec/models/post_spec.rb:881:in `block (4 > levels) in <top (required)>' > > This is deprecated behavior that will not be supported in RSpec 3. > > `let` and `subject` declarations are not intended to be called > in a `before(:all)` hook, as they exist to define state that > is reset between each example, while `before(:all)` exists to > define state that is shared across examples in an example group. > WARNING: let declaration `user1` accessed in a `before(:all)` hook at: > /Users/shreyas/yelloday/spec/models/post_spec.rb:882:in `block (4 > levels) in <top (required)>' > > This is deprecated behavior that will not be supported in RSpec 3. > > `let` and `subject` declarations are not intended to be called > in a `before(:all)` hook, as they exist to define state that > is reset between each example, while `before(:all)` exists to > define state that is shared across examples in an example group. > WARNING: let declaration `post2` accessed in a `before(:all)` hook at: > /Users/shreyas/yelloday/spec/models/post_spec.rb:882:in `block (4 > levels) in <top (required)>' > > This is deprecated behavior that will not be supported in RSpec 3. > > `let` and `subject` declarations are not intended to be called > in a `before(:all)` hook, as they exist to define state that > is reset between each example, while `before(:all)` exists to > define state that is shared across examples in an example group. > > ................................................................................................................... > > Finished in 16.27 seconds > 118 examples, 0 failures > > "let" isn't supported in before(:all) like it is in before(:each). It doesn't really mean the same thing symantically at that point and AFAIK, you need to use @member vars to work around this. Also see: https://github.com/rspec/rspec-core/pull/857 @robpark -- 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/CANkqiS2SsP6D_0AMjEeC0amz4Ps%3D6mDJf9Qo3VKPOi2tJFJ_cA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
