I have this code:
FactoryGirl.define do
factory :gimme_a_hash, class: Hash do
one 'the number 1'
two 'the number 2'
end
end
It returns a hash that looks like:
1.9.3p448 :003 > FactoryGirl.build : gimme_a_hash
=> {:one=>"the number 1", :two=>"the number 2"}
How do I create a factory that returns a Hash with stringified numbers as keys?
Ideally i'd like to have the following hash returned:
=> { "1"=>"the number 1", "2"=>"the number 2"}
Thank you!
initialize_with
and it's block? I'd also love to understand how you came to the decision of usingf.send
. – Jessie