Fabricating objects that inherit from Hashie::Mash may break in 2.23.0
Hi there!
Just a heads up for an issue I noticed when upgrading to 2.23.0 in our code:
This change: da7a3c2e alters the way objects are fabricated when using objects that inherit from Hashie::Mash.
Instead of setting the key/values directly, they are now set inside an "attributes" variable, which breaks implementations that expect the values to be set directly.
For example, fabricating a devise Oauth hash ( https://github.com/omniauth/omniauth/blob/master/lib/omniauth/auth_hash.rb ) is now broken, because all the variables in the fabrication definition are now nested inside an attributes hash.
Before 2.23.0
Fabricator(:omniauth_hash, :class_name => "OmniAuth::AuthHash") do
provider :github
uid { Devise.friendly_token[0, 10].to_s }
info { { :name => Faker::Name.name, :email => Faker::Internet.email, :nickname => Faker::Name.name } }
end
Fabricate(:omniauth_hash) => {
"provider"=>:github,
"uid"=>"5555555",
"info"=>{"name"=>"Jun", "nickname"=>"Kimmel"}
}
After 2.23.0
Fabricator(:omniauth_hash, :class_name => "OmniAuth::AuthHash") do
provider :github
uid { Devise.friendly_token[0, 10].to_s }
info { { :name => Faker::Name.name, :email => Faker::Internet.email, :nickname => Faker::Name.name } }
end
Fabricate(:omniauth_hash) => {
"attributes" => {
"provider"=>:github,
"uid"=>"5555555",
"info"=>{"name"=>"Jun", "nickname"=>"Kimmel"}
}
}