1

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})

明らかなことを見逃しましたか?

4

1 に答える 1