Rails - RSpec - Difference between "let" and "let!"
I have read what the [RSpec manual][1] says about the difference, but some things are still confusing. Every other source, including "The RSpec Book" only explain about "let", and "The Rails 3 Way" is just as confusing as the manual.

I understand that "let" is only evaluated when invoked, and keeps the same value within a scope. So it makes sense that in the first example in the [manual][1] the first test passes as the "let" is invoked only once, and the second test passes as it adds to the value of the first test (which was evaluated once in the first test and has the value of 1).

Following that, since "let!" evaluates when defined, and again when invoked, should the test not fail as "count.should eq(1)" should have instead be "count.should eq(2)"?

Any help would be appreciated.


  [1]: https://www.relishapp.com/rspec/rspec-core/v/2-9/docs/helper-methods/let-and-let
Rails - RSpec - Difference between "let" and "let!"
===

I have read what the [RSpec manual][1] says about the difference, but some things are still confusing. Every other source, including "The RSpec Book" only explain about "let", and "The Rails 3 Way" is just as confusing as the manual.

I understand that "let" is only evaluated when invoked, and keeps the same value within a scope. So it makes sense that in the first example in the [manual][1] the first test passes as the "let" is invoked only once, and the second test passes as it adds to the value of the first test (which was evaluated once in the first test and has the value of 1).

Following that, since "let!" evaluates when defined, and again when invoked, should the test not fail as "count.should eq(1)" should have instead be "count.should eq(2)"?

Any help would be appreciated.


  [1]: https://www.relishapp.com/rspec/rspec-core/v/2-9/docs/helper-methods/let-and-let