This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2018-12-13 04:04:38 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Partynest
|
|
|
|
module RSpecAccountRoleHelpers
|
|
|
|
def for_account_types(*account_types, &block)
|
|
|
|
account_types.each do |account_type|
|
|
|
|
account_type = :"#{account_type}_account" unless account_type.nil?
|
|
|
|
|
|
|
|
context "when #{account_type || :no_account} is authenticated" do
|
|
|
|
let(:current_account) { create account_type if account_type }
|
|
|
|
let(:account) { current_account }
|
|
|
|
|
|
|
|
instance_eval(&block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-12-13 04:18:44 +00:00
|
|
|
|
|
|
|
def xfor_account_types(*account_types, &block)
|
|
|
|
account_types.each do |account_type|
|
|
|
|
account_type = :"#{account_type}_account" unless account_type.nil?
|
|
|
|
|
|
|
|
xcontext "when #{account_type || :no_account} is authenticated" do
|
|
|
|
let(:current_account) { create account_type if account_type }
|
|
|
|
let(:account) { current_account }
|
|
|
|
|
|
|
|
instance_eval(&block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-12-13 04:04:38 +00:00
|
|
|
end
|
|
|
|
end
|