Skip to content

Commit

Permalink
Update docs for ref and lazy types
Browse files Browse the repository at this point in the history
Closes #63
  • Loading branch information
Quintasan committed Jun 23, 2021
1 parent 05847f3 commit 5a33a3a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,31 @@ describe "Custom naming for hash syntax" do
end
end

# Use ref(:symbol) to use let/let! defined variables in the where block
# Use lazy when you want to create let/let! variables after the where block
#
# Failures will be more readable in the future - https://github.com/tomykaira/rspec-parameterized/pull/65
describe "lazy and ref types" do
let(:one) { 1 }
let(:four) { 4 }

where(:a, :b, :result) do
[
[ref(:one), ref(:four), lazy { two + three }]
]
end

with_them do
context "use let after where block" do
let(:two) { 2 }
let(:three) { 3 }

it 'should equal 5' do
expect(a + b).to eq result
end
end
end
end
```

I was inspired by [udzura's mock](https://gist.github.com/1881139).
Expand Down

0 comments on commit 5a33a3a

Please sign in to comment.