spec/support/star_wars_data.rb in graphql-relay-0.7.1 vs spec/support/star_wars_data.rb in graphql-relay-0.8.0
- old
+ new
@@ -57,10 +57,11 @@
},
"Ship" => names.each_with_index.reduce({}) do |memo, (name, idx)|
id = (idx + 1).to_s
memo[id] = OpenStruct.new(name: name, id: id)
memo
- end
+ end,
+ "Base" => Hash.new { |h, k| h[k] = Base.find(k) }
}
def STAR_WARS_DATA.create_ship(name, faction_id)
new_id = (self["Ship"].keys.map(&:to_i).max + 1).to_s
new_ship = OpenStruct.new(id: new_id, name: name)