Random things, I think I know

RSpec `let` gotcha! Plus assignment

Recently I tried something like
```ruby
let(:array_of_numbers) { [1, 2, 3, 4, 5] }

it 'should have a description' do
  expect([1, 2, 3, 4, 5, 6]).to eql(array_of_numbers += [6])
end
```
It did not work, as in the plus assignment statement ruby expects `array_of_numbers` to be a variable not a method call.

No comments:

Post a Comment