Skip to content

Instantly share code, notes, and snippets.

@ralphos
Created June 7, 2014 15:34
Show Gist options
  • Save ralphos/a676e491bc776c7d9174 to your computer and use it in GitHub Desktop.
Save ralphos/a676e491bc776c7d9174 to your computer and use it in GitHub Desktop.
Feature spec setup smell
# ...
def create_seller_with_company_debtor_invoice_and_auction(args = {})
company = create(:company, name: args.fetch(:company_name))
debtor = create(:debtor, status: args.fetch(:debtors_status),
company: company)
seller = create(:seller, status: args.fetch(:seller_status))
create(:user, email: args.fetch(:email),
password: args.fetch(:password),
account: seller,
company: company)
create(:invoice, status: args.fetch(:invoice_status),
debtor: debtor,
company: company)
create(:auction, total_face_value: args.fetch(:total_face_value),
start_date: args.fetch(:start_date),
end_date: args.fetch(:end_date),
company: company)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment