diff options
Diffstat (limited to 'qa/qa/resource/reusable_group.rb')
-rw-r--r-- | qa/qa/resource/reusable_group.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/qa/qa/resource/reusable_group.rb b/qa/qa/resource/reusable_group.rb deleted file mode 100644 index 05ff38249f6..00000000000 --- a/qa/qa/resource/reusable_group.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -module QA - module Resource - class ReusableGroup < Group - prepend Reusable - - def initialize - super - - @name = @path = QA::Runtime::Env.reusable_group_path - @description = "QA reusable group" - @reuse_as = :default_group - end - - private - - # Creates a new group that can be compared to a reused group, using the attributes of the original. Attributes that - # must be unique (path and name) are replaced with new unique values. - # - # @return [QA::Resource] a new instance of Resource::ReusableGroup that should be a copy of the original resource - def reference_resource - attributes = self.class.resources[reuse_as][:attributes] - name = "ref#{SecureRandom.hex(8)}_#{attributes.delete(:path)}"[0...MAX_NAME_LENGTH] - - Group.fabricate_via_api! do |resource| - self.class.resources[reuse_as][:attributes].each do |attribute_name, attribute_value| - resource.instance_variable_set("@#{attribute_name}", attribute_value) if attribute_value - end - resource.path = name - resource.name = name - end - end - - # The attributes of the resource that should be the same whenever a test wants to reuse a group. - # - # @return [Array<Symbol>] the attribute names. - def unique_identifiers - [:name, :path] - end - end - end -end |