summaryrefslogtreecommitdiff
path: root/qa/qa/resource/design.rb
blob: 182985f2d9fc535a78e45eea722f66a93ff91bea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

module QA
  module Resource
    class Design < Base
      attr_reader :id
      attr_accessor :filename

      attribute :issue do
        Issue.fabricate_via_api!
      end

      def initialize
        @update = false
        @filename = 'banana_sample.gif'
      end

      # TODO This will be replaced as soon as file uploads over GraphQL are implemented
      def fabricate!
        issue.visit!

        Page::Project::Issue::Show.perform do |issue|
          issue.add_design(filepath)
        end
      end

      private

      def filepath
        ::File.absolute_path(::File.join('qa', 'fixtures', 'designs', @filename))
      end
    end
  end
end