jeudi 17 novembre 2022

Creating array value in Rspec with let() method

how can i make array value in rspec test?

If I make array like this (in SAMPLE_spec.rb file), ->>

let(:fruit) { [name:  ‘apple’, color: ‘red’] }

fruit.length --->> this becomes error

fruit[0].length --->>this works well

i want to make array and use like fruit.length. how can i change my code?

Aucun commentaire:

Enregistrer un commentaire