Q:

FactoryGirl conditional attribute

I have a factory attribute called type. Right now it works for one string. How can I make it so I use the same factory but use it with another string type 'Quiz'. So, I want to test if the type 'PhotoUploadCampaign' then run the PhotoUpload attributes for that factory. If the type 'Quiz' then run Quiz attributes for that factory.
Factory campaign file
FactoryGirl.define do
  factory :campaign do    
    type 'PhotoUploadCampaign'
  end
end

Campaign step file
Given(/^there's a photo upload campaign$/) do
  @campaign = create(:campaign)
end

A:

With factory girl you can specify attributes when you create or build the factory.
The definition you have now is just the default.
In your specs you can do 
@campaign = create(:campaign, type: 'Quiz')

This will do the same logic as before, but with Quiz instead of PhotoUploadCampaign

