Module: Practical::Test::Helpers::Shrine::TestData
- Defined in:
- app/lib/practical/test/helpers/shrine/test_data.rb
Instance Method Summary collapse
- #csv_file ⇒ Object
- #csv_filepath ⇒ Object
- #excel_file ⇒ Object
- #excel_filepath ⇒ Object
- #heic_file ⇒ Object
- #heic_filepath ⇒ Object
- #image_data ⇒ Object
- #image_file ⇒ Object
- #image_filepath ⇒ Object
- #numbers_file ⇒ Object
- #numbers_filepath ⇒ Object
- #pdf_file ⇒ Object
- #pdf_filepath ⇒ Object
- #plaintext_file ⇒ Object
- #plaintext_filepath ⇒ Object
- #rtf_file ⇒ Object
- #rtf_filepath ⇒ Object
- #uploaded_image ⇒ Object
- #word_file ⇒ Object
- #word_filepath ⇒ Object
Instance Method Details
#csv_file ⇒ Object
50 51 52 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 50 def csv_file File.open(csv_filepath) end |
#csv_filepath ⇒ Object
46 47 48 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 46 def csv_filepath file_fixture("example.csv") end |
#excel_file ⇒ Object
58 59 60 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 58 def excel_file File.open(excel_filepath) end |
#excel_filepath ⇒ Object
54 55 56 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 54 def excel_filepath file_fixture("example.xlsx") end |
#heic_file ⇒ Object
42 43 44 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 42 def heic_file File.open(heic_filepath) end |
#heic_filepath ⇒ Object
38 39 40 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 38 def heic_filepath file_fixture("island.heic") end |
#image_data ⇒ Object
11 12 13 14 15 16 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 11 def image_data attacher = Shrine::Attacher.new attacher.set(uploaded_image) attacher.data end |
#image_file ⇒ Object
34 35 36 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 34 def image_file File.open(image_filepath) end |
#image_filepath ⇒ Object
30 31 32 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 30 def image_filepath file_fixture("dog.jpeg") end |
#numbers_file ⇒ Object
82 83 84 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 82 def numbers_file File.open(numbers_filepath) end |
#numbers_filepath ⇒ Object
78 79 80 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 78 def numbers_filepath file_fixture("numbers-example.numbers") end |
#pdf_file ⇒ Object
66 67 68 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 66 def pdf_file File.open(pdf_filepath) end |
#pdf_filepath ⇒ Object
70 71 72 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 70 def pdf_filepath file_fixture("example.pdf") end |
#plaintext_file ⇒ Object
90 91 92 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 90 def plaintext_file File.open(plaintext_filepath) end |
#plaintext_filepath ⇒ Object
86 87 88 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 86 def plaintext_filepath file_fixture("example.txt") end |
#rtf_file ⇒ Object
98 99 100 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 98 def rtf_file File.open(rtf_filepath) end |
#rtf_filepath ⇒ Object
94 95 96 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 94 def rtf_filepath file_fixture("example.rtf") end |
#uploaded_image ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 18 def uploaded_image file = image_file uploaded_file = Shrine.upload(file, :store, metadata: false) uploaded_file..merge!( "size" => File.size(file.path), "mime_type" => "image/jpeg", "filenae" => "test.jpeg" ) uploaded_file end |
#word_file ⇒ Object
74 75 76 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 74 def word_file File.open(word_filepath) end |
#word_filepath ⇒ Object
62 63 64 |
# File 'app/lib/practical/test/helpers/shrine/test_data.rb', line 62 def word_filepath file_fixture("example.docx") end |