your request parameter hash has an object as the value: zone, when you publish it, it will just be "to_s'-ed", which is unlikely what you want.
In general, it is best to use a factory girl to create your objects and use attributes for a strategy to parameterize your attributes for a mail request: What is the correct way to test the controller’s “create” actions?
Your question assumes the association is an affiliation, so you just need to place the identifier. Keep in mind that FactoryGirl does not currently create any attributes for associations. If your factory definition for a rule takes care of zone association, you can use this workaround:
FactoryGirl.build(:flymgr_rule).attributes
also include zone_id, but then you need to exclude unwanted parameters. ("id", "created_at", "updated_at", etc.).
Thus, you might be better off explicitly inserting the params hash information for the zone as you see it in the actual mail request.
Read this thread about factorygirl attributes and associations: https://github.com/thoughtbot/factory_girl/issues/359
source share