我正在尝试从 Twitter gem 中制作 Twitter::Tweet 类。我得到了这个错误
undefined method `id' for #<Fabrication::Schematic::Runner:0x00000102da7c28>
这是我的制造商。
Fabricator(:twitter_tweet, from: 'Twitter::Tweet', class_name: 'Twitter::Tweet') do
id "1"
text "tweet"
created_at Time.now
user {
id "created_by_social_id"
name "name"
location "location"
}
entites {
user_mentions nil
}
end
但我可以像这样手动创建它。
tweet = Twitter::Tweet.new(:id => "1",
:created_at => Time.now.to_s,
:text => "text",
:user => {
:id => "created_by_social_id",
:name => "name",
:location => "location"
},
:entities => {:user_mentions => user_mentions})
我错过了什么明显的东西吗?