1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/lib/partynest/rspec_account_role_helpers.rb
2018-12-13 09:31:27 +05:00

35 lines
973 B
Ruby

# frozen_string_literal: true
module Partynest
module RSpecAccountRoleHelpers
def create_account_type(account_type)
return if account_type.nil?
create "#{account_type}_account"
end
module ClassMethods
def for_account_types(*account_types, &block)
account_types.each do |account_type|
context "when #{account_type || :no_account} is authenticated" do
let(:current_account) { create_account_type account_type }
let(:account) { current_account }
instance_eval(&block)
end
end
end
def xfor_account_types(*account_types, &block)
account_types.each do |account_type|
xcontext "when #{account_type || :no_account} is authenticated" do
let(:current_account) { create_account_type account_type }
let(:account) { current_account }
instance_eval(&block)
end
end
end
end
end
end